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.c

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