Call the stats and graph functions from sync_chain
[lttv.git] / lttv / lttv / sync / event_matching_tcp.c
index 25e39858fb8b36c76c19c11bcd0efe5d64a5ba09..0202380ccb6f2dca652c6cbe6702d9cba5bee65a 100644 (file)
@@ -26,7 +26,7 @@
 #include <unistd.h>
 
 #include "event_analysis.h"
-#include "sync_chain_lttv.h"
+#include "sync_chain.h"
 
 #include "event_matching_tcp.h"
 
@@ -45,8 +45,6 @@ static GArray* finalizeMatchingTCP(SyncState* const syncState);
 static void printMatchingStatsTCP(SyncState* const syncState);
 static void writeMatchingGraphsPlotsTCP(FILE* stream, SyncState* const
        syncState, const unsigned int i, const unsigned int j);
-static void writeMatchingGraphsOptionsTCP(FILE* stream, SyncState* const
-       syncState, const unsigned int i, const unsigned int j);
 
 // Functions specific to this module
 static void registerMatchingTCP() __attribute__((constructor (101)));
@@ -69,13 +67,15 @@ static void writeMessagePoint(FILE* stream, const Message* const message);
 
 static MatchingModule matchingModuleTCP = {
        .name= "TCP",
+       .canMatch[TCP]= true,
+       .canMatch[UDP]= false,
        .initMatching= &initMatchingTCP,
        .destroyMatching= &destroyMatchingTCP,
        .matchEvent= &matchEventTCP,
        .finalizeMatching= &finalizeMatchingTCP,
        .printMatchingStats= &printMatchingStatsTCP,
        .writeMatchingGraphsPlots= &writeMatchingGraphsPlotsTCP,
-       .writeMatchingGraphsOptions= &writeMatchingGraphsOptionsTCP,
+       .writeMatchingGraphsOptions= NULL,
 };
 
 
@@ -231,12 +231,13 @@ static void partialDestroyMatchingTCP(SyncState* const syncState)
  * Args:
  *   syncState     container for synchronization data.
  *   event         new event to match
- *   eventType     type of event to match
  */
 static void matchEventTCP(SyncState* const syncState, Event* const event)
 {
        MatchingDataTCP* matchingData;
 
+       g_assert(event->type == TCP);
+
        matchingData= (MatchingDataTCP*) syncState->matchingData;
 
        if (event->event.tcpEvent->direction == IN)
@@ -272,8 +273,8 @@ static GArray* finalizeMatchingTCP(SyncState* const syncState)
 
 
 /*
- * Print statistics related to matching and downstream modules. Must be
- * called after finalizeMatching.
+ * Print statistics related to matching. Must be called after
+ * finalizeMatching.
  *
  * Args:
  *   syncState     container for synchronization data.
@@ -315,11 +316,6 @@ static void printMatchingStatsTCP(SyncState* const syncState)
                printf("\ttotal synchronization exchanges: %u\n",
                        matchingData->stats->totExchangeSync);
        }
-
-       if (syncState->analysisModule->printAnalysisStats != NULL)
-       {
-               syncState->analysisModule->printAnalysisStats(syncState);
-       }
 }
 
 
@@ -643,14 +639,14 @@ static void writeMessagePoint(FILE* stream, const Message* const message)
        if (message->inE->traceNum < message->outE->traceNum)
        {
                // CA is inE->traceNum
-               x= message->inE->time;
-               y= message->outE->time;
+               x= message->inE->cpuTime;
+               y= message->outE->cpuTime;
        }
        else
        {
                // CA is outE->traceNum
-               x= message->outE->time;
-               y= message->inE->time;
+               x= message->outE->cpuTime;
+               y= message->inE->cpuTime;
        }
 
        fprintf(stream, "%20llu %20llu\n", x, y);
@@ -699,8 +695,7 @@ static void closeGraphDataFiles(SyncState* const syncState)
 
 
 /*
- * Write the matching-specific graph lines in the gnuplot script. Call the
- * downstream module's graph function.
+ * Write the matching-specific graph lines in the gnuplot script.
  *
  * Args:
  *   stream:       stream where to write the data
@@ -718,31 +713,4 @@ static void writeMatchingGraphsPlotsTCP(FILE* stream, SyncState* const
                "\t\"matching_tcp-%2$03d_to_%1$03d.data\" "
                        "title \"Received messages\" with points linetype 4 "
                        "linecolor rgb \"#6699cc\" pointtype 11 pointsize 2, \\\n", i, j);
-
-       if (syncState->analysisModule->writeAnalysisGraphsPlots != NULL)
-       {
-               syncState->analysisModule->writeAnalysisGraphsPlots(stream, syncState,
-                       i, j);
-       }
-}
-
-
-/*
- * Write the matching-specific options in the gnuplot script (none). Call the
- * downstream module's options function.
- *
- * Args:
- *   stream:       stream where to write the data
- *   syncState:    container for synchronization data
- *   i:            first trace number
- *   j:            second trace number, garanteed to be larger than i
- */
-static void writeMatchingGraphsOptionsTCP(FILE* stream, SyncState* const
-       syncState, const unsigned int i, const unsigned int j)
-{
-       if (syncState->analysisModule->writeAnalysisGraphsOptions != NULL)
-       {
-               syncState->analysisModule->writeAnalysisGraphsOptions(stream,
-                       syncState, i, j);
-       }
 }
This page took 0.024059 seconds and 4 git commands to generate.