X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=lttv%2Flttv%2Fsync%2Fdata_structures.h;h=627286cc77ac4656b23dda6f0012bdd5dc4f6041;hb=1111bb0f69e3c01c9264b19cbc7d2a8a02eeb569;hp=7ed3bfc1879ba7edd9f5941c2e8395d0d7537798;hpb=277e5b535febfb81a5e9485b0d008e148b6979ac;p=lttv.git diff --git a/lttv/lttv/sync/data_structures.h b/lttv/lttv/sync/data_structures.h index 7ed3bfc1..627286cc 100644 --- a/lttv/lttv/sync/data_structures.h +++ b/lttv/lttv/sync/data_structures.h @@ -22,6 +22,8 @@ #include #include +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + enum Direction { @@ -124,12 +126,72 @@ typedef struct GQueue* events; } Broadcast; -// One set of factors for each trace, this is the result of synchronization +// Stage 4: These structures contain correction factors +/* Correction factors for each trace, this is the final result of + * synchronization */ typedef struct { double drift, offset; } Factors; +// Correction factors between trace pairs, to be used for reduction +typedef enum +{ + EXACT, + /* Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In + * this case, min, max and accuracy are NULL. + */ + + ACCURATE, + /* The approximation is the middle of the min and max limits. All fields + * are initialized. + */ + + APPROXIMATE, + /* min and max are not available. The approximation is a "best effort". + * min and max are NULL. + */ + + INCOMPLETE, + /* min or max is available but not both. approx and accuracy are not + * NULL. + */ + + ABSENT, + /* The pair of trace did not have communications in both directions (maybe + * even no communication at all). approx and accuracy are NULL. + */ + + FAIL, + /* The algorithms are defective. All fields may be NULL. + */ + + APPROX_NB, // This must be the last member +} ApproxType; + +extern const char* const approxNames[APPROX_NB]; + +typedef struct +{ + Factors* min, * max, * approx; + ApproxType type; + double accuracy; +} PairFactors; + +typedef struct +{ + unsigned int refCount; + PairFactors** pairFactors; +} AllFactors; + + +// This structure is used to return a corrected time value with accuracy +// bounds +typedef struct +{ + uint64_t time, min, max; +} CorrectedTime; + // ConnectionKey-related functions guint ghfConnectionKeyHash(gconstpointer key); @@ -179,4 +241,10 @@ void destroyTCPExchange(Exchange* const exchange); void gdnDestroyBroadcast(gpointer data); void destroyBroadcast(Broadcast* const broadcast); +// Factor-related functions +void destroyPairFactors(PairFactors* factorsCHull); + +AllFactors* createAllFactors(const unsigned int traceNb); +void freeAllFactors(AllFactors* const allFactors, const unsigned int traceNb); + #endif