X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fdata_structures.h;h=627286cc77ac4656b23dda6f0012bdd5dc4f6041;hb=b91d16695a53ce2a6159640b5a3fe5a5ec2cd980;hp=0eab539387637beb7decc554c3fcd1f960160ee7;hpb=66eaf2eba602c331d08677dbb59ec3f9e40f0ccc;p=lttv.git diff --git a/lttv/lttv/sync/data_structures.h b/lttv/lttv/sync/data_structures.h index 0eab5393..627286cc 100644 --- a/lttv/lttv/sync/data_structures.h +++ b/lttv/lttv/sync/data_structures.h @@ -1,19 +1,18 @@ /* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2009 Benjamin Poirier + * Copyright (C) 2009, 2010 Benjamin Poirier * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation; + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or (at + * your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . */ #ifndef DATA_STRUCTURES_H @@ -23,6 +22,8 @@ #include #include +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + enum Direction { @@ -125,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); @@ -180,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