Changeset 29bbef0 for lib/libtrace.h.in


Ignore:
Timestamp:
03/30/14 17:48:26 (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:
f1015ad
Parents:
dad224b
Message:

My work from over summer, with a few things tidied up and updated to include recent commits/patches to bring this up to date. Still very much work in progress.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r74ecbc7 r29bbef0  
    196196typedef struct libtrace_filter_t libtrace_filter_t;
    197197
     198/** Opaque structure holding information about a result */
     199typedef struct libtrace_result_t libtrace_result_t;
     200
     201typedef struct libtrace_message_t libtrace_message_t;
     202
     203typedef struct libtrace_thread_t libtrace_thread_t;
     204
    198205/** If the packet has allocated its own memory the buffer_control should be
    199206 * set to TRACE_CTRL_PACKET, so that the memory will be freed when the packet
     
    481488        uint8_t transport_proto;        /**< Cached transport protocol */
    482489        uint32_t l4_remaining;          /**< Cached transport remaining */
     490        uint64_t order; /**< Notes the order of this packet in relation to the input */
     491        uint64_t hash; /**< A hash of the packet as supplied by the user */
     492        int error; /**< The error status of pread_packet */
    483493} libtrace_packet_t;
    484494
     
    30983108/*@}*/
    30993109
     3110typedef void* (*fn_per_pkt)(libtrace_t* trace, libtrace_packet_t *p, libtrace_message_t *m, libtrace_thread_t *thread);
     3111typedef void* (*fn_reducer)(libtrace_t* trace, void* global_blob);
     3112typedef uint64_t (*fn_hasher)(libtrace_packet_t* packet, void *data);
     3113
     3114DLLEXPORT int trace_pstart(libtrace_t *libtrace, void* global_blob, fn_per_pkt per_pkt, fn_reducer reducer);
     3115DLLEXPORT int trace_pread_packet(libtrace_t *libtrace, libtrace_packet_t **packet);
     3116DLLEXPORT int trace_ppause(libtrace_t *libtrace);
     3117DLLEXPORT int trace_pstop(libtrace_t *libtrace);
     3118DLLEXPORT void trace_join(libtrace_t * trace);
     3119DLLEXPORT inline void print_contention_stats (libtrace_t *libtrace);
     3120DLLEXPORT libtrace_result_t *trace_create_result();
     3121
     3122typedef struct libtrace_result_t {
     3123        uint64_t key;
     3124        void * value;
     3125} libtrace_result_t;
     3126
     3127DLLEXPORT inline void libtrace_result_set_key(libtrace_result_t * result, uint64_t key);
     3128DLLEXPORT inline uint64_t libtrace_result_get_key(libtrace_result_t * result);
     3129DLLEXPORT inline void libtrace_result_set_value(libtrace_result_t * result, void * value);
     3130DLLEXPORT inline void* libtrace_result_get_value(libtrace_result_t * result);
     3131DLLEXPORT inline void libtrace_result_set_key_value(libtrace_result_t * result, uint64_t key, void * value);
     3132DLLEXPORT void trace_destroy_result(libtrace_result_t ** result);
     3133
     3134// Ways to access Global and TLS  storage that we provide the user
     3135DLLEXPORT void * trace_get_global(libtrace_t *trace);
     3136DLLEXPORT void * trace_set_global(libtrace_t *trace, void * data);
     3137DLLEXPORT void * trace_set_tls(libtrace_thread_t *t, void * data);
     3138DLLEXPORT void * trace_get_tls(libtrace_thread_t *t);
     3139
     3140DLLEXPORT void trace_publish_result(libtrace_t *libtrace, uint64_t key, void * value);
     3141typedef struct libtrace_vector libtrace_vector_t;
     3142DLLEXPORT int trace_get_results(libtrace_t *libtrace, libtrace_vector_t * results);
     3143
     3144DLLEXPORT libtrace_result_t *trace_create_result();
     3145DLLEXPORT int libtrace_thread_get_message_count(libtrace_t * libtrace);
     3146DLLEXPORT int libtrace_thread_get_message(libtrace_t * libtrace, libtrace_message_t * message);
     3147DLLEXPORT int libtrace_thread_try_get_message(libtrace_t * libtrace, libtrace_message_t * message);
     3148DLLEXPORT int trace_send_message_to_reducer(libtrace_t * libtrace, libtrace_message_t * message);
     3149DLLEXPORT int trace_finished(libtrace_t * libtrace);
     3150DLLEXPORT uint64_t trace_packet_get_order(libtrace_packet_t * packet);
     3151DLLEXPORT uint64_t trace_packet_get_hash(libtrace_packet_t * packet);
     3152DLLEXPORT void trace_packet_set_order(libtrace_packet_t * packet, uint64_t order);
     3153DLLEXPORT void trace_packet_set_hash(libtrace_packet_t * packet, uint64_t hash);
     3154
     3155
     3156typedef enum {
     3157        /**
     3158         * Sets the hasher function, if NULL(default) no hashing is used a
     3159         * cores will get packets on a first in first served basis
     3160         */
     3161        TRACE_OPTION_SET_HASHER,
     3162       
     3163        /**
     3164         * See diagrams, this sets the maximum size of freelist used to
     3165         * maintain packets and there memory buffers.
     3166         * NOTE setting this to less than recommend could cause deadlock a
     3167         * trace that manages its own packets.
     3168         * A unblockable error message will be printed.
     3169         */
     3170        TRACE_OPTION_SET_PACKET_FREELIST_SIZE,
     3171       
     3172        /**
     3173         * See diagrams, this sets the maximum size of buffers used between
     3174         * the single hasher thread and the buffer.
     3175         * NOTE setting this to less than recommend could cause deadlock a
     3176         * trace that manages its own packets.
     3177         * A unblockable warning message will be printed to stderr in this case.
     3178         */
     3179        TRACE_OPTION_SET_MAPPER_BUFFER_SIZE,
     3180       
     3181        /**
     3182         * Libtrace set mapper thread count
     3183         */
     3184        TRACE_OPTION_SET_MAPPER_THREAD_COUNT,
     3185       
     3186        /**
     3187         * Libtrace should expect sequential keys from the output to count
     3188         * up starting numbered from 1, 2, 3 ...
     3189         * such as is the case with numbered packets.
     3190         *
     3191         * ALSO consider - TRACE_OPTIONS_ORDERED_RESULTS suitable for live formats
     3192         */
     3193         TRACE_OPTION_SEQUENTIAL,
     3194         
     3195         /**
     3196          * Libtrace ordered results, results in each queue are ordered by key
     3197          * however my not be sequential, a typically case is packet timestamps
     3198          * the reducer will receive packets in order - note threasholds
     3199          * will be used such that a empty queue wont break things
     3200          */
     3201         TRACE_OPTION_ORDERED,
     3202         
     3203         
     3204         /**
     3205          * When accepting ordered results if a threashold is meet before an
     3206          * older result is available from another queue drop that packet
     3207          */
     3208          TRACE_DROP_OUT_OF_ORDER,
     3209         
     3210          /**
     3211           * If set to true (i.e. 1) the trace starts a dedicated hasher thread
     3212           */
     3213          TRACE_OPTION_USE_DEDICATED_HASHER,
     3214          TRACE_OPTION_USE_SLIDING_WINDOW_BUFFER,
     3215          TRACE_OPTION_TRACETIME
     3216} trace_parallel_option_t;
     3217
     3218DLLEXPORT int trace_parallel_config(libtrace_t *libtrace, trace_parallel_option_t option, void *value);
     3219DLLEXPORT libtrace_packet_t* trace_result_packet(libtrace_t * libtrace, libtrace_packet_t * packet);
     3220DLLEXPORT void trace_free_result_packet(libtrace_t * libtrace, libtrace_packet_t * packet);
     3221
    31003222#ifdef __cplusplus
    31013223} /* extern "C" */
Note: See TracChangeset for help on using the changeset viewer.