Changeset f051c1b for lib/libtrace.h.in


Ignore:
Timestamp:
08/12/14 14:14:50 (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:
0862c20
Parents:
f9a70ca
Message:

Tidies up the state messages received, now all states are passed through created->resumed->paused->stopped this might simplify some code. Removed the extra paused state.
Hooks up the reporter method through trace_pstart, hopefully resulting in simpler code most of the time. Also renames this from reducer to reporter anywhere it was not already. Adds a test for this also.
Removes is_packet from a result in favour of a more generic type, with packet being one of these.
Moves configuration for tuning relelated settings into a single structure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    ra49a9eb rf051c1b  
    244244        uint64_t key;
    245245        void * value;
    246         int is_packet;
     246        int type;
    247247} libtrace_result_t;
     248#define RESULT_NORMAL 0
     249#define RESULT_PACKET 1
     250#define RESULT_TICK   2
    248251
    249252typedef struct libtrace_thread_t libtrace_thread_t;
     
    31963199
    31973200typedef void* (*fn_per_pkt)(libtrace_t* trace, libtrace_packet_t *p, libtrace_message_t *m, libtrace_thread_t *thread);
    3198 typedef void* (*fn_reducer)(libtrace_t* trace, void* global_blob);
     3201typedef void* (*fn_reporter)(libtrace_t* trace, libtrace_result_t *r, libtrace_message_t *m);
    31993202typedef uint64_t (*fn_hasher)(const libtrace_packet_t* packet, void *data);
    32003203
    3201 DLLEXPORT int trace_pstart(libtrace_t *libtrace, void* global_blob, fn_per_pkt per_pkt, fn_reducer reducer);
     3204DLLEXPORT int trace_pstart(libtrace_t *libtrace, void* global_blob, fn_per_pkt per_pkt, fn_reporter reporter);
    32023205DLLEXPORT int trace_ppause(libtrace_t *libtrace);
    32033206DLLEXPORT int trace_pstop(libtrace_t *libtrace);
     
    32193222
    32203223
    3221 DLLEXPORT void trace_publish_result(libtrace_t *libtrace, uint64_t key, void * value);
    3222 DLLEXPORT void trace_publish_packet(libtrace_t *libtrace, libtrace_packet_t *packet);
     3224DLLEXPORT void trace_publish_result(libtrace_t *libtrace, libtrace_thread_t *t, uint64_t key, void * value, int type);
    32233225typedef struct libtrace_vector libtrace_vector_t;
    32243226DLLEXPORT int trace_get_results(libtrace_t *libtrace, libtrace_vector_t * results);
    32253227
    3226 DLLEXPORT int trace_post_reduce(libtrace_t *libtrace);
     3228DLLEXPORT int trace_post_reporter(libtrace_t *libtrace);
    32273229DLLEXPORT int libtrace_thread_get_message_count(libtrace_t * libtrace);
    32283230DLLEXPORT int libtrace_thread_get_message(libtrace_t * libtrace, libtrace_message_t * message);
    32293231DLLEXPORT int libtrace_thread_try_get_message(libtrace_t * libtrace, libtrace_message_t * message);
    3230 DLLEXPORT int trace_send_message_to_reducer(libtrace_t * libtrace, libtrace_message_t * message);
     3232DLLEXPORT int trace_send_message_to_reporter(libtrace_t * libtrace, libtrace_message_t * message);
    32313233DLLEXPORT int trace_send_message_to_perpkts(libtrace_t * libtrace, libtrace_message_t * message);
    32323234DLLEXPORT int trace_send_message_to_thread(libtrace_t * libtrace, libtrace_thread_t *t, libtrace_message_t * message);
     
    32463248         */
    32473249        TRACE_OPTION_SET_HASHER,
    3248        
    3249         /**
    3250          * See diagrams, this sets the maximum size of freelist used to
    3251          * maintain packets and there memory buffers.
    3252          * NOTE setting this to less than recommend could cause deadlock a
    3253          * trace that manages its own packets.
    3254          * A unblockable error message will be printed.
    3255          */
    3256         TRACE_OPTION_SET_PACKET_FREELIST_SIZE,
    3257        
    3258         /**
    3259          * See diagrams, this sets the maximum size of buffers used between
    3260          * the single hasher thread and the buffer.
    3261          * NOTE setting this to less than recommend could cause deadlock a
    3262          * trace that manages its own packets.
    3263          * A unblockable warning message will be printed to stderr in this case.
    3264          */
    3265         TRACE_OPTION_SET_PERPKT_BUFFER_SIZE,
    32663250       
    32673251        /**
     
    32823266          * Libtrace ordered results, results in each queue are ordered by key
    32833267          * however my not be sequential, a typically case is packet timestamps
    3284           * the reducer will receive packets in order - note threasholds
     3268          * the reporter will receive packets in order - note threasholds
    32853269          * will be used such that a empty queue wont break things
    32863270          */
     
    33083292
    33093293enum libtrace_messages {
    3310         MESSAGE_STARTED,
     3294        MESSAGE_STARTING,
     3295        MESSAGE_RESUMING,
     3296        MESSAGE_STOPPING,
     3297        MESSAGE_PAUSING,
    33113298        MESSAGE_DO_PAUSE,
    3312         MESSAGE_PAUSING,
    3313         MESSAGE_PAUSED,
    33143299        MESSAGE_DO_STOP,
    3315         MESSAGE_STOPPED,
    33163300        MESSAGE_FIRST_PACKET,
    33173301        MESSAGE_PERPKT_ENDED,
     
    33193303        MESSAGE_PERPKT_PAUSED,
    33203304        MESSAGE_PERPKT_EOF,
    3321         MESSAGE_POST_REDUCE,
     3305        MESSAGE_POST_REPORTER,
    33223306        MESSAGE_POST_RANGE,
    33233307        MESSAGE_TICK,
     
    33863370DLLEXPORT libtrace_info_t *trace_get_information(libtrace_t * libtrace);
    33873371
     3372/**
     3373 * Tuning the parallel sizes
     3374 */
     3375struct user_configuration {
     3376        // Packet memory cache settings (ocache_init) total
     3377        /**
     3378         * See diagrams, this sets the maximum size of freelist used to
     3379         * maintain packets and their memory buffers.
     3380         * NOTE setting this to less than recommend could cause deadlock a
     3381         * trace that manages its own packets.
     3382         * A unblockable error message will be printed.
     3383         */
     3384        size_t packet_global_cache_size;
     3385        // Per thread
     3386        size_t packet_thread_cache_size;
     3387        // Packet count limited
     3388        bool fixed_packet_count;
     3389        // Bursts/Batches of packets this size are combined, used in single thread mode
     3390        size_t burst_size;
     3391        // Each perpkt thread has a queue leading into the reporter
     3392        //size_t reporter_queue_size;
     3393        /** The tick interval - in milliseconds (0) */
     3394        size_t tick_interval;
     3395        // The tick interval for file based traces, in number of packets TODO implement this
     3396        size_t tick_count;
     3397
     3398        // The number of per packet threads requested
     3399        size_t perpkt_threads;
     3400
     3401        /**
     3402         * See diagrams, this sets the maximum size of buffers used between
     3403         * the single hasher thread and the buffer.
     3404         * NOTE setting this to less than recommend could cause deadlock a
     3405         * trace that manages its own packets.
     3406         * A unblockable warning message will be printed to stderr in this case.
     3407         */
     3408        /** The number of packets that can queue per thread from hasher thread */
     3409        size_t hasher_queue_size;
     3410
     3411        // Reporter threashold before results are sent
     3412        size_t reporter_thold;
     3413};
     3414
     3415#define ZERO_USER_CONFIG(config) memset(&config, 0, sizeof(struct user_configuration));
     3416
    33883417#ifdef __cplusplus
    33893418} /* extern "C" */
Note: See TracChangeset for help on using the changeset viewer.