Commit Graph

5 Commits

Author SHA1 Message Date
Pavel Odintsov be8afbd1b7 Reformatted source code with clang-format 2020-05-23 19:55:10 +01:00
Pavel Odintsov bdb59067cf Add Tins performance evaluation.
It's very SLOW! They do so much memory allocations/deallocations in source code.

Samples: 8K of event 'cpu-clock', Event count (approx.): 1832523402
  21.19%  libc-2.19.so         [.] _int_free
  18.51%  libc-2.19.so         [.] malloc
  12.14%  libc-2.19.so         [.] _int_malloc
   5.77%  a.out                [.] Tins::TCP* Tins::PDU::find_pdu<Tins::TCP>(Tins::PDU::PDUType)
   4.36%  libtins.so.3.3       [.] Tins::PDU::matches_flag(Tins::PDU::PDUType) const
   3.68%  a.out                [.] call_tins_parser(void*, int)
   3.25%  a.out                [.] Tins::IP* Tins::PDU::find_pdu<Tins::IP>(Tins::PDU::PDUType)
   2.29%  libtins.so.3.3       [.] Tins::IP::IP(unsigned char const*, unsigned int)

70 EthernetII::EthernetII(const uint8_t *buffer, uint32_t total_sz)
 71 {
 72     if(total_sz < sizeof(ethhdr))
 73         throw malformed_packet();
 74     memcpy(&_eth, buffer, sizeof(ethhdr));
 75     buffer += sizeof(ethhdr);
 76     total_sz -= sizeof(ethhdr);
 77     if(total_sz) {
 78         inner_pdu(
 79             Internals::pdu_from_flag(
 80                 (Constants::Ethernet::e)payload_type(),
 81                 buffer,
 82                 total_sz
 83             )
 84         );
 85     }
2015-07-06 06:33:21 -04:00
Pavel Odintsov 80eedd85a9 Add tins to parser tests 2015-07-05 17:19:03 -04:00
Pavel Odintsov 82b40f88fd Add address change code 2015-07-05 10:35:31 -04:00
Pavel Odintsov 36456da75f Add test for packet parser performance evaluation 2015-07-05 10:05:24 -04:00