+ // Write graphs file
+ if (graphsStream != NULL)
+ {
+ unsigned int i, j;
+
+ fprintf(graphsStream,
+ "#!/usr/bin/gnuplot\n\n"
+ "set terminal postscript eps color size 8in,6in\n");
+
+ // Cover the upper triangular matrix, i is the reference node.
+ for (i= 0; i < syncState->traceNb; i++)
+ {
+ for (j= i + 1; j < syncState->traceNb; j++)
+ {
+ long pos;
+
+ fprintf(graphsStream,
+ "\nset output \"%03d-%03d.eps\"\n"
+ "plot \\\n", i, j);
+
+ syncState->processingModule->writeProcessingGraphsPlots(graphsStream,
+ syncState, i, j);
+
+ // Remove the ", \\\n" from the last graph plot line
+ fflush(graphsStream);
+ pos= ftell(graphsStream);
+ if (ftruncate(fileno(graphsStream), pos - 4) == -1)
+ {
+ g_error(strerror(errno));
+ }
+ if (fseek(graphsStream, 0, SEEK_END) == -1)
+ {
+ g_error(strerror(errno));
+ }
+
+ fprintf(graphsStream,
+ "\nset output \"%1$03d-%2$03d.eps\"\n"
+ "set key inside right bottom\n"
+ "set title \"\"\n"
+ "set xlabel \"Clock %1$u\"\n"
+ "set xtics nomirror\n"
+ "set ylabel \"Clock %2$u\"\n"
+ "set ytics nomirror\n", i, j);
+
+ syncState->processingModule->writeProcessingGraphsOptions(graphsStream,
+ syncState, i, j);
+
+ fprintf(graphsStream,
+ "replot\n");
+ }
+ }
+
+ if (fclose(graphsStream) != 0)
+ {
+ g_error(strerror(errno));
+ }
+ }
+