Ignore:
Timestamp:
03/05/15 15:44:30 (7 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.c

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