X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fdata_structures.h;h=cc422a81261efe105861e68855bd980aca010aa7;hb=0a87ec9a018cc9731ce3b04309eaa4dcc77df6d2;hp=7ed3bfc1879ba7edd9f5941c2e8395d0d7537798;hpb=9c7696b8589e76aed870b15cabd09a162d468621;p=lttv.git diff --git a/lttv/lttv/sync/data_structures.h b/lttv/lttv/sync/data_structures.h index 7ed3bfc1..cc422a81 100644 --- a/lttv/lttv/sync/data_structures.h +++ b/lttv/lttv/sync/data_structures.h @@ -124,12 +124,65 @@ 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. + */ + + SCREWED, + /* The algorithms are screwed. 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; + unsigned int traceNb; + PairFactors** pairFactors; +} AllFactors; + // ConnectionKey-related functions guint ghfConnectionKeyHash(gconstpointer key); @@ -179,4 +232,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); + #endif