Ignore:
Timestamp:
03/05/15 15:44:30 (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:
ab3fa18
Parents:
b023181
Message:

Update the reporter method to match with the per_pkt method.

We now treat a result as a type of message.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test-format-parallel-singlethreaded-hasher.c

    r98dc1ba r62b3c4e  
    102102static int totalpkts = 0;
    103103static int expected;
    104 static void report_result(libtrace_t *trace, libtrace_result_t *result, libtrace_message_t *mesg) {
     104static void report_result(libtrace_t *trace UNUSED, int mesg,
     105                          libtrace_generic_t data,
     106                          libtrace_thread_t *sender UNUSED) {
    105107        static int totalthreads = 0;
    106         if (result) {
    107                 assert(libtrace_result_get_key(result) == 0);
    108                 printf("%d,", libtrace_result_get_value(result).sint);
     108        switch (mesg) {
     109        case MESSAGE_RESULT:
     110                assert(libtrace_result_get_key(data.res) == 0);
     111                printf("%d,", libtrace_result_get_value(data.res).sint);
    109112                totalthreads++;
    110                 totalpkts += libtrace_result_get_value(result).sint;
    111         } else {
    112                 switch(mesg->code) {
    113                         case MESSAGE_STARTING:
    114                                 // Should have a single thread here
    115                                 assert(libtrace_get_perpkt_count(trace) == 1);
    116                                 printf("\tLooks like %d threads are being used!\n\tcounts(", libtrace_get_perpkt_count(trace));
    117                                 break;
    118                         case MESSAGE_STOPPING:
    119                                 printf(")\n");
    120                                 assert(totalthreads == libtrace_get_perpkt_count(trace));
    121                                 break;
    122                 }
     113                totalpkts += libtrace_result_get_value(data.res).sint;
     114                break;
     115        case MESSAGE_STARTING:
     116                // Should have a single thread here
     117                assert(libtrace_get_perpkt_count(trace) == 1);
     118                printf("\tLooks like %d threads are being used!\n\tcounts(", libtrace_get_perpkt_count(trace));
     119                break;
     120        case MESSAGE_STOPPING:
     121                printf(")\n");
     122                assert(totalthreads == libtrace_get_perpkt_count(trace));
     123                break;
    123124        }
    124125}
Note: See TracChangeset for help on using the changeset viewer.