Display the accuracy area below the eval graphs
authorBenjamin Poirier <benjamin.poirier@polymtl.ca>
Thu, 1 Apr 2010 14:46:32 +0000 (10:46 -0400)
committerBenjamin Poirier <benjamin.poirier@polymtl.ca>
Wed, 7 Apr 2010 16:11:38 +0000 (12:11 -0400)
Restore the trace-time graph behavior that was present before "Calculate
synchronization accuracy within the chull module". The encapsulation is not
broken however. The eval graphs show broadcast points over the accuracy area.

Signed-off-by: Benjamin Poirier <benjamin.poirier@polymtl.ca>
lttv/lttv/sync/event_analysis_eval.c
lttv/lttv/sync/event_analysis_eval.h

index d5c3be290c2fc1016e689ce12e004bdec6a569b2..8632b6a60ab0536b8108fa5019949ef2c776a1c4 100644 (file)
@@ -57,6 +57,10 @@ static void analyzeBroadcastEval(SyncState* const syncState, Broadcast* const
        broadcast);
 static AllFactors* finalizeAnalysisEval(SyncState* const syncState);
 static void printAnalysisStatsEval(SyncState* const syncState);
+static void writeAnalysisTraceTimeBackPlotsEval(SyncState* const syncState,
+       const unsigned int i, const unsigned int j);
+static void writeAnalysisTraceTimeForePlotsEval(SyncState* const syncState,
+       const unsigned int i, const unsigned int j);
 
 // Functions specific to this module
 static guint ghfRttKeyHash(gconstpointer key);
@@ -104,7 +108,10 @@ static AnalysisModule analysisModuleEval= {
        .analyzeBroadcast= &analyzeBroadcastEval,
        .finalizeAnalysis= &finalizeAnalysisEval,
        .printAnalysisStats= &printAnalysisStatsEval,
-       .graphFunctions= {}
+       .graphFunctions= {
+               .writeTraceTimeBackPlots= &writeAnalysisTraceTimeBackPlotsEval,
+               .writeTraceTimeForePlots= &writeAnalysisTraceTimeForePlotsEval,
+       }
 };
 
 static ModuleOption optionEvalRttFile= {
@@ -188,6 +195,7 @@ static void initAnalysisEval(SyncState* const syncState)
        if (syncState->graphsStream)
        {
                AnalysisGraphsEval* graphs= malloc(sizeof(AnalysisGraphsEval));
+               GList* result;
 
                analysisData->graphs= graphs;
 
@@ -205,6 +213,14 @@ static void initAnalysisEval(SyncState* const syncState)
                                graphs->bounds[i][j].max= 0;
                        }
                }
+
+               graphs->chullSS= (SyncState*) malloc(sizeof(SyncState));
+               memcpy(graphs->chullSS, syncState, sizeof(SyncState));
+               graphs->chullSS->analysisData= NULL;
+               result= g_queue_find_custom(&analysisModules, "chull", &gcfCompareAnalysis);
+               g_assert(result != NULL);
+               graphs->chullSS->analysisModule= (AnalysisModule*) result->data;
+               graphs->chullSS->analysisModule->initAnalysis(graphs->chullSS);
        }
 }
 
@@ -510,6 +526,9 @@ static void destroyAnalysisEval(SyncState* const syncState)
                }
                free(graphs->bounds);
 
+               graphs->chullSS->analysisModule->destroyAnalysis(graphs->chullSS);
+               free(graphs->chullSS);
+
                free(graphs);
        }
 
@@ -612,6 +631,9 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const
        {
                updateBounds(analysisData->graphs->bounds, message->inE,
                        message->outE);
+
+               analysisData->graphs->chullSS->analysisModule->analyzeMessage(analysisData->graphs->chullSS,
+                       message);
        }
 }
 
@@ -806,6 +828,9 @@ static AllFactors* finalizeAnalysisEval(SyncState* const syncState)
 {
        AnalysisDataEval* analysisData= syncState->analysisData;
 
+       /* This function may be run twice because of matching_distributor. This
+        * check is there to make sure the next block is run only once.
+        */
        if (syncState->graphsStream && analysisData->graphs->histograms)
        {
                g_hash_table_foreach(analysisData->graphs->histograms,
@@ -813,6 +838,14 @@ static AllFactors* finalizeAnalysisEval(SyncState* const syncState)
                        analysisData->rttInfo, .graphsStream= syncState->graphsStream});
                g_hash_table_destroy(analysisData->graphs->histograms);
                analysisData->graphs->histograms= NULL;
+
+               if (syncState->graphsStream)
+               {
+                       SyncState* chullSS= analysisData->graphs->chullSS;
+
+                       freeAllFactors(chullSS->analysisModule->finalizeAnalysis(chullSS),
+                               chullSS->traceNb);
+               }
        }
 
        return createAllFactors(syncState->traceNb);
@@ -1392,3 +1425,49 @@ static void updateBounds(Bounds** const bounds, Event* const e1, Event* const
                tpBounds->max= messageTime;
        }
 }
+
+
+/*
+ * 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 writeAnalysisTraceTimeBackPlotsEval(SyncState* const syncState,
+       const unsigned int i, const unsigned int j)
+{
+       SyncState* chullSS= ((AnalysisDataEval*)
+                               syncState->analysisData)->graphs->chullSS;
+       const GraphFunctions* graphFunctions=
+               &chullSS->analysisModule->graphFunctions;
+
+       if (graphFunctions->writeTraceTimeBackPlots != NULL)
+       {
+                       graphFunctions->writeTraceTimeBackPlots(chullSS, i, 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 writeAnalysisTraceTimeForePlotsEval(SyncState* const syncState,
+       const unsigned int i, const unsigned int j)
+{
+       SyncState* chullSS= ((AnalysisDataEval*)
+               syncState->analysisData)->graphs->chullSS;
+       const GraphFunctions* graphFunctions=
+               &chullSS->analysisModule->graphFunctions;
+
+       if (graphFunctions->writeTraceTimeForePlots != NULL)
+       {
+               graphFunctions->writeTraceTimeForePlots(chullSS, i, j);
+       }
+}
index d6d39c2f0664214380bcfb886869218a008ed1c7..736dc8b03d089a99df9242460ed91a284995daa0 100644 (file)
@@ -115,6 +115,9 @@ typedef struct
         * Only the lower triangular part of the matrix is allocated, that is
         * bounds[i][j] where i > j */
        Bounds** bounds;
+
+       // Extra SyncState used to overlay the chull-calculated accuracy region
+       SyncState* chullSS;
 } AnalysisGraphsEval;
 
 typedef struct
This page took 0.02547 seconds and 4 git commands to generate.