Add a processing module that reads events from a text file
[lttv.git] / lttv / lttv / sync / event_analysis_chull.c
index 50bb7ab5d6dba2654d0ba5a73596b7bf9b96e2db..e77eabd221048738aafb84f3dc0ee71a5c7bfb87 100644 (file)
@@ -26,6 +26,7 @@
 #include <float.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 #include "sync_chain.h"
 #include "event_analysis_chull.h"
 
 
-#ifndef g_info
-#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
-#endif
-
-
 typedef enum
 {
        LOWER,
@@ -107,7 +103,7 @@ static AnalysisModule analysisModuleCHull= {
        .finalizeAnalysis= &finalizeAnalysisCHull,
        .printAnalysisStats= &printAnalysisStatsCHull,
        .graphFunctions= {
-               .writeTraceTracePlots= &writeAnalysisGraphsPlotsCHull,
+               .writeTraceTraceForePlots= &writeAnalysisGraphsPlotsCHull,
        }
 };
 
@@ -120,6 +116,7 @@ const char* const approxNames[]= {
        [SCREWED]= "Screwed",
 };
 
+
 /*
  * Analysis module registering function
  */
@@ -196,7 +193,7 @@ static void openGraphFiles(SyncState* const syncState)
 
        analysisData= (AnalysisDataCHull*) syncState->analysisData;
 
-       cwd= changeToGraphDir(syncState->graphsDir);
+       cwd= changeToGraphsDir(syncState->graphsDir);
 
        analysisData->graphsData->hullPoints= malloc(syncState->traceNb *
                sizeof(FILE**));
@@ -588,18 +585,19 @@ static void printAnalysisStatsCHull(SyncState* const syncState)
                        FactorsCHull* factorsCHull;
 
                        factorsCHull= &analysisData->stats->allFactors[j][i];
-                       printf("\t\t%3d - %-3d: ", i, j);
+                       printf("\t\t%3d - %-3d: %s", i, j,
+                               approxNames[factorsCHull->type]);
 
                        if (factorsCHull->type == EXACT)
                        {
-                               printf("Exact      a0= % 7g a1= 1 %c %7g\n",
+                               printf("      a0= % 7g a1= 1 %c %7g\n",
                                        factorsCHull->approx->offset,
                                        factorsCHull->approx->drift < 0. ? '-' : '+',
                                        fabs(factorsCHull->approx->drift));
                        }
                        else if (factorsCHull->type == MIDDLE)
                        {
-                               printf("Middle     a0= % 7g a1= 1 %c %7g accuracy %7g\n",
+                               printf("     a0= % 7g a1= 1 %c %7g accuracy %7g\n",
                                        factorsCHull->approx->offset, factorsCHull->approx->drift
                                        - 1. < 0. ? '-' : '+', fabs(factorsCHull->approx->drift -
                                                1.), factorsCHull->accuracy);
@@ -612,14 +610,14 @@ static void printAnalysisStatsCHull(SyncState* const syncState)
                        }
                        else if (factorsCHull->type == FALLBACK)
                        {
-                               printf("Fallback   a0= % 7g a1= 1 %c %7g error= %7g\n",
+                               printf("   a0= % 7g a1= 1 %c %7g error= %7g\n",
                                        factorsCHull->approx->offset, factorsCHull->approx->drift
                                        - 1. < 0. ? '-' : '+', fabs(factorsCHull->approx->drift -
                                                1.), factorsCHull->accuracy);
                        }
                        else if (factorsCHull->type == INCOMPLETE)
                        {
-                               printf("Incomplete\n");
+                               printf("\n");
 
                                if (factorsCHull->min->drift != -INFINITY)
                                {
@@ -638,7 +636,7 @@ static void printAnalysisStatsCHull(SyncState* const syncState)
                        }
                        else if (factorsCHull->type == SCREWED)
                        {
-                               printf("Screwed\n");
+                               printf("\n");
 
                                if (factorsCHull->min != NULL && factorsCHull->min->drift != -INFINITY)
                                {
@@ -657,7 +655,7 @@ static void printAnalysisStatsCHull(SyncState* const syncState)
                        }
                        else if (factorsCHull->type == ABSENT)
                        {
-                               printf("Absent\n");
+                               printf("\n");
                        }
                        else
                        {
@@ -929,7 +927,7 @@ void calculateFactorsMiddle(FactorsCHull* const factors)
        bmin= factors->min->drift;
        bmax= factors->max->drift;
 
-       g_assert_cmpfloat(bmax, >, bmin);
+       g_assert_cmpfloat(bmax, >=, bmin);
 
        factors->approx= malloc(sizeof(Factors));
        bhat= (bmax * bmin - 1. + sqrt(1. + pow(bmax, 2.) * pow(bmin, 2.) +
This page took 0.024198 seconds and 4 git commands to generate.