X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fevent_analysis_chull.c;h=12c3d85f4928698bc5ed0d2ef218d2addb9bd153;hb=29dd991d045247414d55071fe4390e97f627b8e3;hp=4dd073731ebc9180f5ab7ab9e9e0ba35370c205a;hpb=ce3dcf0ed928465670153dd8084234301befc2c0;p=lttv.git diff --git a/lttv/lttv/sync/event_analysis_chull.c b/lttv/lttv/sync/event_analysis_chull.c index 4dd07373..12c3d85f 100644 --- a/lttv/lttv/sync/event_analysis_chull.c +++ b/lttv/lttv/sync/event_analysis_chull.c @@ -1,19 +1,18 @@ /* This file is part of the Linux Trace Toolkit viewer - * Copyright (C) 2009 Benjamin Poirier + * Copyright (C) 2009, 2010 Benjamin Poirier * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License Version 2 as - * published by the Free Software Foundation; + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 2.1 of the License, or (at + * your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . */ #define _ISOC99_SOURCE @@ -22,10 +21,12 @@ #endif #include +#include #include #include #include #include +#include #include #include "sync_chain.h" @@ -33,11 +34,6 @@ #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, @@ -64,8 +60,6 @@ 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))); - static void openGraphFiles(SyncState* const syncState); static void closeGraphFiles(SyncState* const syncState); static void writeGraphFiles(SyncState* const syncState); @@ -124,7 +118,7 @@ const char* const approxNames[]= { /* * Analysis module registering function */ -static void registerAnalysisCHull() +void registerAnalysisCHull() { g_queue_push_tail(&analysisModules, &analysisModuleCHull); } @@ -197,7 +191,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**)); @@ -274,7 +268,7 @@ static void gfDumpHullToFile(gpointer data, gpointer userData) Point* point; point= (Point*) data; - fprintf((FILE*) userData, "%20llu %20llu\n", point->x, point->y); + fprintf((FILE*) userData, "%20" PRIu64 " %20" PRIu64 "\n", point->x, point->y); } @@ -346,6 +340,7 @@ static void destroyAnalysisCHull(SyncState* const syncState) 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]); } @@ -404,7 +399,8 @@ static void analyzeMessageCHull(SyncState* const syncState, Message* const messa newPoint->x= message->inE->cpuTime; newPoint->y= message->outE->cpuTime; hullType= UPPER; - g_debug("Reception point hullArray[%lu][%lu] x= inE->time= %llu y= outE->time= %llu", + g_debug("Reception point hullArray[%lu][%lu] " + "x= inE->time= %" PRIu64 " y= outE->time= %" PRIu64, message->inE->traceNum, message->outE->traceNum, newPoint->x, newPoint->y); } @@ -414,7 +410,8 @@ static void analyzeMessageCHull(SyncState* const syncState, Message* const messa newPoint->x= message->outE->cpuTime; newPoint->y= message->inE->cpuTime; hullType= LOWER; - g_debug("Send point hullArray[%lu][%lu] x= inE->time= %llu y= outE->time= %llu", + g_debug("Send point hullArray[%lu][%lu] " + "x= inE->time= %" PRIu64 " y= outE->time= %" PRIu64, message->inE->traceNum, message->outE->traceNum, newPoint->x, newPoint->y); } @@ -706,7 +703,9 @@ static int jointCmp(const Point const* p1, const Point const* p2, const const double fuzzFactor= 0.; result= crossProductK(p1, p2, p1, p3); - g_debug("crossProductK(p1= (%llu, %llu), p2= (%llu, %llu), p1= (%llu, %llu), p3= (%llu, %llu))= %g", + g_debug("crossProductK(p1= (%" PRIu64 ", %" PRIu64 "), " + "p2= (%" PRIu64 ", %" PRIu64 "), p1= (%" PRIu64 ", %" PRIu64 "), " + "p3= (%" PRIu64 ", %" PRIu64 "))= %g", p1->x, p1->y, p2->x, p2->y, p1->x, p1->y, p3->x, p3->y, result); if (result < fuzzFactor) { @@ -931,7 +930,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.) + @@ -1078,14 +1077,15 @@ static Factors* calculateFactorsExact(GQueue* const cu, GQueue* const cl, const p1= g_queue_peek_nth(c1, i1); p2= g_queue_peek_nth(c2, i2); - g_debug("Resulting points are: c1[i1]: x= %llu y= %llu c2[i2]: x= %llu y= %llu", - p1->x, p1->y, p2->x, p2->y); + g_debug("Resulting points are: c1[i1]: x= %" PRIu64 " y= %" PRIu64 + " c2[i2]: x= %" PRIu64 " y= %" PRIu64 "", p1->x, p1->y, p2->x, p2->y); result= malloc(sizeof(Factors)); result->drift= slope(p1, p2); result->offset= intercept(p1, p2); - g_debug("Resulting factors are: drift= %g offset= %g", result->drift, result->offset); + g_debug("Resulting factors are: drift= %g offset= %g", result->drift, + result->offset); return result; } @@ -1249,7 +1249,7 @@ static double intercept(const Point* const p1, const Point* const p2) * is. * * Two alternative (and subtly different) ways of propagating factors to - * preserve min and max bondaries have been proposed, see: + * preserve min and max boundaries have been proposed, see: * [Duda, A., Harrus, G., Haddad, Y., and Bernard, G.: Estimating global time * in distributed systems, Proc. 7th Int. Conf. on Distributed Computing * Systems, Berlin, volume 18, 1987] p.304