| 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 GRAPH_FUNCTIONS_H |
| 19 | #define GRAPH_FUNCTIONS_H |
| 20 | |
| 21 | struct _SyncState; |
| 22 | |
| 23 | typedef void (GraphVariableFunction)(struct _SyncState* const syncState, const |
| 24 | unsigned int i); |
| 25 | typedef void (GraphFunction)(struct _SyncState* const syncState, const |
| 26 | unsigned int i, const unsigned int j); |
| 27 | |
| 28 | typedef struct |
| 29 | { |
| 30 | /* |
| 31 | * These functions are called at the beginning of the gnuplot script and |
| 32 | * may writes variables that can be reused in the plot or options lines |
| 33 | */ |
| 34 | GraphVariableFunction* writeVariables; |
| 35 | |
| 36 | /* |
| 37 | * All "Back" functions are called, then all "Fore" functions. They add |
| 38 | * graphs to a gnuplot "plot" command. All "Options" functions are called. |
| 39 | * They can set options via the gnuplot "set" command. Finaly, a replot is |
| 40 | * performed. This is done so that options may be set using dynamic |
| 41 | * gnuplot variables like GPVAL_X_MIN |
| 42 | */ |
| 43 | /* |
| 44 | * These next three functions ("writeTraceTrace...") are for graphs where |
| 45 | * both axes are in the scale of timestamps. |
| 46 | */ |
| 47 | GraphFunction* writeTraceTraceForePlots; |
| 48 | GraphFunction* writeTraceTraceBackPlots; |
| 49 | GraphFunction* writeTraceTraceOptions; |
| 50 | |
| 51 | /* |
| 52 | * These next three functions ("writeTraceTime...") are for graphs where |
| 53 | * the abscissa are in the scale of timestamps and the ordinate in the |
| 54 | * scale of seconds. |
| 55 | */ |
| 56 | GraphFunction* writeTraceTimeForePlots; |
| 57 | GraphFunction* writeTraceTimeBackPlots; |
| 58 | GraphFunction* writeTraceTimeOptions; |
| 59 | } GraphFunctions; |
| 60 | |
| 61 | |
| 62 | FILE* createGraphsDir(const char* const graphsDir); |
| 63 | char* changeToGraphsDir(const char* const graphsDir); |
| 64 | void writeGraphsScript(struct _SyncState* const syncState); |
| 65 | |
| 66 | #endif |