Commit | Line | Data |
---|---|---|
08365995 | 1 | /* This file is part of the Linux Trace Toolkit viewer |
277e5b53 | 2 | * Copyright (C) 2009, 2010 Benjamin Poirier <benjamin.poirier@polymtl.ca> |
08365995 | 3 | * |
277e5b53 BP |
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. | |
08365995 | 8 | * |
277e5b53 BP |
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. | |
08365995 | 13 | * |
277e5b53 BP |
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/>. | |
08365995 BP |
16 | */ |
17 | ||
18 | #ifndef EVENT_ANALYSIS_CHULL_H | |
19 | #define EVENT_ANALYSIS_CHULL_H | |
20 | ||
21 | #include <glib.h> | |
22 | ||
10341d26 | 23 | #include "data_structures.h" |
08365995 BP |
24 | |
25 | ||
26 | typedef struct | |
27 | { | |
e96ed88f | 28 | uint64_t x, y; |
08365995 BP |
29 | } Point; |
30 | ||
31 | ||
08365995 BP |
32 | typedef struct |
33 | { | |
34 | unsigned int dropped; | |
35 | ||
0a87ec9a BP |
36 | /* allFactors is divided into three parts depending on the position of an |
37 | * element allFactors->pairFactors[i][j]: | |
08365995 BP |
38 | * Lower triangular part of the matrix |
39 | * i > j | |
40 | * This contains the factors between nodes i and j. These factors | |
41 | * convert the time values of j to time values of i. | |
42 | * Diagonal part of the matrix | |
43 | * i = j | |
44 | * This contains identity factors (a0= 0, a1= 1). | |
45 | * Upper triangular part of the matrix | |
46 | * i < j | |
0a87ec9a BP |
47 | * These factors are absent |
48 | * | |
49 | * Factor types are used as follows: | |
50 | * EXACT, | |
51 | * Used for identity factors (a0= 0, a1= 1) that map a trace to itself. In | |
52 | * this case, min, max and accuracy are not initialized. | |
53 | * | |
54 | * ACCURATE, | |
55 | * The approximation is the middle of the min and max limits. | |
56 | * | |
57 | * APPROXIMATE, | |
58 | * min and max are not available because the hulls do not respect | |
59 | * assumptions (hulls should not intersect and the upper half-hull should | |
60 | * be below the lower half-hull). The approximation is a "best effort". | |
61 | * All fields are initialized but min and max are NULL. | |
62 | * | |
63 | * INCOMPLETE, | |
64 | * min or max is available but not both. The hulls respected assumptions | |
65 | * but all receives took place after all sends or vice versa. | |
66 | * | |
67 | * ABSENT, | |
68 | * The pair of trace did not have communications in both directions (maybe | |
69 | * even no communication at all). Also used for factors in the upper | |
70 | * triangular matrix. | |
71 | * | |
72 | * SCREWED, | |
73 | * min and max are not available because the algorithms are screwed. One | |
74 | * of min or max (but not both) is NULL. The other is initialized. | |
08365995 | 75 | */ |
0a87ec9a | 76 | AllFactors* allFactors; |
08365995 BP |
77 | } AnalysisStatsCHull; |
78 | ||
79 | ||
80 | typedef struct | |
81 | { | |
82 | /* This array contains file pointers to files where hull points x-y data | |
83 | * is outputed. Each trace-pair has two files, one for each message | |
84 | * direction. The structure of the array is the same as for hullArray, | |
85 | * hullPoints[row][col] where: | |
86 | * row= inE->traceNum | |
87 | * col= outE->traceNum | |
88 | * | |
89 | * The elements on the diagonal are not initialized. | |
90 | */ | |
91 | FILE*** hullPoints; | |
92 | ||
0a87ec9a | 93 | /* This is the same array as AnalysisStatsCHull.allFactors. |
08365995 | 94 | */ |
0a87ec9a | 95 | AllFactors* allFactors; |
08365995 BP |
96 | } AnalysisGraphsDataCHull; |
97 | ||
98 | ||
99 | typedef struct | |
100 | { | |
66eaf2eb | 101 | /* Point* hullArray[traceNb][traceNb][] |
08365995 BP |
102 | * |
103 | * A message comes from two traces. The lowest numbered trace is | |
104 | * considered to be the reference clock, CA. The other is CB. The | |
105 | * direction of messages (sent or received) is relative to CA. Points are | |
106 | * formed such that their abscissa comes from CA and their ordinate from | |
107 | * CB. | |
108 | * | |
109 | * hullArray is divided into three parts depending on the position of an | |
110 | * element hullArray[i][j]: | |
111 | * Lower triangular part of the matrix | |
112 | * i > j | |
113 | * This contains the points that form lower hulls, therefore that | |
114 | * represent "sent" messages. | |
115 | * Upper triangular part of the matrix | |
116 | * i < j | |
117 | * This contains the points that form upper hulls, therefore that | |
118 | * represent "received" messages. | |
119 | * Diagonal part of the matrix | |
120 | * i = j | |
121 | * This contains empty lists | |
122 | * | |
123 | * When a message is such that: | |
124 | * inE->traceNum < outE->traceNum | |
125 | * CA is inE->traceNum, therefore the message was received and may | |
126 | * generate a point in the upper hull. Upper hulls are such that i < | |
127 | * j, therefore, i= inE->traceNum and j= outE->traceNum. | |
128 | * inE->traceNum > outE->traceNum | |
129 | * CA is outE->traceNum, therefore the message was sent and may | |
130 | * generate a point in the lower hull. Lower hulls are such that i > | |
131 | * j, therefore, i= inE->traceNum and j= outE->traceNum. Hence, we | |
132 | * always have: | |
133 | * i= inE->traceNum | |
134 | * j= outE->traceNum | |
135 | * | |
136 | * Do not let yourself get confused! Always remember that the "lower hull" | |
137 | * is in fact the "lower half" of a hull. When assumptions are respected, | |
138 | * the lower half is above the upper half. | |
139 | */ | |
140 | GQueue*** hullArray; | |
141 | ||
142 | AnalysisStatsCHull* stats; | |
143 | AnalysisGraphsDataCHull* graphsData; | |
144 | } AnalysisDataCHull; | |
145 | ||
2f961b65 | 146 | void registerAnalysisCHull(); |
66eaf2eb | 147 | |
0a87ec9a | 148 | AllFactors* calculateAllFactors(struct _SyncState* const syncState); |
66eaf2eb | 149 | |
0a87ec9a | 150 | void calculateFactorsMiddle(PairFactors* const factors); |
66eaf2eb | 151 | |
08365995 | 152 | #endif |