broadcast);
GArray* (*finalizeAnalysis)(struct _SyncState* const syncState);
void (*printAnalysisStats)(struct _SyncState* const syncState);
- void (*writeAnalysisGraphsPlots)(FILE* stream, struct _SyncState* const
- syncState, const unsigned int i, const unsigned int j);
- void (*writeAnalysisGraphsOptions)(FILE* stream, struct _SyncState* const
- syncState, const unsigned int i, const unsigned int j);
+ void (*writeAnalysisGraphsPlots)(struct _SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
+ void (*writeAnalysisGraphsOptions)(struct _SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
} AnalysisModule;
#endif
message);
static GArray* finalizeAnalysisCHull(SyncState* const syncState);
static void printAnalysisStatsCHull(SyncState* const syncState);
-static void writeAnalysisGraphsPlotsCHull(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j);
+static void writeAnalysisGraphsPlotsCHull(SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerAnalysisCHull() __attribute__((constructor (101)));
analysisData->stats->allFactors= NULL;
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
analysisData->graphsData= malloc(sizeof(AnalysisGraphsDataCHull));
openGraphFiles(syncState);
analysisData= (AnalysisDataCHull*) syncState->analysisData;
- cwd= changeToGraphDir(syncState->graphs);
+ cwd= changeToGraphDir(syncState->graphsDir);
analysisData->graphsData->hullPoints= malloc(syncState->traceNb *
sizeof(FILE**));
free(analysisData->stats);
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
if (analysisData->graphsData->hullPoints != NULL)
{
analysisData= (AnalysisDataCHull*) syncState->analysisData;
- if (syncState->graphs && analysisData->graphsData->hullPoints != NULL)
+ if (syncState->graphsStream && analysisData->graphsData->hullPoints != NULL)
{
writeGraphFiles(syncState);
closeGraphFiles(syncState);
factors= reduceFactors(syncState, allFactors);
- if (syncState->stats || syncState->graphs)
+ if (syncState->stats || syncState->graphsStream)
{
if (syncState->stats)
{
analysisData->stats->allFactors= allFactors;
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
analysisData->graphsData->allFactors= allFactors;
}
* Write the analysis-specific graph lines in the gnuplot script.
*
* 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
*/
-void writeAnalysisGraphsPlotsCHull(FILE* stream, SyncState* const syncState,
- const unsigned int i, const unsigned int j)
+void writeAnalysisGraphsPlotsCHull(SyncState* const syncState, const unsigned
+ int i, const unsigned int j)
{
AnalysisDataCHull* analysisData;
FactorsCHull* factorsCHull;
analysisData= (AnalysisDataCHull*) syncState->analysisData;
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t\"analysis_chull-%1$03d_to_%2$03d.data\" "
"title \"Lower half-hull\" with linespoints "
"linecolor rgb \"#015a01\" linetype 4 pointtype 8 pointsize 0.8, \\\n"
factorsCHull= &analysisData->graphsData->allFactors[j][i];
if (factorsCHull->type == EXACT)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%7g + %7g * x "
"title \"Exact conversion\" with lines "
"linecolor rgb \"black\" linetype 1, \\\n",
}
else if (factorsCHull->type == MIDDLE)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Min conversion\" with lines "
"linecolor rgb \"black\" linetype 5, \\\n",
factorsCHull->min->offset, factorsCHull->min->drift);
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Max conversion\" with lines "
"linecolor rgb \"black\" linetype 8, \\\n",
factorsCHull->max->offset, factorsCHull->max->drift);
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Middle conversion\" with lines "
"linecolor rgb \"gray60\" linetype 1, \\\n",
}
else if (factorsCHull->type == FALLBACK)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Fallback conversion\" with lines "
"linecolor rgb \"gray60\" linetype 1, \\\n",
{
if (factorsCHull->min->drift != -INFINITY)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Min conversion\" with lines "
"linecolor rgb \"black\" linetype 5, \\\n",
if (factorsCHull->max->drift != INFINITY)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Max conversion\" with lines "
"linecolor rgb \"black\" linetype 8, \\\n",
{
if (factorsCHull->min != NULL && factorsCHull->min->drift != -INFINITY)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Min conversion\" with lines "
"linecolor rgb \"black\" linetype 5, \\\n",
if (factorsCHull->max != NULL && factorsCHull->max->drift != INFINITY)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%.2f + %.10f * x "
"title \"Max conversion\" with lines "
"linecolor rgb \"black\" linetype 8, \\\n",
broadcast);
static GArray* finalizeAnalysisEval(SyncState* const syncState);
static void printAnalysisStatsEval(SyncState* const syncState);
-static void writeAnalysisGraphsPlotsEval(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j);
-static void writeAnalysisGraphsOptionsEval(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j);
+static void writeAnalysisGraphsPlotsEval(SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
+static void writeAnalysisGraphsOptionsEval(SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerAnalysisEval() __attribute__((constructor (102)));
&gdnDestroyRttKey, &gdnDestroyDouble);
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
binBase= exp10(6. / (binNb - 2));
analysisData->graphs= malloc(sizeof(AnalysisGraphsEval));
char name[36];
AnalysisDataEval* analysisData= syncState->analysisData;
- cwd= changeToGraphDir(syncState->graphs);
+ cwd= changeToGraphDir(syncState->graphsDir);
analysisData->graphs->ttPoints= malloc(syncState->traceNb *
sizeof(FILE**));
free(analysisData->stats);
}
- if (syncState->graphs && analysisData->graphs)
+ if (syncState->graphsStream && analysisData->graphs)
{
destroyGraphs(syncState);
free(analysisData->graphs);
{
messageStats->inversionNb++;
}
- else if (syncState->graphs)
+ else if (syncState->graphsStream)
{
analysisData->graphs->ttBinsArray[message->outE->traceNum][message->inE->traceNum][binNum(tt)]++;
analysisData->graphs->ttBinsTotal[message->outE->traceNum][message->inE->traceNum]++;
*rtt= wallTimeSub(&m1->inE->wallTime, &m1->outE->wallTime) -
wallTimeSub(&m2->outE->wallTime, &m2->inE->wallTime);
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
unsigned int row= MAX(m1->inE->traceNum, m1->outE->traceNum);
unsigned int col= MIN(m1->inE->traceNum, m1->outE->traceNum);
unsigned int i;
AnalysisDataEval* analysisData= syncState->analysisData;
- if (syncState->graphs && analysisData->graphs)
+ if (syncState->graphsStream && analysisData->graphs)
{
writeGraphFiles(syncState);
destroyGraphs(syncState);
* Write the analysis-specific graph lines in the gnuplot script.
*
* 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 writeAnalysisGraphsPlotsEval(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j)
+static void writeAnalysisGraphsPlotsEval(SyncState* const syncState, const
+ unsigned int i, const unsigned int j)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t\"analysis_eval_hrtt-%2$03d_and_%1$03d.data\" "
"title \"RTT/2\" with boxes linetype 1 linewidth 3 "
"linecolor rgb \"black\" fill transparent solid 0.75, \\\n"
"linecolor rgb \"black\" fill transparent solid 0.25, \\\n"*/
, i, j);
/*
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t\"analysis_eval_hrtt-%2$03d_and_%1$03d.data\" "
"title \"RTT/2\" with linespoints linetype 1 linewidth 3 "
"linecolor rgb \"black\", \\\n"
* Write the analysis-specific options in the gnuplot script.
*
* 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 writeAnalysisGraphsOptionsEval(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j)
+static void writeAnalysisGraphsOptionsEval(SyncState* const syncState, const
+ unsigned int i, const unsigned int j)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"set xlabel \"Message Latency (s)\"\n"
"set ylabel \"Proportion of messages per second\"\n");
}
static void analyzeExchangeLinReg(SyncState* const syncState, Exchange* const exchange);
static GArray* finalizeAnalysisLinReg(SyncState* const syncState);
static void printAnalysisStatsLinReg(SyncState* const syncState);
-static void writeAnalysisGraphsPlotsLinReg(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j);
+static void writeAnalysisGraphsPlotsLinReg(SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerAnalysisLinReg() __attribute__((constructor (102)));
* Write the analysis-specific graph lines in the gnuplot script.
*
* Args:
- * stream: stream where to write the data
* syncState: container for synchronization data
* i: first trace number, on the x axis
* j: second trace number, garanteed to be larger than i
*/
-void writeAnalysisGraphsPlotsLinReg(FILE* stream, SyncState* const syncState,
- const unsigned int i, const unsigned int j)
+void writeAnalysisGraphsPlotsLinReg(SyncState* const syncState, const unsigned
+ int i, const unsigned int j)
{
AnalysisDataLinReg* analysisData;
Fit* fit;
analysisData= (AnalysisDataLinReg*) syncState->analysisData;
fit= &analysisData->fitArray[j][i];
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t%7g + %7g * x "
"title \"Linreg conversion\" with lines "
"linecolor rgb \"gray60\" linetype 1, \\\n",
event);
GArray* (*finalizeMatching)(struct _SyncState* const syncState);
void (*printMatchingStats)(struct _SyncState* const syncState);
- void (*writeMatchingGraphsPlots)(FILE* stream, struct _SyncState* const
- syncState, const unsigned int i, const unsigned int j);
- void (*writeMatchingGraphsOptions)(FILE* stream, struct _SyncState* const
- syncState, const unsigned int i, const unsigned int j);
+ void (*writeMatchingGraphsPlots)(struct _SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
+ void (*writeMatchingGraphsOptions)(struct _SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
} MatchingModule;
#endif
/* Offset whithin Matching module of the field* containing the function
* pointer */
size_t offset;
- FILE* stream;
unsigned int i, j;
};
event);
static GArray* finalizeMatchingDistributor(SyncState* const syncState);
static void printMatchingStatsDistributor(SyncState* const syncState);
-static void writeMatchingGraphsPlotsDistributor(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j);
-static void writeMatchingGraphsOptionsDistributor(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j);
+static void writeMatchingGraphsPlotsDistributor(SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
+static void writeMatchingGraphsOptionsDistributor(SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerMatchingDistributor() __attribute__((constructor (101)));
* Call the distributed graph lines functions (when they exist).
*
* 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 writeMatchingGraphsPlotsDistributor(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j)
+static void writeMatchingGraphsPlotsDistributor(SyncState* const syncState,
+ const unsigned int i, const unsigned int j)
{
MatchingDataDistributor* matchingData= syncState->matchingData;
g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
&(struct GraphAggregate) {offsetof(MatchingModule,
- writeMatchingGraphsPlots), stream, i, j});
+ writeMatchingGraphsPlots), i, j});
}
* Call the distributed graph options functions (when they exist).
*
* 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 writeMatchingGraphsOptionsDistributor(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j)
+static void writeMatchingGraphsOptionsDistributor(SyncState* const syncState,
+ const unsigned int i, const unsigned int j)
{
MatchingDataDistributor* matchingData= syncState->matchingData;
g_queue_foreach(matchingData->distributedModules, &gfGraphFunctionCall,
&(struct GraphAggregate) {offsetof(MatchingModule,
- writeMatchingGraphsOptions), stream, i, j});
+ writeMatchingGraphsOptions), i, j});
}
{
SyncState* parallelSS= data;
struct GraphAggregate* aggregate= user_data;
- void (*graphFunction)(FILE* , struct _SyncState*, const unsigned int,
- const unsigned int)= (void*) data + (size_t) aggregate->offset;
+ void (*graphFunction)(struct _SyncState*, const unsigned int, const
+ unsigned int)= (void*) data + (size_t) aggregate->offset;
if (graphFunction != NULL)
{
- graphFunction(aggregate->stream, parallelSS, aggregate->i, aggregate->j);
+ graphFunction(parallelSS, aggregate->i, aggregate->j);
}
}
static void matchEventTCP(SyncState* const syncState, Event* const event);
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 writeMatchingGraphsPlotsTCP(SyncState* const syncState, const
+ unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerMatchingTCP() __attribute__((constructor (101)));
matchingData->stats= NULL;
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
openGraphDataFiles(syncState);
}
g_hash_table_destroy(matchingData->unMatchedOutE);
g_hash_table_destroy(matchingData->unAcked);
- if (syncState->graphs && matchingData->messagePoints)
+ if (syncState->graphsStream && matchingData->messagePoints)
{
closeGraphDataFiles(syncState);
}
return;
}
- if (syncState->graphs)
+ if (syncState->graphsStream)
{
writeMessagePoint(matchingData->messagePoints[packet->inE->traceNum][packet->outE->traceNum],
packet);
matchingData= (MatchingDataTCP*) syncState->matchingData;
- cwd= changeToGraphDir(syncState->graphs);
+ cwd= changeToGraphDir(syncState->graphsDir);
matchingData->messagePoints= malloc(syncState->traceNb * sizeof(FILE**));
for (i= 0; i < syncState->traceNb; i++)
*
* Args:
* stream: FILE*, file pointer where to write the point
- * message: message for which to write the point
+ * message: message for which to write the point
*/
static void writeMessagePoint(FILE* stream, const Message* const message)
{
* Write the matching-specific graph lines in the gnuplot script.
*
* 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 writeMatchingGraphsPlotsTCP(FILE* stream, SyncState* const
- syncState, const unsigned int i, const unsigned int j)
+static void writeMatchingGraphsPlotsTCP(SyncState* const syncState, const
+ unsigned int i, const unsigned int j)
{
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"\t\"matching_tcp-%1$03d_to_%2$03d.data\" "
"title \"Sent messages\" with points linetype 4 "
"linecolor rgb \"#98fc66\" pointtype 9 pointsize 2, \\\n"
* graphs to be created at all. If it provides the next function, it must
* also provide the second next function.
*/
- void (*writeProcessingGraphsPlots)(FILE* stream, struct _SyncState* const
- syncState, const unsigned int i, const unsigned int j);
- void (*writeProcessingGraphsOptions)(FILE* stream, struct _SyncState*
- const syncState, const unsigned int i, const unsigned int j);
+ void (*writeProcessingGraphsPlots)(struct _SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
+ void (*writeProcessingGraphsOptions)(struct _SyncState* const syncState,
+ const unsigned int i, const unsigned int j);
} ProcessingModule;
#endif
static void finalizeProcessingLTTVStandard(SyncState* const syncState);
static void printProcessingStatsLTTVStandard(SyncState* const syncState);
-static void writeProcessingGraphsOptionsLTTVStandard(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j);
+static void writeProcessingGraphsOptionsLTTVStandard(SyncState* const
+ syncState, const unsigned int i, const unsigned int j);
// Functions specific to this module
static void registerProcessingLTTVStandard() __attribute__((constructor (102)));
* Write the processing-specific options in the gnuplot script.
*
* 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 writeProcessingGraphsOptionsLTTVStandard(FILE* stream, SyncState*
- const syncState, const unsigned int i, const unsigned int j)
+static void writeProcessingGraphsOptionsLTTVStandard(SyncState* const
+ syncState, const unsigned int i, const unsigned int j)
{
ProcessingDataLTTVStandard* processingData;
LttTrace* traceI, * traceJ;
traceI= processingData->traceSetContext->traces[i]->t;
traceJ= processingData->traceSetContext->traces[j]->t;
- fprintf(stream,
+ fprintf(syncState->graphsStream,
"set key inside right bottom\n"
"set xlabel \"Clock %1$u\"\n"
"set xtics nomirror\n"
{
unsigned int traceNb;
bool stats;
- const char* graphs;
+ FILE* graphsStream;
+ const char* graphsDir;
const ProcessingModule* processingModule;
void* processingData;
enum {
NO_ARG,
REQUIRED_ARG,
- //OPTIONAL_ARG,
+ //OPTIONAL_ARG, // Not yet implemented because not supported by LTTV
HAS_ARG_COUNT // This must be the last field
} hasArg;
union
struct timeval startTime, endTime;
struct rusage startUsage, endUsage;
GList* result;
- FILE* graphsStream;
unsigned int i, j;
int retval;
}
if (optionSyncGraphs.present)
- {
- syncState->graphs= optionSyncGraphsDir.arg;
- }
- else
- {
- syncState->graphs= NULL;
- }
-
- graphsStream= NULL;
- if (syncState->graphs)
{
char* cwd;
int graphsFp;
// Create the graph directory right away in case the module initialization
// functions have something to write in it.
- cwd= changeToGraphDir(syncState->graphs);
+ syncState->graphsDir= optionSyncGraphsDir.arg;
+ cwd= changeToGraphDir(optionSyncGraphsDir.arg);
if ((graphsFp= open("graphs.gnu", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR |
S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH
{
g_error(strerror(errno));
}
- if ((graphsStream= fdopen(graphsFp, "w")) == NULL)
+ if ((syncState->graphsStream= fdopen(graphsFp, "w")) == NULL)
{
g_error(strerror(errno));
}
}
free(cwd);
}
+ else
+ {
+ syncState->graphsStream= NULL;
+ syncState->graphsDir= NULL;
+ }
// Identify and initialize modules
syncState->processingData= NULL;
syncState->processingModule->finalizeProcessing(syncState);
// Write graphs file
- if (graphsStream != NULL)
+ if (optionSyncGraphs.present)
{
- fprintf(graphsStream,
+ fprintf(syncState->graphsStream,
"#!/usr/bin/gnuplot\n\n"
"set terminal postscript eps color size 8in,6in\n");
{
long pos1, pos2, trunc;
- fprintf(graphsStream,
+ fprintf(syncState->graphsStream,
"\nset output \"%03d-%03d.eps\"\n"
"plot \\\n", i, j);
if (syncState->processingModule->writeProcessingGraphsPlots)
{
- syncState->processingModule->writeProcessingGraphsPlots(graphsStream,
- syncState, i, j);
+ syncState->processingModule->writeProcessingGraphsPlots(syncState,
+ i, j);
}
if (syncState->matchingModule->writeMatchingGraphsPlots)
{
- syncState->matchingModule->writeMatchingGraphsPlots(graphsStream,
- syncState, i, j);
+ syncState->matchingModule->writeMatchingGraphsPlots(syncState,
+ i, j);
}
if (syncState->analysisModule->writeAnalysisGraphsPlots)
{
- syncState->analysisModule->writeAnalysisGraphsPlots(graphsStream,
- syncState, i, j);
+ syncState->analysisModule->writeAnalysisGraphsPlots(syncState,
+ i, j);
}
- fflush(graphsStream);
- pos2= ftell(graphsStream);
+ fflush(syncState->graphsStream);
+ pos2= ftell(syncState->graphsStream);
if (pos1 != pos2)
{
// Remove the ", \\\n" from the last graph plot line
trunc= pos2 - 7;
}
- if (ftruncate(fileno(graphsStream), trunc) == -1)
+ if (ftruncate(fileno(syncState->graphsStream), trunc) == -1)
{
g_error(strerror(errno));
}
- if (fseek(graphsStream, 0, SEEK_END) == -1)
+ if (fseek(syncState->graphsStream, 0, SEEK_END) == -1)
{
g_error(strerror(errno));
}
- fprintf(graphsStream,
+ fprintf(syncState->graphsStream,
"\nset output \"%03d-%03d.eps\"\n"
"set title \"\"\n", i, j);
if (syncState->processingModule->writeProcessingGraphsOptions)
{
- syncState->processingModule->writeProcessingGraphsOptions(graphsStream,
- syncState, i, j);
+ syncState->processingModule->writeProcessingGraphsOptions(syncState,
+ i, j);
}
if (syncState->matchingModule->writeMatchingGraphsOptions)
{
- syncState->matchingModule->writeMatchingGraphsOptions(graphsStream,
- syncState, i, j);
+ syncState->matchingModule->writeMatchingGraphsOptions(syncState,
+ i, j);
}
if (syncState->analysisModule->writeAnalysisGraphsOptions)
{
- syncState->analysisModule->writeAnalysisGraphsOptions(graphsStream,
- syncState, i, j);
+ syncState->analysisModule->writeAnalysisGraphsOptions(syncState,
+ i, j);
}
if (pos1 != pos2)
{
- fprintf(graphsStream, "replot\n");
+ fprintf(syncState->graphsStream, "replot\n");
}
}
}
- if (fclose(graphsStream) != 0)
+ if (fclose(syncState->graphsStream) != 0)
{
g_error(strerror(errno));
}
SyncState* syncState;
struct timeval startTime;
struct rusage startUsage;
- FILE* graphsStream;
};
static LttvHooks* before_traceset, * before_trace, * event_hook, * after_traceset;
syncState->stats= true;
if (optionEvalGraphs)
- {
- syncState->graphs= optionEvalGraphsDir;
- }
- else
- {
- syncState->graphs= NULL;
- }
-
- tracesetChainState->graphsStream= NULL;
- if (syncState->graphs)
{
char* cwd;
int graphsFp;
// Create the graph directory right away in case the module initialization
// functions have something to write in it.
- cwd= changeToGraphDir(syncState->graphs);
+ syncState->graphsDir= optionEvalGraphsDir;
+ cwd= changeToGraphDir(optionEvalGraphsDir);
if ((graphsFp= open("graphs.gnu", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR |
S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH
{
g_error(strerror(errno));
}
- if ((tracesetChainState->graphsStream= fdopen(graphsFp, "w")) == NULL)
+ if ((syncState->graphsStream= fdopen(graphsFp, "w")) == NULL)
{
g_error(strerror(errno));
}
}
free(cwd);
}
+ else
+ {
+ syncState->graphsStream= NULL;
+ syncState->graphsDir= NULL;
+ }
syncState->analysisData= NULL;
result= g_queue_find_custom(&analysisModules, "eval",
syncState->processingModule->finalizeProcessing(syncState);
// Write graphs file
- if (tracesetChainState->graphsStream != NULL)
+ if (optionEvalGraphs)
{
- fprintf(tracesetChainState->graphsStream,
+ fprintf(syncState->graphsStream,
"#!/usr/bin/gnuplot\n\n"
"set terminal postscript eps color size 8in,6in\n");
{
long pos1, pos2, trunc;
- fprintf(tracesetChainState->graphsStream,
+ fprintf(syncState->graphsStream,
"\nset output \"%03d-%03d.eps\"\n"
"plot \\\n", i, j);
- pos1= ftell(tracesetChainState->graphsStream);
+ pos1= ftell(syncState->graphsStream);
if (syncState->analysisModule->writeAnalysisGraphsPlots)
{
- syncState->analysisModule->writeAnalysisGraphsPlots(tracesetChainState->graphsStream,
- syncState, i, j);
+ syncState->analysisModule->writeAnalysisGraphsPlots(syncState,
+ i, j);
}
- fflush(tracesetChainState->graphsStream);
- pos2= ftell(tracesetChainState->graphsStream);
+ fflush(syncState->graphsStream);
+ pos2= ftell(syncState->graphsStream);
if (pos1 != pos2)
{
// Remove the ", \\\n" from the last graph plot line
trunc= pos2 - 7;
}
- if (ftruncate(fileno(tracesetChainState->graphsStream), trunc) == -1)
+ if (ftruncate(fileno(syncState->graphsStream), trunc) == -1)
{
g_error(strerror(errno));
}
- if (fseek(tracesetChainState->graphsStream, 0, SEEK_END) == -1)
+ if (fseek(syncState->graphsStream, 0, SEEK_END) == -1)
{
g_error(strerror(errno));
}
- fprintf(tracesetChainState->graphsStream,
+ fprintf(syncState->graphsStream,
"\nset output \"%1$03d-%2$03d.eps\"\n"
"set title \"\"\n", i, j);
if (syncState->analysisModule->writeAnalysisGraphsOptions)
{
- syncState->analysisModule->writeAnalysisGraphsOptions(tracesetChainState->graphsStream,
- syncState, i, j);
+ syncState->analysisModule->writeAnalysisGraphsOptions(syncState,
+ i, j);
}
if (pos1 != pos2)
{
- fprintf(tracesetChainState->graphsStream, "replot\n");
+ fprintf(syncState->graphsStream, "replot\n");
}
}
}
- if (fclose(tracesetChainState->graphsStream) != 0)
+ if (fclose(syncState->graphsStream) != 0)
{
g_error(strerror(errno));
}