Changeset 0ec8a7c for lib/libtrace.h.in


Ignore:
Timestamp:
02/27/15 17:31:03 (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:
98dc1ba
Parents:
7718e54
Message:

Change the user interface from a message and a packet to only messages.

Now a packet is a type of message (MESSAGE_PACKET).
I expanded the message structure into seperate arguments such that these
will be passed in registers on x64 systems. As such performance has
remained identical if not better.

I renamed libtrace_generic_types_t to libtrace_generic_t so it was shorter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r2adc1d0 r0ec8a7c  
    35073507        float rfloat;
    35083508        double rdouble;
    3509 } libtrace_generic_types_t;
     3509} libtrace_generic_t;
     3510ct_assert(sizeof(libtrace_generic_t) == 8);
    35103511
    35113512typedef struct libtrace_message_t {
    35123513        int code;
    3513         libtrace_generic_types_t additional;
     3514        libtrace_generic_t additional;
    35143515        libtrace_thread_t *sender;
    35153516} libtrace_message_t;
     
    35183519typedef struct libtrace_result_t {
    35193520        uint64_t key;
    3520         libtrace_generic_types_t value;
     3521        libtrace_generic_t value;
    35213522        int type;
    35223523} libtrace_result_t;
     
    35253526#define RESULT_TICK   2
    35263527
    3527 
    3528 typedef void* (*fn_per_pkt)(libtrace_t* trace, libtrace_packet_t *p, libtrace_message_t *m, libtrace_thread_t *thread);
     3528/**
     3529 * The definition for the main function that the user supplies to process
     3530 * packets.
     3531 *
     3532 * @param trace The trace the packet is related to.
     3533 * @param thread The thread the trace is related to.
     3534 * @param mesg_code The type of data ready, the most important being MESSAGE_PACKET.
     3535 * In this case data.pkt contains the packet.
     3536 * @param data A generic union of types that fit into 8 bytes, containing
     3537 * information dependent upon the mesg_code.
     3538 * @param sender The thread that the message originated from.
     3539 *
     3540 * The values of data and sender depend upon the mesg_code. Please see the
     3541 * documentation for the message as to what value these will contain.
     3542 */
     3543typedef void* (*fn_per_pkt)(libtrace_t* trace,
     3544                            libtrace_thread_t *thread,
     3545                            int mesg_code,
     3546                            libtrace_generic_t data,
     3547                            libtrace_thread_t *sender);
    35293548typedef void (*fn_reporter)(libtrace_t* trace, libtrace_result_t *r, libtrace_message_t *m);
    35303549typedef uint64_t (*fn_hasher)(const libtrace_packet_t* packet, void *data);
     
    35373556DLLEXPORT void libtrace_result_set_key(libtrace_result_t * result, uint64_t key);
    35383557DLLEXPORT uint64_t libtrace_result_get_key(libtrace_result_t * result);
    3539 DLLEXPORT void libtrace_result_set_value(libtrace_result_t * result, libtrace_generic_types_t value);
    3540 DLLEXPORT libtrace_generic_types_t libtrace_result_get_value(libtrace_result_t * result);
    3541 DLLEXPORT void libtrace_result_set_key_value(libtrace_result_t * result, uint64_t key, libtrace_generic_types_t value);
     3558DLLEXPORT void libtrace_result_set_value(libtrace_result_t * result, libtrace_generic_t value);
     3559DLLEXPORT libtrace_generic_t libtrace_result_get_value(libtrace_result_t * result);
     3560DLLEXPORT void libtrace_result_set_key_value(libtrace_result_t * result, uint64_t key, libtrace_generic_t value);
    35423561DLLEXPORT void trace_destroy_result(libtrace_result_t ** result);
    35433562
     
    35493568
    35503569
    3551 DLLEXPORT void trace_publish_result(libtrace_t *libtrace, libtrace_thread_t *t, uint64_t key, libtrace_generic_types_t value, int type);
     3570DLLEXPORT void trace_publish_result(libtrace_t *libtrace, libtrace_thread_t *t, uint64_t key, libtrace_generic_t value, int type);
    35523571typedef struct libtrace_vector libtrace_vector_t;
    35533572
     
    35993618
    36003619enum libtrace_messages {
     3620        MESSAGE_PACKET,
    36013621        MESSAGE_STARTING,
    36023622        MESSAGE_RESUMING,
     
    36133633        MESSAGE_POST_RANGE,
    36143634        MESSAGE_TICK,
    3615         MESSAGE_USER
     3635        MESSAGE_USER = 1000
    36163636};
    36173637
     
    38543874         * chosen.
    38553875         */
    3856         libtrace_generic_types_t configuration;
     3876        libtrace_generic_t configuration;
    38573877};
    38583878
    3859 DLLEXPORT void trace_set_combiner(libtrace_t *trace, const libtrace_combine_t *combiner, libtrace_generic_types_t config);
     3879DLLEXPORT void trace_set_combiner(libtrace_t *trace, const libtrace_combine_t *combiner, libtrace_generic_t config);
    38603880
    38613881#define READ_EOF 0
Note: See TracChangeset for help on using the changeset viewer.