Changeset d994324 for tools


Ignore:
Timestamp:
09/17/14 13:45:29 (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:
9e429e8
Parents:
2498008
Message:

Remove anything to do with the combiner from set configuration and removes any options/storage related to these such as the next expected packet.

Instead this is done using trace_set_combiner now, and the for the built-in combiners.h header. This is a lot more flexible and allows the users to specify there own combiner, and any number of options for it.

Location:
tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/traceanon/traceanon_parallel.c

    r2498008 rd994324  
    11#define _GNU_SOURCE
    22#include "libtrace.h"
     3#include "data-struct/vector.h"
     4#include "data-struct/message_queue.h"
     5#include "combiners.h"
    36#include <stdio.h>
    47#include <unistd.h>
     
    1114#include <assert.h>
    1215#include "ipenc.h"
    13 #include <data-struct/vector.h>
    14 #include <data-struct/message_queue.h>
    1516#include <signal.h>
    1617
     
    155156static void* per_packet(libtrace_t *trace, libtrace_packet_t *pkt, libtrace_message_t *mesg, UNUSED libtrace_thread_t *t)
    156157{
    157        
    158158        if (pkt) {
    159159                struct libtrace_ip *ipptr;
     
    190190                //libtrace_packet_t * packet_copy = trace_result_packet(trace, pkt);
    191191                //trace_publish_result(trace, trace_packet_get_order(pkt), pkt);
    192                 trace_publish_result(trace, t, trace_packet_get_order(pkt), pkt, RESULT_PACKET);
     192
     193                trace_publish_result(trace, t, trace_packet_get_order(pkt), (libtrace_generic_types_t){.pkt=pkt}, RESULT_PACKET);
    193194                //return ;
    194195        }
     
    200201                        break;
    201202                        case MESSAGE_TICK:
    202                                 trace_publish_result(trace, t, mesg->additional.uint64, NULL, RESULT_TICK);
     203                                trace_publish_result(trace, t, mesg->additional.uint64, (libtrace_generic_types_t){.pkt=NULL}, RESULT_TICK);
    203204                }
    204205        }
     
    213214        if (result) {
    214215                if (result->type == RESULT_PACKET) {
    215                         libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(result);
     216                        libtrace_packet_t *packet = (libtrace_packet_t*) libtrace_result_get_value(result).pkt;
    216217                        assert(libtrace_result_get_key(result) == packet_count++);
    217218                        if (trace_write_packet(writer,packet)==-1) {
     
    422423         
    423424        int i = 1;
    424         trace_parallel_config(trace, TRACE_OPTION_ORDERED, &i);
     425        trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_types_t){0});
    425426        trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc);
     427
    426428        //trace_set_hasher(trace, HASHER_CUSTOM, rand_hash, NULL);
    427429       
  • tools/tracertstats/tracertstats_parallel.c

    r2498008 rd994324  
    5959#include "data-struct/vector.h"
    6060#include "data-struct/message_queue.h"
     61#include "combiners.h"
    6162
    6263#ifndef UINT32_MAX
     
    144145                result_t *res;
    145146                ts = libtrace_result_get_key(result);
    146                 res = libtrace_result_get_value(result);
     147                res = libtrace_result_get_value(result).ptr;
    147148                if (last_ts == 0)
    148149                        last_ts = ts;
     
    177178        static __thread uint64_t last_ts = 0, ts = 0;
    178179        static __thread result_t * results = NULL;
    179        
    180180        // Unsure when we would hit this case but the old code had it, I
    181181        // guess we should keep it
     
    189189                        // Publish and make a new one new
    190190                        //fprintf(stderr, "Publishing result %"PRIu64"\n", last_ts);
    191                         trace_publish_result(trace, t, (uint64_t) last_ts, results, RESULT_NORMAL);
     191                        trace_publish_result(trace, t, (uint64_t) last_ts, (libtrace_generic_types_t){.ptr = results}, RESULT_NORMAL);
    192192                        trace_post_reporter(trace);
    193193                        results = calloc(1, sizeof(result_t) + sizeof(statistic_t) * filter_count);
     
    220220                                // Should we always post this?
    221221                                if (results->total.count) {
    222                                         trace_publish_result(trace, t, (uint64_t) last_ts, results, RESULT_NORMAL);
     222                                        trace_publish_result(trace, t, (uint64_t) last_ts, (libtrace_generic_types_t){.ptr = results}, RESULT_NORMAL);
    223223                                        trace_post_reporter(trace);
    224224                                        results = NULL;
     
    240240                                        if (next_update_time <= mesg->additional.uint64) {
    241241                                                //fprintf(stderr, "Got a tick and publishing early!!\n");
    242                                                 trace_publish_result(trace, t, (uint64_t) last_ts, results, RESULT_NORMAL);
     242                                                trace_publish_result(trace, t, (uint64_t) last_ts, (libtrace_generic_types_t){.ptr = NULL}, RESULT_NORMAL);
    243243                                                trace_post_reporter(trace);
    244244                                                results = calloc(1, sizeof(result_t) + sizeof(statistic_t) * filter_count);
     
    288288        }*/
    289289        int i = 1;
    290         trace_parallel_config(trace, TRACE_OPTION_ORDERED, &i);
     290        trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_types_t){0});
    291291        /* trace_parallel_config(trace, TRACE_OPTION_TRACETIME, &i); */
    292292        //trace_set_hasher(trace, HASHER_CUSTOM, &bad_hash, NULL);
  • tools/tracestats/tracestats_parallel.c

    r2498008 rd994324  
    5757#include "data-struct/vector.h"
    5858#include "data-struct/message_queue.h"
     59#include "combiners.h"
    5960#include <pthread.h>
    6061
     
    130131                switch (mesg->code) {
    131132                        case MESSAGE_STOPPING:
    132                                 trace_publish_result(trace, t, 0, results, RESULT_NORMAL); // Only ever using a single key 0
     133                                trace_publish_result(trace, t, 0, (libtrace_generic_types_t){.ptr = results}, RESULT_NORMAL); // Only ever using a single key 0
    133134                                fprintf(stderr, "Thread published resuslts WOWW\n");
    134135                                break;
     
    158159                /* Get the results from each core and sum 'em up */
    159160                assert(libtrace_result_get_key(result) == 0);
    160                 statistics_t * res = libtrace_result_get_value(result);
     161                statistics_t * res = libtrace_result_get_value(result).ptr;
    161162                count += res[0].count;
    162163                bytes += res[0].bytes;
     
    223224        //option = 10000;
    224225    //trace_set_hasher(trace, HASHER_CUSTOM, &rand_hash, NULL);
    225         option = 2;
    226226        //trace_parallel_config(trace, TRACE_OPTION_SET_PERPKT_THREAD_COUNT, &option);
    227227        trace_parallel_config(trace, TRACE_OPTION_SET_CONFIG, &uc);
    228         trace_parallel_config(trace, TRACE_OPTION_ORDERED, &uc);
     228        trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_types_t){0});
    229229
    230230        //trace_parallel_config(trace, TRACE_OPTION_SET_MAPPER_BUFFER_SIZE, &option);
Note: See TracChangeset for help on using the changeset viewer.