Ignore:
Timestamp:
02/22/11 10:01:08 (11 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
e4e94c38
Parents:
ae76c14
Message:
  • Fixed poor performance of the event API by greatly reducing the amount of packets created, copied and freed
  • We now cache the transport header and payload length for each packet
  • We now deal with Linux SLL Ethernet captures taken using tcpdump with -i any correctly.
  • Changed parameters for internal function trace_get_payload_from_sll - it now sets both the arphrd type and the next protocol
  • Moved ARPHRD definitions into a separate header file, as they come in handy anywhere we deal with SLL headers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_helper.c

    rb5af22c r9cc1266  
    143143
    144144        if (!trace->event.packet) {
     145                trace->event.packet = trace_create_packet();
     146        }
     147
     148        if (!trace->event.waiting) {
    145149                /* There is no packet event waiting for us, so create a new
    146150                 * libtrace packet in the event structure and read the next
     
    151155                 * function is called. */
    152156
    153                 trace->event.packet = trace_create_packet();
    154157                trace->event.psize=
    155158                        trace_read_packet(trace,trace->event.packet);
     
    195198                                trace->event.trace_last_ts;
    196199                        event.type = TRACE_EVENT_SLEEP;
     200                        trace->event.waiting = true;
    197201                        return event;
    198202                }
     
    214218        /* We do a lot of freeing and creating of packet buffers with this
    215219         * method, but at least it works unlike what was here previously */
    216         if (packet->buf_control == TRACE_CTRL_PACKET) {
    217                 free(packet->buffer);
    218         }
     220        //if (packet->buf_control == TRACE_CTRL_PACKET) {
     221        //      free(packet->buffer);
     222        //}
    219223       
    220224        /* The packet that we had read earlier is now ready to be returned
     
    228232        packet->buf_control = trace->event.packet->buf_control;
    229233
    230         trace->event.packet->buffer = NULL;
    231         trace->event.packet->buf_control = TRACE_CTRL_EXTERNAL;
    232        
    233         trace_destroy_packet(trace->event.packet);
    234         trace->event.packet = NULL;
     234        //trace->event.packet->buffer = NULL;
     235        //trace->event.packet->buf_control = TRACE_CTRL_EXTERNAL;
     236       
     237        //trace_destroy_packet(trace->event.packet);
     238        //trace->event.packet = NULL;
    235239
    236240        event.type = TRACE_EVENT_PACKET;
    237241
    238242        trace->event.trace_last_ts = ts;
     243        trace->event.waiting = false;
    239244
    240245        return event;
Note: See TracChangeset for help on using the changeset viewer.