X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fsync%2Fevent_matching_tcp.c;h=2d4fe51827cd88279562560e1a84267eb25dbbfd;hb=df64b31664467d7217fa08fcdee423577856b38a;hp=f769221226b2b1deae8bdeba37a26c74b8bd48b2;hpb=467066eeab8b0a4e5ea07d24f1840310730fd470;p=lttv.git diff --git a/lttv/lttv/sync/event_matching_tcp.c b/lttv/lttv/sync/event_matching_tcp.c index f7692212..2d4fe518 100644 --- a/lttv/lttv/sync/event_matching_tcp.c +++ b/lttv/lttv/sync/event_matching_tcp.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 . */ #ifdef HAVE_CONFIG_H @@ -21,6 +20,7 @@ #endif #include +#include #include #include #include @@ -31,24 +31,17 @@ #include "event_matching_tcp.h" -#ifndef g_info -#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) -#endif - - // Functions common to all matching modules static void initMatchingTCP(SyncState* const syncState); static void destroyMatchingTCP(SyncState* const syncState); static void matchEventTCP(SyncState* const syncState, Event* const event); -static GArray* finalizeMatchingTCP(SyncState* const syncState); +static AllFactors* finalizeMatchingTCP(SyncState* const syncState); static void printMatchingStatsTCP(SyncState* const syncState); -static void writeMatchingGraphsPlotsTCP(SyncState* const syncState, const - unsigned int i, const unsigned int j); +static void writeMatchingGraphsPlotsTCPMessages(SyncState* const syncState, + const unsigned int i, const unsigned int j); // Functions specific to this module -static void registerMatchingTCP() __attribute__((constructor (101))); - static void matchEvents(SyncState* const syncState, Event* const event, GHashTable* const unMatchedList, GHashTable* const unMatchedOppositeList, const size_t fieldOffset, const size_t @@ -75,7 +68,7 @@ static MatchingModule matchingModuleTCP = { .finalizeMatching= &finalizeMatchingTCP, .printMatchingStats= &printMatchingStatsTCP, .graphFunctions= { - .writeTraceTracePlots= &writeMatchingGraphsPlotsTCP, + .writeTraceTraceForePlots= &writeMatchingGraphsPlotsTCPMessages, } }; @@ -83,7 +76,7 @@ static MatchingModule matchingModuleTCP = { /* * Matching module registering function */ -static void registerMatchingTCP() +void registerMatchingTCP() { g_queue_push_tail(&matchingModules, &matchingModuleTCP); } @@ -257,15 +250,15 @@ static void matchEventTCP(SyncState* const syncState, Event* const event) /* - * Call the partial matching destroyer and Obtain the factors from downstream + * Call the partial matching destroyer and obtain the factors from downstream * * Args: * syncState container for synchronization data. * * Returns: - * Factors[traceNb] synchronization factors for each trace + * AllFactors* synchronization factors for each trace pair */ -static GArray* finalizeMatchingTCP(SyncState* const syncState) +static AllFactors* finalizeMatchingTCP(SyncState* const syncState) { partialDestroyMatchingTCP(syncState); @@ -591,7 +584,7 @@ static void openGraphDataFiles(SyncState* const syncState) matchingData= (MatchingDataTCP*) syncState->matchingData; - cwd= changeToGraphDir(syncState->graphsDir); + cwd= changeToGraphsDir(syncState->graphsDir); matchingData->messagePoints= malloc(syncState->traceNb * sizeof(FILE**)); for (i= 0; i < syncState->traceNb; i++) @@ -611,7 +604,7 @@ static void openGraphDataFiles(SyncState* const syncState) if ((matchingData->messagePoints[i][j]= fopen(name, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } @@ -620,7 +613,7 @@ static void openGraphDataFiles(SyncState* const syncState) retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); } @@ -650,7 +643,7 @@ static void writeMessagePoint(FILE* stream, const Message* const message) y= message->inE->cpuTime; } - fprintf(stream, "%20llu %20llu\n", x, y); + fprintf(stream, "%20" PRIu64 " %20" PRIu64 "\n", x, y); } @@ -683,7 +676,7 @@ static void closeGraphDataFiles(SyncState* const syncState) retval= fclose(matchingData->messagePoints[i][j]); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } @@ -703,8 +696,8 @@ static void closeGraphDataFiles(SyncState* const syncState) * i: first trace number * j: second trace number, garanteed to be larger than i */ -static void writeMatchingGraphsPlotsTCP(SyncState* const syncState, const - unsigned int i, const unsigned int j) +static void writeMatchingGraphsPlotsTCPMessages(SyncState* const syncState, + const unsigned int i, const unsigned int j) { fprintf(syncState->graphsStream, "\t\"matching_tcp-%1$03d_to_%2$03d.data\" "