- fprintf(graphsStream,
- "plot \\\n"
- "\t\"analysis_eval_hrtt-%1$s_and_%2$s.data\" "
- "title \"RTT/2\" with linespoints linetype 1 linewidth 2 "
- "linecolor rgb \"black\" pointtype 6 pointsize 1,\\\n"
- "\t\"analysis_eval_tt-%1$s_to_%2$s.data\" "
- "title \"%1$s to %2$s\" with linespoints linetype 4 linewidth 2 "
- "linecolor rgb \"gray60\" pointtype 6 pointsize 1,\\\n"
- "\t\"analysis_eval_tt-%2$s_to_%1$s.data\" "
- "title \"%2$s to %1$s\" with linespoints linetype 4 linewidth 2 "
- "linecolor rgb \"gray30\" pointtype 6 pointsize 1\n", saddr, daddr);
+ if (normalTotal(&graph->ttSendBins) || normalTotal(&graph->ttRecvBins) ||
+ normalTotal(&graph->hrttBins))
+ {
+ fprintf(graphsStream, "plot \\\n");
+
+ if (normalTotal(&graph->hrttBins))
+ {
+ fprintf(graphsStream,
+ "\t\"analysis_eval_hrtt-%s_and_%s.data\" "
+ "title \"RTT/2\" with linespoints linetype 1 linewidth 2 "
+ "linecolor rgb \"black\" pointtype 6 pointsize 1,\\\n",
+ saddr, daddr);
+ }
+
+ if (normalTotal(&graph->ttSendBins))
+ {
+ fprintf(graphsStream,
+ "\t\"analysis_eval_tt-%1$s_to_%2$s.data\" "
+ "title \"%1$s to %2$s\" with linespoints linetype 4 linewidth 2 "
+ "linecolor rgb \"gray60\" pointtype 6 pointsize 1,\\\n",
+ saddr, daddr);
+ }
+
+ if (normalTotal(&graph->ttRecvBins))
+ {
+ fprintf(graphsStream,
+ "\t\"analysis_eval_tt-%1$s_to_%2$s.data\" "
+ "title \"%1$s to %2$s\" with linespoints linetype 4 linewidth 2 "
+ "linecolor rgb \"gray30\" pointtype 6 pointsize 1,\\\n",
+ daddr, saddr);
+ }
+
+ // Remove the ",\\\n" from the last graph plot line
+ if (ftruncate(fileno(graphsStream), ftell(graphsStream) - 3) == -1)
+ {
+ g_error(strerror(errno));
+ }
+ if (fseek(graphsStream, 0, SEEK_END) == -1)
+ {
+ g_error(strerror(errno));
+ }
+ fprintf(graphsStream, "\n");
+ }