| 1 | /* This file is part of the Linux Trace Toolkit viewer |
| 2 | * Copyright (C) 2009 Benjamin Poirier <benjamin.poirier@polymtl.ca> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License Version 2 as |
| 6 | * published by the Free Software Foundation; |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 16 | * MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #ifndef EVENT_ANALYSIS_EVAL_H |
| 20 | #define EVENT_ANALYSIS_EVAL_H |
| 21 | |
| 22 | #ifdef HAVE_CONFIG_H |
| 23 | #include <config.h> |
| 24 | #endif |
| 25 | |
| 26 | #include <glib.h> |
| 27 | #ifdef HAVE_LIBGLPK |
| 28 | #include <glpk.h> |
| 29 | #endif |
| 30 | |
| 31 | #include "data_structures.h" |
| 32 | |
| 33 | |
| 34 | struct RttKey |
| 35 | { |
| 36 | uint32_t saddr, daddr; |
| 37 | }; |
| 38 | |
| 39 | typedef struct |
| 40 | { |
| 41 | unsigned int inversionNb, |
| 42 | tooFastNb, |
| 43 | noRTTInfoNb, |
| 44 | total; |
| 45 | } MessageStats; |
| 46 | |
| 47 | typedef struct |
| 48 | { |
| 49 | double broadcastDiffSum; |
| 50 | unsigned int broadcastNb; |
| 51 | |
| 52 | // MessageStats messageStats[traceNb][traceNb] |
| 53 | MessageStats** messageStats; |
| 54 | |
| 55 | /* double* exchangeRtt[RttKey] |
| 56 | * For this table, saddr and daddr are swapped as necessary such that |
| 57 | * saddr < daddr */ |
| 58 | GHashTable* exchangeRtt; |
| 59 | |
| 60 | #ifdef HAVE_LIBGLPK |
| 61 | /* FactorsCHull** chFactorsArray[traceNum][traceNum] |
| 62 | * FactorsCHull** lpFactorsArray[traceNum][traceNum] |
| 63 | * |
| 64 | * As usual, only the lower triangular part of theses matrixes is |
| 65 | * allocated */ |
| 66 | FactorsCHull** chFactorsArray; |
| 67 | FactorsCHull** lpFactorsArray; |
| 68 | #endif |
| 69 | } AnalysisStatsEval; |
| 70 | |
| 71 | #define BIN_NB 1001 |
| 72 | struct Bins |
| 73 | { |
| 74 | // index of min and max bins that are != 0 |
| 75 | uint32_t min, max; |
| 76 | // sum of all bins |
| 77 | uint32_t total; |
| 78 | /* bin[0]: underflow ]-INFINITY..0[ |
| 79 | * bin[1]: [0..1e-6[ |
| 80 | * rest defined exponentially, see binStart() |
| 81 | * bin[BIN_NB - 1]: overflow [1..INFINITY[ */ |
| 82 | uint32_t bin[BIN_NB]; |
| 83 | }; |
| 84 | |
| 85 | typedef struct |
| 86 | { |
| 87 | /* File pointers to files where "trip times" (message latency) histogram |
| 88 | * values are output. Each host-pair has two files, one for each message |
| 89 | * direction. As for traces, the host with the smallest address is |
| 90 | * considered to be the reference for the direction of messages (ie. |
| 91 | * messages from the host with the lowest address to the host with the |
| 92 | * largest address are "sent"). */ |
| 93 | FILE* ttSendPoints; |
| 94 | FILE* ttRecvPoints; |
| 95 | |
| 96 | struct Bins ttSendBins; |
| 97 | struct Bins ttRecvBins; |
| 98 | |
| 99 | /* File pointers to files where half round trip times (evaluated from |
| 100 | * exchanges) histogram values are output. */ |
| 101 | FILE* hrttPoints; |
| 102 | |
| 103 | struct Bins hrttBins; |
| 104 | } AnalysisHistogramEval; |
| 105 | |
| 106 | typedef struct |
| 107 | { |
| 108 | // These are the cpu times of the first and last interactions (message or |
| 109 | // broadcast) between two traces. The times are from the trace with the |
| 110 | // lowest traceNum. |
| 111 | uint64_t min, max; |
| 112 | } Bounds; |
| 113 | |
| 114 | typedef struct |
| 115 | { |
| 116 | /* AnalysisHistogramEval* graphs[RttKey]; |
| 117 | * For this table, saddr and daddr are swapped as necessary such that |
| 118 | * saddr < daddr */ |
| 119 | GHashTable* histograms; |
| 120 | |
| 121 | /* Bounds bounds[traceNum][traceNum] |
| 122 | * |
| 123 | * Only the lower triangular part of the matrix is allocated, that is |
| 124 | * bounds[i][j] where i > j */ |
| 125 | Bounds** bounds; |
| 126 | |
| 127 | #ifdef HAVE_LIBGLPK |
| 128 | /* glp_prob* lps[traceNum][traceNum] |
| 129 | * |
| 130 | * Only the lower triangular part of the matrix is allocated, that is |
| 131 | * lps[i][j] where i > j */ |
| 132 | glp_prob*** lps; |
| 133 | |
| 134 | /* Factors lpFactors[traceNum][traceNum] |
| 135 | * |
| 136 | * Only the lower triangular part of the matrix is allocated, that is |
| 137 | * lpFactorsArray[i][j] where i > j */ |
| 138 | FactorsCHull** lpFactorsArray; |
| 139 | #endif |
| 140 | } AnalysisGraphsEval; |
| 141 | |
| 142 | typedef struct |
| 143 | { |
| 144 | // double* rttInfo[RttKey] |
| 145 | GHashTable* rttInfo; |
| 146 | |
| 147 | /* The convex hull analysis is encapsulated and messages are passed to it |
| 148 | * so that it builds the convex hulls. These are reused in the linear |
| 149 | * program. */ |
| 150 | struct _SyncState* chullSS; |
| 151 | |
| 152 | AnalysisStatsEval* stats; |
| 153 | AnalysisGraphsEval* graphs; |
| 154 | } AnalysisDataEval; |
| 155 | |
| 156 | #endif |