Have callbacks for "background" and "foreground" graphs
[lttv.git] / lttv / lttv / sync / event_matching_broadcast.c
index 98bab58abd69fd26b828aff9488f9508715b3f83..ca5375b794bb618e0c4ce90d3d98d20d8012f0d8 100644 (file)
@@ -54,7 +54,6 @@ static void partialDestroyMatchingBroadcast(SyncState* const syncState);
 static void openGraphDataFiles(SyncState* const syncState);
 static void writeAccuracyPoints(MatchingGraphsBroadcast* graphs, const
        Broadcast* const broadcast);
-void gfAddToArray(gpointer data, gpointer user_data);
 static void closeGraphDataFiles(SyncState* const syncState);
 
 
@@ -67,8 +66,9 @@ static MatchingModule matchingModuleBroadcast = {
        .matchEvent= &matchEventBroadcast,
        .finalizeMatching= &finalizeMatchingBroadcast,
        .printMatchingStats= &printMatchingStatsBroadcast,
-       .writeMatchingGraphsPlots= &writeMatchingGraphsPlotsBroadcast,
-       .writeMatchingGraphsOptions= NULL,
+       .graphFunctions= {
+               .writeTraceTimeForePlots= &writeMatchingGraphsPlotsBroadcast,
+       }
 };
 
 
@@ -418,7 +418,7 @@ static void writeAccuracyPoints(MatchingGraphsBroadcast* graphs, const
        unsigned int eventNb= broadcast->events->length;
 
        events= g_array_sized_new(FALSE, FALSE, sizeof(Event*), eventNb);
-       g_queue_foreach(broadcast->events, &gfAddToArray, events);
+       g_queue_foreach(broadcast->events, &gfAddEventToArray, events);
 
        for (i= 0; i < eventNb; i++)
        {
@@ -430,25 +430,14 @@ static void writeAccuracyPoints(MatchingGraphsBroadcast* graphs, const
                        if (eventI->traceNum < eventJ->traceNum)
                        {
                                fprintf(graphs->accuracyPoints[eventJ->traceNum][eventI->traceNum],
-                                       "%20llu %20lld\n", eventI->cpuTime, (int64_t) eventJ->cpuTime -
-                                       eventI->cpuTime);
+                                       "%20llu %20.9f\n", eventI->cpuTime,
+                                       wallTimeSub(&eventJ->wallTime, &eventI->wallTime));
                                graphs->pointsNb[eventJ->traceNum][eventI->traceNum]++;
                        }
                }
        }
-}
 
-
-/*
- * A GFunc for g_queue_foreach()
- *
- * Args:
- *   data          Event*, event to add
- *   user_data     GArray*, array to add to
- */
-void gfAddToArray(gpointer data, gpointer user_data)
-{
-       g_array_append_val((GArray*) user_data, data);
+       g_array_free(events, TRUE);
 }
 
 
This page took 0.022894 seconds and 4 git commands to generate.