Allows easier composition of many functions on a single graph.
Signed-off-by: Benjamin Poirier <benjamin.poirier@polymtl.ca>
.finalizeAnalysis= &finalizeAnalysisCHull,
.printAnalysisStats= &printAnalysisStatsCHull,
.graphFunctions= {
- .writeTraceTracePlots= &writeAnalysisGraphsPlotsCHull,
+ .writeTraceTraceForePlots= &writeAnalysisGraphsPlotsCHull,
}
};
[SCREWED]= "Screwed",
};
+
/*
* Analysis module registering function
*/
static void printAnalysisStatsEval(SyncState* const syncState);
static void writeAnalysisTraceTimePlotsEval(SyncState* const syncState, const
unsigned int i, const unsigned int j);
-static void writeAnalysisTraceTracePlotsEval(SyncState* const syncState, const
- unsigned int i, const unsigned int j);
+static void writeAnalysisTraceTraceBackPlotsEval(SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
+static void writeAnalysisTraceTraceForePlotsEval(SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerAnalysisEval() __attribute__((constructor (102)));
static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey,
double* minRtt, AnalysisHistogramEval* const histogram);
-static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2);
+static void updateBounds(Bounds** const bounds, Event* const e1, Event* const
+ e2);
// The next group of functions is only needed when computing synchronization
// accuracy.
#ifdef HAVE_LIBGLPK
-static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const upperHull);
+static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const
+ upperHull);
static void gfLPAddRow(gpointer data, gpointer user_data);
static Factors* calculateFactors(glp_prob* const lp, const int direction);
-static void calculateCompleteFactors(glp_prob* const lp, FactorsCHull* factors);
+static void calculateCompleteFactors(glp_prob* const lp, FactorsCHull*
+ factors);
static FactorsCHull** createAllFactors(const unsigned int traceNb);
static inline void finalizeAnalysisEvalLP(SyncState* const syncState);
#else
.finalizeAnalysis= &finalizeAnalysisEval,
.printAnalysisStats= &printAnalysisStatsEval,
.graphFunctions= {
- .writeTraceTimePlots= &writeAnalysisTraceTimePlotsEval,
- .writeTraceTracePlots= &writeAnalysisTraceTracePlotsEval,
+ .writeTraceTimeBackPlots= &writeAnalysisTraceTimePlotsEval,
+ .writeTraceTraceBackPlots= &writeAnalysisTraceTraceBackPlotsEval,
+ .writeTraceTraceForePlots= &writeAnalysisTraceTraceForePlotsEval,
}
};
* bounds: the array containing all the trace-pair bounds
* e1, e2: the two related events
*/
-static void updateBounds(Bounds** const bounds, Event* const e1, Event* const e2)
+static void updateBounds(Bounds** const bounds, Event* const e1, Event* const
+ e2)
{
unsigned int traceI, traceJ;
uint64_t messageTime;
* A new glp_prob*, this problem must be freed by the caller with
* glp_delete_prob()
*/
-static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const upperHull)
+static glp_prob* lpCreateProblem(GQueue* const lowerHull, GQueue* const
+ upperHull)
{
unsigned int it;
const int zero= 0;
* j: second trace number, garanteed to be larger than i
*/
#ifndef HAVE_LIBGLPK
-static inline void writeAccuracyGraphs(SyncState* const syncState, const unsigned int
- i, const unsigned int j)
+static inline void writeAccuracyGraphs(SyncState* const syncState, const
+ unsigned int i, const unsigned int j)
{
}
#else
}
-static void writeAnalysisTraceTracePlotsEval(SyncState* const syncState, const
- unsigned int i, const unsigned int j)
+/*
+ * Write the analysis-specific graph lines in the gnuplot script.
+ *
+ * Args:
+ * syncState: container for synchronization data
+ * i: first trace number
+ * j: second trace number, garanteed to be larger than i
+ */
+static void writeAnalysisTraceTraceBackPlotsEval(SyncState* const syncState,
+ const unsigned int i, const unsigned int j)
{
- AnalysisDataEval* analysisData= syncState->analysisData;
-
#ifdef HAVE_LIBGLPK
fprintf(syncState->graphsStream,
"\t\"analysis_eval_accuracy-%1$03u_and_%2$03u.data\" "
"with filledcurves linewidth 2 linetype 1 "
"linecolor rgb \"black\" fill solid 0.25 noborder, \\\n", i, j);
#endif
+}
+
+
+/*
+ * Write the analysis-specific graph lines in the gnuplot script.
+ *
+ * Args:
+ * syncState: container for synchronization data
+ * i: first trace number
+ * j: second trace number, garanteed to be larger than i
+ */
+static void writeAnalysisTraceTraceForePlotsEval(SyncState* const syncState,
+ const unsigned int i, const unsigned int j)
+{
+ AnalysisDataEval* analysisData= syncState->analysisData;
- analysisData->chullSS->analysisModule->graphFunctions.writeTraceTracePlots(analysisData->chullSS,
+ analysisData->chullSS->analysisModule->graphFunctions.writeTraceTraceForePlots(analysisData->chullSS,
i, j);
}
.finalizeAnalysis= &finalizeAnalysisLinReg,
.printAnalysisStats= &printAnalysisStatsLinReg,
.graphFunctions= {
- .writeTraceTracePlots= &writeAnalysisGraphsPlotsLinReg,
+ .writeTraceTraceForePlots= &writeAnalysisGraphsPlotsLinReg,
}
};
.finalizeMatching= &finalizeMatchingBroadcast,
.printMatchingStats= &printMatchingStatsBroadcast,
.graphFunctions= {
- .writeTraceTimePlots= &writeMatchingGraphsPlotsBroadcast,
+ .writeTraceTimeForePlots= &writeMatchingGraphsPlotsBroadcast,
}
};
event);
static GArray* finalizeMatchingDistributor(SyncState* const syncState);
static void printMatchingStatsDistributor(SyncState* const syncState);
-static void writeMatchingTraceTracePlotsDistributor(SyncState* const
+static void writeMatchingTraceTraceForePlotsDistributor(SyncState* const
+ syncState, const unsigned int i, const unsigned int j);
+static void writeMatchingTraceTraceBackPlotsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j);
static void writeMatchingTraceTraceOptionsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j);
-static void writeMatchingTraceTimePlotsDistributor(SyncState* const
+static void writeMatchingTraceTimeForePlotsDistributor(SyncState* const
+ syncState, const unsigned int i, const unsigned int j);
+static void writeMatchingTraceTimeBackPlotsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j);
static void writeMatchingTraceTimeOptionsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j);
.finalizeMatching= &finalizeMatchingDistributor,
.printMatchingStats= &printMatchingStatsDistributor,
.graphFunctions= {
- .writeTraceTracePlots= &writeMatchingTraceTracePlotsDistributor,
+ .writeTraceTraceForePlots=
+ &writeMatchingTraceTraceForePlotsDistributor,
+ .writeTraceTraceBackPlots=
+ &writeMatchingTraceTraceBackPlotsDistributor,
.writeTraceTraceOptions= &writeMatchingTraceTraceOptionsDistributor,
- .writeTraceTimePlots= &writeMatchingTraceTimePlotsDistributor,
+ .writeTraceTimeForePlots= &writeMatchingTraceTimeForePlotsDistributor,
+ .writeTraceTimeBackPlots= &writeMatchingTraceTimeBackPlotsDistributor,
.writeTraceTimeOptions= &writeMatchingTraceTimeOptionsDistributor,
},
};
* i: first trace number
* j: second trace number, garanteed to be larger than i
*/
-static void writeMatchingTraceTracePlotsDistributor(SyncState* const
+static void writeMatchingTraceTraceForePlotsDistributor(SyncState* const
+ syncState, const unsigned int i, const unsigned int j)
+{
+ MatchingDataDistributor* matchingData= syncState->matchingData;
+
+ g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
+ &(struct GraphAggregate) {offsetof(MatchingModule,
+ graphFunctions.writeTraceTraceForePlots), i, j});
+}
+
+
+/*
+ * Call the distributed graph lines functions (when they exist).
+ *
+ * Args:
+ * syncState: container for synchronization data
+ * i: first trace number
+ * j: second trace number, garanteed to be larger than i
+ */
+static void writeMatchingTraceTraceBackPlotsDistributor(SyncState* const
+ syncState, const unsigned int i, const unsigned int j)
+{
+ MatchingDataDistributor* matchingData= syncState->matchingData;
+
+ g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
+ &(struct GraphAggregate) {offsetof(MatchingModule,
+ graphFunctions.writeTraceTraceBackPlots), i, j});
+}
+
+
+/*
+ * Call the distributed graph lines functions (when they exist).
+ *
+ * Args:
+ * syncState: container for synchronization data
+ * i: first trace number
+ * j: second trace number, garanteed to be larger than i
+ */
+static void writeMatchingTraceTimeForePlotsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j)
{
MatchingDataDistributor* matchingData= syncState->matchingData;
g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
&(struct GraphAggregate) {offsetof(MatchingModule,
- graphFunctions.writeTraceTracePlots), i, j});
+ graphFunctions.writeTraceTimeForePlots), i, j});
}
* i: first trace number
* j: second trace number, garanteed to be larger than i
*/
-static void writeMatchingTraceTimePlotsDistributor(SyncState* const
+static void writeMatchingTraceTimeBackPlotsDistributor(SyncState* const
syncState, const unsigned int i, const unsigned int j)
{
MatchingDataDistributor* matchingData= syncState->matchingData;
g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
&(struct GraphAggregate) {offsetof(MatchingModule,
- graphFunctions.writeTraceTimePlots), i, j});
+ graphFunctions.writeTraceTimeBackPlots), i, j});
}
static void matchEventTCP(SyncState* const syncState, Event* const event);
static GArray* finalizeMatchingTCP(SyncState* const syncState);
static void printMatchingStatsTCP(SyncState* const syncState);
-static void writeMatchingGraphsPlotsTCP(SyncState* const syncState, const
- unsigned int i, const unsigned int j);
+static void writeMatchingGraphsPlotsTCPMessages(SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerMatchingTCP() __attribute__((constructor (101)));
.finalizeMatching= &finalizeMatchingTCP,
.printMatchingStats= &printMatchingStatsTCP,
.graphFunctions= {
- .writeTraceTracePlots= &writeMatchingGraphsPlotsTCP,
+ .writeTraceTraceForePlots= &writeMatchingGraphsPlotsTCPMessages,
}
};
* i: first trace number
* j: second trace number, garanteed to be larger than i
*/
-static void writeMatchingGraphsPlotsTCP(SyncState* const syncState, const
- unsigned int i, const unsigned int j)
+static void writeMatchingGraphsPlotsTCPMessages(SyncState* const syncState,
+ const unsigned int i, const unsigned int j)
{
fprintf(syncState->graphsStream,
"\t\"matching_tcp-%1$03d_to_%2$03d.data\" "
void writeGraphsScript(SyncState* const syncState)
{
- unsigned int i, j, k, l;
+ unsigned int i, j, k, l, m;
long pos1, pos2;
const GraphFunctions* moduleGraphFunctions[]= {
&syncState->processingModule->graphFunctions,
&syncState->analysisModule->graphFunctions,
};
const struct {
- size_t plotsOffset,
- optionsOffset;
char* name;
- } funcTypes[]= {
- {offsetof(GraphFunctions, writeTraceTracePlots),
- offsetof(GraphFunctions, writeTraceTraceOptions), "TraceTrace"},
- {offsetof(GraphFunctions, writeTraceTimePlots),
- offsetof(GraphFunctions, writeTraceTimeOptions), "TraceTime"},
+ size_t plotsOffsets[2];
+ size_t optionsOffset;
+ } graphTypes[]= {
+ {
+ "TraceTrace",
+ {
+ offsetof(GraphFunctions, writeTraceTraceBackPlots),
+ offsetof(GraphFunctions, writeTraceTraceForePlots),
+ },
+ offsetof(GraphFunctions, writeTraceTraceOptions),
+ },
+ {
+ "TraceTime",
+ {
+ offsetof(GraphFunctions, writeTraceTimeBackPlots),
+ offsetof(GraphFunctions, writeTraceTimeForePlots),
+ },
+ offsetof(GraphFunctions, writeTraceTimeOptions),
+ },
};
fprintf(syncState->graphsStream, "\n");
+
+ // Write variables
pos1= ftell(syncState->graphsStream);
for (i= 0; i < syncState->traceNb; i++)
{
fprintf(syncState->graphsStream, "\n");
}
- for (l= 0; l < sizeof(funcTypes) / sizeof(*funcTypes); l++)
+ // Write plots and options
+ for (l= 0; l < sizeof(graphTypes) / sizeof(*graphTypes); l++)
{
// Cover the upper triangular matrix, i is the reference node.
for (i= 0; i < syncState->traceNb; i++)
fprintf(syncState->graphsStream,
"reset\n"
"set output \"%03d-%03d-%s.eps\"\n"
- "plot \\\n", i, j, funcTypes[l].name);
+ "plot \\\n", i, j, graphTypes[l].name);
pos1= ftell(syncState->graphsStream);
- for (k= 0; k < sizeof(moduleGraphFunctions) /
- sizeof(*moduleGraphFunctions); k++)
+ for (m= 0; m < sizeof(graphTypes[l].plotsOffsets) /
+ sizeof(*graphTypes[l].plotsOffsets); m++)
{
- GraphFunction** writePlots= (void*)
- moduleGraphFunctions[k] + funcTypes[l].plotsOffset;
-
- if (*writePlots)
+ for (k= 0; k < sizeof(moduleGraphFunctions) /
+ sizeof(*moduleGraphFunctions); k++)
{
- (*writePlots)(syncState, i, j);
+ GraphFunction** writePlots= (void*)
+ moduleGraphFunctions[k] +
+ graphTypes[l].plotsOffsets[m];
+
+ if (*writePlots)
+ {
+ (*writePlots)(syncState, i, j);
+ }
}
}
fprintf(syncState->graphsStream,
"\nset output \"%03d-%03d-%s.eps\"\n"
- "set title \"\"\n", i, j, funcTypes[l].name);
+ "set title \"\"\n", i, j, graphTypes[l].name);
for (k= 0; k < sizeof(moduleGraphFunctions) /
sizeof(*moduleGraphFunctions); k++)
{
GraphFunction** writeOptions= (void*)
- moduleGraphFunctions[k] + funcTypes[l].optionsOffset;
+ moduleGraphFunctions[k] + graphTypes[l].optionsOffset;
if (*writeOptions)
{
GraphVariableFunction* writeVariables;
/* This is for graphs where the data on both axis is in the range of
* timestamps */
- GraphFunction* writeTraceTracePlots;
+ GraphFunction* writeTraceTraceForePlots;
+ GraphFunction* writeTraceTraceBackPlots;
GraphFunction* writeTraceTraceOptions;
/* This is for graphs where the data on the abscissa is in the range of
* timestamps and the ordinates is in the range of timestamp deltas */
- GraphFunction* writeTraceTimePlots;
+ GraphFunction* writeTraceTimeForePlots;
+ GraphFunction* writeTraceTimeBackPlots;
GraphFunction* writeTraceTimeOptions;
} GraphFunctions;