Changeset 62b3c4e for lib


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.

Location:
lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lib/combiner_ordered.c

    rd994324 r62b3c4e  
    6060                /* Get the minimum queue and then do stuff */
    6161                libtrace_result_t r;
     62                libtrace_generic_t gt = {.res = &r};
    6263
    6364                ASSERT_RET (libtrace_deque_pop_front(&queues[min_queue], (void *) &r), == 1);
    64                 trace->reporter(trace, &r, NULL);
     65                trace->reporter(trace, MESSAGE_RESULT, gt, &trace->reporter_thread);
    6566
    6667                // We expect the key we read +1 now , todo put expected in our storage area
  • lib/combiner_sorted.c

    rd994324 r62b3c4e  
    5858        for (a = 0; a < libtrace_vector_get_size(&queues[0]); ++a) {
    5959                libtrace_result_t r;
    60                 ASSERT_RET (libtrace_vector_get(&queues[0], a,  (void *) &r), == 1);
    61                 trace->reporter(trace, &r, NULL);
     60                libtrace_generic_t gt = {.res = &r};
     61                ASSERT_RET (libtrace_vector_get(&queues[0], a, (void *) &r), == 1);
     62                trace->reporter(trace, MESSAGE_RESULT, gt, &trace->reporter_thread);
    6263        }
    6364        libtrace_vector_empty(&queues[0]);
  • lib/combiner_unordered.c

    rd994324 r62b3c4e  
    3434                while (libtrace_deque_get_size(v) != 0) {
    3535                        libtrace_result_t r;
     36                        libtrace_generic_t gt = {.res = &r};
    3637                        ASSERT_RET (libtrace_deque_pop_front(v, (void *) &r), == 1);
    37                         trace->reporter(trace, &r, NULL);
     38                        trace->reporter(trace, MESSAGE_RESULT, gt, &trace->reporter_thread);
    3839                }
    3940        }
  • lib/libtrace.h.in

    r0ec8a7c r62b3c4e  
    34613461/*@}*/
    34623462
     3463typedef struct libtrace_result_t libtrace_result_t;
    34633464/**
    34643465 * A collection of types for convenience used in place of a
     
    34713472        void *ptr;
    34723473        libtrace_packet_t *pkt;
     3474        libtrace_result_t *res;
    34733475
    34743476        /* C99 Integer types */
     
    35173519
    35183520/** Structure holding information about a result */
    3519 typedef struct libtrace_result_t {
     3521struct libtrace_result_t {
    35203522        uint64_t key;
    35213523        libtrace_generic_t value;
    35223524        int type;
    3523 } libtrace_result_t;
     3525};
    35243526#define RESULT_NORMAL 0
    35253527#define RESULT_PACKET 1
     
    35463548                            libtrace_generic_t data,
    35473549                            libtrace_thread_t *sender);
    3548 typedef void (*fn_reporter)(libtrace_t* trace, libtrace_result_t *r, libtrace_message_t *m);
     3550typedef void (*fn_reporter)(libtrace_t* trace,
     3551                            int mesg_code,
     3552                            libtrace_generic_t data,
     3553                            libtrace_thread_t *sender);
    35493554typedef uint64_t (*fn_hasher)(const libtrace_packet_t* packet, void *data);
    35503555
     
    36193624enum libtrace_messages {
    36203625        MESSAGE_PACKET,
     3626        MESSAGE_RESULT,
    36213627        MESSAGE_STARTING,
    36223628        MESSAGE_RESUMING,
  • lib/trace_parallel.c

    r0ec8a7c r62b3c4e  
    10351035        ASSERT_RET(pthread_mutex_unlock(&trace->libtrace_lock), == 0);
    10361036
    1037         message.code = MESSAGE_STARTING;
    1038         message.sender = t;
    1039         (*trace->reporter)(trace, NULL, &message);
    1040         message.code = MESSAGE_RESUMING;
    1041         (*trace->reporter)(trace, NULL, &message);
     1037        (*trace->reporter)(trace, MESSAGE_STARTING, (libtrace_generic_t) {0}, t);
     1038        (*trace->reporter)(trace, MESSAGE_RESUMING, (libtrace_generic_t) {0}, t);
    10421039
    10431040        while (!trace_finished(trace)) {
     
    10561053                                assert(trace->combiner.pause);
    10571054                                trace->combiner.pause(trace, &trace->combiner);
    1058                                 message.code = MESSAGE_PAUSING;
    1059                                 message.sender = t;
    1060                                 (*trace->reporter)(trace, NULL, &message);
     1055                                (*trace->reporter)(trace, MESSAGE_PAUSING, (libtrace_generic_t) {0}, t);
    10611056                                trace_thread_pause(trace, t);
    1062                                 message.code = MESSAGE_RESUMING;
    1063                                 (*trace->reporter)(trace, NULL, &message);
     1057                                (*trace->reporter)(trace, MESSAGE_RESUMING, (libtrace_generic_t) {0}, t);
    10641058                                break;
    1065                         default:
    1066                                 (*trace->reporter)(trace, NULL, &message);
     1059                default:
     1060                        (*trace->reporter)(trace, message.code, message.additional, message.sender);
    10671061                }
    10681062        }
     
    10721066
    10731067        // GOODBYE
    1074         message.code = MESSAGE_PAUSING;
    1075         message.sender = t;
    1076         (*trace->reporter)(trace, NULL, &message);
    1077         message.code = MESSAGE_STOPPING;
    1078         (*trace->reporter)(trace, NULL, &message);
     1068        (*trace->reporter)(trace, MESSAGE_PAUSING, (libtrace_generic_t) {0}, t);
     1069        (*trace->reporter)(trace, MESSAGE_STOPPING, (libtrace_generic_t) {0}, t);
    10791070
    10801071        thread_change_state(trace, &trace->reporter_thread, THREAD_FINISHED, true);
Note: See TracChangeset for help on using the changeset viewer.