Changeset 0ec8a7c for tools/traceanon


Ignore:
Timestamp:
02/27/15 17:31:03 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
98dc1ba
Parents:
7718e54
Message:

Change the user interface from a message and a packet to only messages.

Now a packet is a type of message (MESSAGE_PACKET).
I expanded the message structure into seperate arguments such that these
will be passed in registers on x64 systems. As such performance has
remained identical if not better.

I renamed libtrace_generic_types_t to libtrace_generic_t so it was shorter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/traceanon/traceanon_parallel.c

    rd994324 r0ec8a7c  
    154154
    155155
    156 static void* per_packet(libtrace_t *trace, libtrace_packet_t *pkt, libtrace_message_t *mesg, UNUSED libtrace_thread_t *t)
    157 {
    158         if (pkt) {
    159                 struct libtrace_ip *ipptr;
    160                 libtrace_udp_t *udp = NULL;
    161                 libtrace_tcp_t *tcp = NULL;
    162 
    163                 ipptr = trace_get_ip(pkt);
     156static void* per_packet(libtrace_t *trace, libtrace_thread_t *t,
     157                        int mesg, libtrace_generic_t data,
     158                        libtrace_thread_t *sender UNUSED)
     159{
     160        struct libtrace_ip *ipptr;
     161        libtrace_udp_t *udp = NULL;
     162        libtrace_tcp_t *tcp = NULL;
     163
     164        switch (mesg) {
     165        case MESSAGE_PACKET:
     166                ipptr = trace_get_ip(data.pkt);
    164167
    165168                if (ipptr && (enc_source || enc_dest)) {
     
    173176                /* XXX replace with nice use of trace_get_transport() */
    174177
    175                 udp = trace_get_udp(pkt);
     178                udp = trace_get_udp(data.pkt);
    176179                if (udp && (enc_source || enc_dest)) {
    177180                        udp->check = 0;
    178181                }
    179182
    180                 tcp = trace_get_tcp(pkt);
     183                tcp = trace_get_tcp(data.pkt);
    181184                if (tcp && (enc_source || enc_dest)) {
    182185                        tcp->check = 0;
     
    191194                //trace_publish_result(trace, trace_packet_get_order(pkt), pkt);
    192195
    193                 trace_publish_result(trace, t, trace_packet_get_order(pkt), (libtrace_generic_types_t){.pkt=pkt}, RESULT_PACKET);
    194                 //return ;
    195         }
    196         if (mesg) {
    197                 // printf ("%d.%06d READ #%"PRIu64"\n", tv.tv_sec, tv.tv_usec, trace_packet_get(packet));
    198                 switch (mesg->code) {
    199                         case MESSAGE_STARTING:
    200                                 enc_init(enc_type,key);
    201                         break;
    202                         case MESSAGE_TICK:
    203                                 trace_publish_result(trace, t, mesg->additional.uint64, (libtrace_generic_types_t){.pkt=NULL}, RESULT_TICK);
    204                 }
     196                trace_publish_result(trace, t, trace_packet_get_order(data.pkt), data, RESULT_PACKET);
     197                break;
     198        case MESSAGE_STARTING:
     199                enc_init(enc_type,key);
     200                break;
     201        case MESSAGE_TICK:
     202                trace_publish_result(trace, t, data.uint64, (libtrace_generic_t){0}, RESULT_TICK);
     203                break;
    205204        }
    206205        return NULL;
     
    423422         
    424423        int i = 1;
    425         trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_types_t){0});
     424        trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t){0});
    426425        trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc);
    427426
Note: See TracChangeset for help on using the changeset viewer.