| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca> |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify it |
| 5 | * under the terms of the GNU Lesser General Public License as published by |
| 6 | * the Free Software Foundation, either version 2.1 of the License, or (at |
| 7 | * your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 12 | * License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public License |
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #ifndef EVENT_ANALYSIS_H |
| 19 | #define EVENT_ANALYSIS_H |
| 20 | |
| 21 | #include <glib.h> |
| 22 | #include <stdio.h> |
| 23 | |
| 24 | #include "data_structures.h" |
| 25 | #include "graph_functions.h" |
| 26 | |
| 27 | |
| 28 | struct _SyncState; |
| 29 | |
| 30 | typedef struct |
| 31 | { |
| 32 | char* name; |
| 33 | |
| 34 | /* |
| 35 | * This function is called at the beginning of a synchronization run for a set |
| 36 | * of traces. Allocate analysis specific data structures. |
| 37 | */ |
| 38 | void (*initAnalysis)(struct _SyncState* const syncState); |
| 39 | |
| 40 | /* |
| 41 | * Free the analysis specific data structures. |
| 42 | */ |
| 43 | void (*destroyAnalysis)(struct _SyncState* const syncState); |
| 44 | |
| 45 | /* |
| 46 | * Perform analysis on an event pair. |
| 47 | */ |
| 48 | void (*analyzeMessage)(struct _SyncState* const syncState, Message* const |
| 49 | message); |
| 50 | |
| 51 | /* |
| 52 | * Perform analysis on multiple messages. |
| 53 | */ |
| 54 | void (*analyzeExchange)(struct _SyncState* const syncState, Exchange* const |
| 55 | exchange); |
| 56 | |
| 57 | /* |
| 58 | * Perform analysis on muliple events. |
| 59 | */ |
| 60 | void (*analyzeBroadcast)(struct _SyncState* const syncState, Broadcast* const |
| 61 | broadcast); |
| 62 | |
| 63 | /* |
| 64 | * Finalize the factor calculations. Return synchronization factors |
| 65 | * between trace pairs. |
| 66 | */ |
| 67 | AllFactors* (*finalizeAnalysis)(struct _SyncState* const syncState); |
| 68 | |
| 69 | /* |
| 70 | * Print statistics related to analysis. Is always called after |
| 71 | * finalizeAnalysis. |
| 72 | */ |
| 73 | void (*printAnalysisStats)(struct _SyncState* const syncState); |
| 74 | |
| 75 | /* |
| 76 | * Write the analysis-specific options and graph commands in the gnuplot |
| 77 | * script. Is always called after finalizeAnalysis. |
| 78 | */ |
| 79 | GraphFunctions graphFunctions; |
| 80 | } AnalysisModule; |
| 81 | |
| 82 | #endif |