Changeset 6a6e6a8 for tools


Ignore:
Timestamp:
03/12/15 17:14:42 (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:
a978dec
Parents:
b54e2da
Message:

More documentation, including some renaming and modifications to behaviour

  • Removes accessor functions for libtrace_result_t, instead directly access the structure
  • Documentation for most functions
  • Split tick into interval and count messages for the two modes of operation
  • Normalise interval and packet order to use the erf timestamp format
  • Rename trace_send_message_to_XXX to trace trace_message_XXX
Location:
tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/traceanon/traceanon_parallel.c

    r6a082f8 r6a6e6a8  
    161161        libtrace_udp_t *udp = NULL;
    162162        libtrace_tcp_t *tcp = NULL;
    163 
     163        libtrace_stat_t *stats = NULL;
    164164        switch (mesg) {
    165165        case MESSAGE_PACKET:
     
    199199                enc_init(enc_type,key);
    200200                break;
    201         case MESSAGE_TICK:
    202                 trace_publish_result(trace, t, data.uint64, (libtrace_generic_t){0}, RESULT_TICK);
     201        case MESSAGE_TICK_INTERVAL:
     202                trace_publish_result(trace, t, data.uint64, (libtrace_generic_t){0}, RESULT_TICK_INTERVAL);
     203                break;
     204        case MESSAGE_TICK_COUNT:
     205                trace_publish_result(trace, t, data.uint64, (libtrace_generic_t){0}, RESULT_TICK_COUNT);
     206                break;
     207        case MESSAGE_STOPPING:
     208                stats = trace_create_statistics();
     209                trace_get_thread_statistics(trace, t, stats);
     210                trace_print_statistics(stats, stderr, NULL);
     211                free(stats);
     212                stats = trace_get_statistics(trace, NULL);
     213                trace_print_statistics(stats, stderr, NULL);
     214                //fprintf(stderr, "tracestats_parallel:\t Stopping thread - publishing results\n");
    203215                break;
    204216        }
     
    216228        case MESSAGE_RESULT:
    217229                if (data.res->type == RESULT_PACKET) {
    218                         libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(data.res).pkt;
    219                         assert(libtrace_result_get_key(data.res) == packet_count++);
     230                        libtrace_packet_t *packet = (libtrace_packet_t*) data.res->value.pkt;
     231                        assert(data.res->key >= packet_count);
     232                        packet_count = data.res->key;
    220233                        if (trace_write_packet(writer,packet)==-1) {
    221234                                trace_perror_output(writer,"writer");
    222235                                trace_interrupt();
    223236                        }
    224                         trace_free_result_packet(trace, packet);
     237                        trace_free_packet(trace, packet);
    225238
    226239                } else {
    227                         assert(data.res->type == RESULT_TICK);
     240                        assert(data.res->type == RESULT_TICK_COUNT || data.res->type == RESULT_TICK_INTERVAL);
    228241                        // Ignore it
    229242                }
  • tools/tracertstats/tracertstats_parallel.c

    r6a082f8 r6a6e6a8  
    147147        switch (mesg) {
    148148                case MESSAGE_RESULT:
    149                 ts = libtrace_result_get_key(data.res);
    150                 res = libtrace_result_get_value(data.res).ptr;
     149                ts = data.res->key;
     150                res = data.res->value.ptr;
    151151                if (last_ts == 0)
    152152                        last_ts = ts;
     
    195195                        // Publish and make a new one new
    196196                        //fprintf(stderr, "Publishing result %"PRIu64"\n", last_ts);
    197                         trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_NORMAL);
     197                        trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_USER);
    198198                        trace_post_reporter(trace);
    199199                        results = calloc(1, sizeof(result_t) + sizeof(statistic_t) * filter_count);
     
    225225                if (results->total.count) {
    226226                        libtrace_generic_t tmp = {.ptr = results};
    227                         trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_NORMAL);
     227                        trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_USER);
    228228                        trace_post_reporter(trace);
    229229                        results = NULL;
     
    231231                break;
    232232
    233                 case MESSAGE_TICK:
     233        case MESSAGE_TICK_INTERVAL:
     234        case MESSAGE_TICK_COUNT:
    234235                {
    235236                        int64_t offset;
    236237                        struct timeval *tv, tv_real;
    237238                        libtrace_packet_t *first_packet = NULL;
    238                         retrive_first_packet(trace, &first_packet, &tv);
     239                        trace_get_first_packet(trace, NULL, &first_packet, &tv);
    239240                        if (first_packet != NULL) {
    240241                                // So figure out our running offset
     
    247248                                        libtrace_generic_t tmp = {.ptr = results};
    248249                                        //fprintf(stderr, "Got a tick and publishing early!!\n");
    249                                         trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_NORMAL);
     250                                        trace_publish_result(trace, t, (uint64_t) last_ts, tmp, RESULT_USER);
    250251                                        trace_post_reporter(trace);
    251252                                        results = calloc(1, sizeof(result_t) + sizeof(statistic_t) * filter_count);
  • tools/tracestats/tracestats_parallel.c

    r6a082f8 r6a6e6a8  
    139139                trace_print_statistics(stats, stderr, NULL);
    140140                free(stats);
    141                 trace_publish_result(trace, t, 0, (libtrace_generic_t){.ptr = results}, RESULT_NORMAL); // Only ever using a single key 0
     141                trace_publish_result(trace, t, 0, (libtrace_generic_t){.ptr = results}, RESULT_USER); // Only ever using a single key 0
    142142                //fprintf(stderr, "tracestats_parallel:\t Stopping thread - publishing results\n");
    143143                break;
     
    168168        case MESSAGE_RESULT:
    169169                /* Get the results from each core and sum 'em up */
    170                 assert(libtrace_result_get_key(data.res) == 0);
    171                 statistics_t * res = libtrace_result_get_value(data.res).ptr;
     170                assert(data.res->key == 0);
     171                statistics_t * res = data.res->value.ptr;
    172172                count += res[0].count;
    173173                bytes += res[0].bytes;
Note: See TracChangeset for help on using the changeset viewer.