for (j= 0; j < syncState->traceNb; j++)
{
g_queue_foreach(analysisData->hullArray[i][j], gfPointDestroy, NULL);
+ g_queue_free(analysisData->hullArray[i][j]);
}
free(analysisData->hullArray[i]);
}
for (j= 0; j < i; j++)
{
// There seems to be a memory leak in glpk, valgrind reports a
- // loss even if the problem is deleted
+ // loss (reachable) even if the problem is deleted
glp_delete_prob(graphs->lps[i][j]);
}
free(graphs->lps[i]);
unsigned int i, j;
AnalysisDataEval* analysisData= syncState->analysisData;
AnalysisDataCHull* chAnalysisData= analysisData->chullSS->analysisData;
- FactorsCHull** lpFactorsArray= createAllFactors(syncState->traceNb);
- FactorsCHull* lpFactors;
+ FactorsCHull** lpFactorsArray;
if (!syncState->stats && !syncState->graphsStream)
{
return;
}
+ /* Because of matching_distributor, this analysis may be called twice.
+ * Only run it once */
if ((syncState->graphsStream && analysisData->graphs->lps != NULL) ||
(syncState->stats && analysisData->stats->chFactorsArray != NULL))
{
return;
}
+ lpFactorsArray= createAllFactors(syncState->traceNb);
+
if (syncState->stats)
{
analysisData->stats->chFactorsArray=
else
{
glp_delete_prob(lp);
- destroyFactorsCHull(lpFactors);
}
}
}
* MA 02111-1307, USA.
*/
+#define _GNU_SOURCE
#define NANOSECONDS_PER_SECOND 1000000000
#define CPU_FREQ 1e9
return;
}
+ fclose(processingData->testCase);
+
if (syncState->stats && processingData->factors)
{
g_array_free(processingData->factors, TRUE);
*/
static void finalizeProcessingText(SyncState* const syncState)
{
- size_t len;
int retval;
unsigned int* seq;
GArray* factors;
syncState->processingData;
FILE* testCase= processingData->testCase;
char* line= NULL;
+ size_t bufLen;
seq= calloc(syncState->traceNb, sizeof(unsigned int));
skipCommentLines(testCase);
- retval= getline(&line, &len, testCase);
+ retval= getline(&line, &bufLen, testCase);
while(!feof(testCase))
{
unsigned int sender, receiver;
g_error(strerror(errno));
}
- if (line[len - 1] == '\n')
+ if (line[retval - 1] == '\n')
{
- line[len - 1]= '\0';
+ line[retval - 1]= '\0';
}
retval= sscanf(line, " %u %u %lf %lf %c", &sender, &receiver,
seq[sender]++;
skipCommentLines(testCase);
- retval= getline(&line, &len, testCase);
+ retval= getline(&line, &bufLen, testCase);
}
free(seq);
abort();
}
+ if (line)
+ {
+ free(line);
+ }
+
return result;
}
bool stats;
const char* testCaseName;
GString* analysisModulesNames;
+ unsigned int id;
// Initialize data structures
syncState= malloc(sizeof(SyncState));
else
{
syncState->stats= false;
- g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
+ id= g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
}
if (optionSyncGraphs.present)
endUsage.ru_stime.tv_usec);
}
+ if (!optionSyncStats.present)
+ {
+ g_log_remove_handler(NULL, id);
+ }
+
return EXIT_SUCCESS;
}