-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerformanceAnalysis.h
More file actions
executable file
·249 lines (225 loc) · 12.1 KB
/
PerformanceAnalysis.h
File metadata and controls
executable file
·249 lines (225 loc) · 12.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
* PerformanceAnalysis.h
* Copyright (C) 2014 LEDS - Univali <zeferino@univali.br>
* Laboratory of Embedded and Distributed Systems
* University of Vale do Itajaí
*
* Authors: Laboratory of Embedded and Distributed Systems (LEDS)
*
* Contact: Profº Dr. Cesar Albenes Zeferino {zeferino@univali.br}
*
* RedScarf is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RedScarf 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.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ------------------------------ Reviews -------------------------------------
* Date - Version - Author | Description
* ----------------------------------------------------------------------------
* 10/12/2014 - 1.0 - Eduardo Alves da Silva | Initial release
*
*/
#ifndef PERFORMANCEANALYSIS_H
#define PERFORMANCEANALYSIS_H
#include "TrafficAnalysis.h"
#include "PacketInfo.h"
#include <vector>
/*!
* \brief The PerformanceAnalysis class read log files
* and generate report files.
*
* The main function of this class is generate performance
* analysis results of packets simulated on NoC (Network-on-Chip).
* The read is run only one time.
* The latency and throughput are performed for all and individual flows
* and reports will be created.
*
* The calculations performed by this class are:
* * Average latency;
* * Accepted Traffic;
* * Standard Deviation of the latency;
* * Frequency of latencies; &
* * Ideal average latency.
*
* The reports generated by this class are:
* * Summary report, with the analysis of all flows
* * Summary latency histogram, with latency histogram of all flows
* * Summary report per traffic class of all flows
* * Summary latency histogram per traffic class of all flows
* * Report per individual flow
* * Latency histogram per individual flow
*/
class PerformanceAnalysis : public TrafficAnalysis {
private:
static const int MAX_CLASSES = 4;
static const int IDEAL_LATENCY_RNG_SIZE = 1002;
static const int MAX_FLOW_IDS = 4;
std::vector<PacketInfo* >*** packets;
unsigned int tRA;
char str[2048]; //! Auxiliary string
float idealAverageLatency; //! Ideal average latency (with none contention)
unsigned int nbOfCyclesPerRouter; //! Minimum number of cycles spent by a header in a router
unsigned int nbOfCyclesPerFlit; //! Numb. of cycles spent to send a flit (it depends on the flow control tech.)
unsigned long int accPckWithDeadline[MAX_CLASSES]; //! Counter of packes with deadline requirements
unsigned long int accMissedDeadlines[MAX_CLASSES]; //! Accumulated missed deadlines
float metDeadlinesPer[MAX_CLASSES]; //! Met deadlines
unsigned long int accLatency; //! Sum of the latencies of all the packets
float avgLatency; //! Average of all packet latencies
float stdevLatency; //! Standard deviation of latency
unsigned long int minLatency; //! Smallest latency
unsigned long int maxLatency; //! Greatest latency
unsigned long int idealLatency; //! Ideal latency (it does not take into account the network congestion)
unsigned long int idealAccLatency; //! Average of all ideal packet latencies
float accLatencyMinusAvgLatency; //! Diference beetwen the latency of a packet and the average latency
// The following variables are used to identify the frequency of latencys in a scale of 100 intervals of
// latency from the smallest latency to the greatest one, in intervals of (max_latency-min_latency)/100 cycles
unsigned long int latencyRng[100]; //! Array of latency intervals
unsigned long int latencyRngPcks[100]; //! Number of packets of latency in each interval
unsigned long int latencyRngInc; //! Size of each interval
unsigned long int idealLatencyIndex; //! Index to access each latency interval
unsigned long int idealLatencyRng[IDEAL_LATENCY_RNG_SIZE]; //! Array with the amount of latency that are X% greater than the ideal latency
// ex. rng_latency[ 0] is for latencies = ideal latency
// rng_latency[ 1] is for latencies from 1% up to 10% greater than the ideal lantency
// rng_latency[ 1] is for latencies from 11% up to 20% greater than the ideal lantency
// Variables to collect data for perfomance analysis of the NoC
float acceptedTrafficFlits; //! Traffic accepted by the network
float acceptedTrafficBps; //! Traffic accepted by the network
float accRequiredBw; //! Accumulated bandwidth required by all the packets
float avgRequiredBw; //! Avergage bandwidth required by all the packets
unsigned long int accNbOfPck; //! Sum of all the number of packets
unsigned long int simulatedTimeCycles; //! Total simulation time in cycles
unsigned long int simulatedTimeNs; //! Total simulation time in ns
unsigned long int accNbOfFlits; //! Accumulated number of flits
unsigned long int startCycle; //! First cycle of a packet
unsigned long int endCycle; //! Last cycle of a packet
unsigned long int smallestStartCycle; //! First cycle of simulation (considering only the packets to be analized) - Alternative 1: when there is no previous processing
unsigned long int smallestEndCycle; //! First cycle of simulation (considering only the packets to be analized) - Alternative 2: when a packet is created after a processing
unsigned long int biggestEndCycle; //! Last cycle of simulation (considering only the packets to be analized)
// Variables to collect data for perfomance analysis of individual flows
unsigned long int*** flowAccNbOfPck;
unsigned long int*** flowAccNbOfFlits;
unsigned long int*** flowAccRequiredBw;
float*** flowAvgRequiredBw;
float*** flowAvgRequiredBwNorm;
float*** flowAcceptedTrafficFlits;
float*** flowAcceptedTrafficBps;
unsigned long int**** flowAccPckWithDeadline;
unsigned long int**** flowAccMissedDeadlines;
float**** flowMissedDeadlinesPer;
float**** flowMetDeadlinesPer;
unsigned long int*** flowAccLatency;
float*** flowAvgLatency;
float*** flowAccLatencyMinusAvgLatency;
float*** flowStdevLatency;
unsigned long int*** flowMinLatency; //! Minimal flow latency
unsigned long int*** flowMaxLatency; //! Maximal flow latency
unsigned long int**** flowLatencyRng; //! Array of latency intervals
unsigned long int*** flowLatencyRngInc; //! Array of latency intervals
unsigned long int**** flowLatencyRngPcks; //! Number of packets of latency
// Variables to collect data for perfomance analysis of each class
unsigned long int classAccNbOfPck[MAX_CLASSES];
unsigned long int classAccNbOfFlits[MAX_CLASSES];
unsigned long int classAccRequiredBw[MAX_CLASSES];
float classAvgRequiredBw[MAX_CLASSES];
float classAvgRequiredBwNorm[MAX_CLASSES];
float classAcceptedTrafficFlits[MAX_CLASSES];
float classAcceptedTrafficBps[MAX_CLASSES];
unsigned long int classAccPckWithDeadline[MAX_CLASSES];
unsigned long int classAccMissedDeadlines[MAX_CLASSES];
float classMetDeadlinesPer[MAX_CLASSES];
unsigned long int classAccLatency[MAX_CLASSES];
float classAvgLatency[MAX_CLASSES];
float classAccLatencyMinusAvgLatency[MAX_CLASSES];
float classStdevLatency[MAX_CLASSES];
unsigned long int classMinLatency[MAX_CLASSES]; //! Minimal flow latency
unsigned long int classMaxLatency[MAX_CLASSES]; //! Maximal flow latency
unsigned long int classLatencyRng[MAX_CLASSES][100]; //! Array of latency intervals
unsigned long int classLatencyRngInc[MAX_CLASSES]; //! Array of latency intervals
unsigned long int classLatencyRngPcks[MAX_CLASSES][100];//! Number of packets of latency
float channelBwAvailable; //! It takes into account the used flow control (= channel_bw/nb_of_cycles_per_flit)
/*!
* \brief initSystemVariables Initializes attributes with default values
*/
void initSystemVariables();
protected:
/*!
* \brief readLogsFiles Read the log files generated by simulations
* and store objects for will be manipulated.
* \return The status from read files
*/
virtual StatusAnalysis readLogsFiles();
/*!
* \brief analyzeAllFlows Run performance analysis for all flows
* \return The status from analysis
*/
virtual StatusAnalysis analyzeAllFlows();
/*!
* \brief createReportsForAllFlows Write report files for all flows
* \return The status from write reports
*/
virtual StatusAnalysis createReportsForAllFlows();
/*!
* \brief analyzeIndividualFlows Run performance analysis for individuals flows
* \return The status from analysis
*/
virtual StatusAnalysis analyzeIndividualFlows();
/*!
* \brief createReportsForIndividualFlows Write report files for individual flow
* \param xDest X coordinate of the destination flow
* \param yDest Y coordinate of the destination flow
* \return The status from write reports
*/
virtual StatusAnalysis createReportsForIndividualFlows(unsigned int xDest, unsigned int yDest);
/*!
* \brief calculateIdealLatency Calculate ideal latency in relation to the
* number of links, routers and payload of packet
* \param nLinks Number of links in path
* \param nRouters Number of routers in path
* \param payload Payload of packet
* \return Ideal latency of packet
*/
virtual unsigned long int calculateIdealLatency(unsigned int nLinks,
unsigned int nRouters,
unsigned int payload);
public:
/*!
* \brief PerformanceAnalysis Constructor with parameters to be set
* attributes and allocate memory for calculations.
* \param xSize X dimension of Network
* \param ySize Y dimension of Network
* \param dataWidth Channel data width
* \param lower Initial percentual of packets discarded in analysis
* \param upper End percentual of packets discarded in analysis
* \param fClk Frequency operation (MHz) to be analyzed
* \param tClk Clock of analysis (ns)
* \param channelBw Channel bandwidth (Mbps)
* \param fifoOutDepth Fifo out depth
* \param flowControlType Flow control type
* \param workDir Read log files folder for analysis
* \param resultDir Write report files folder of analysis
*/
PerformanceAnalysis(unsigned int xSize, unsigned int ySize,
unsigned int dataWidth,float lower,float upper,
float fClk,float tClk,unsigned long int channelBw,
unsigned int fifoOutDepth,unsigned int flowControlType,
const char* workDir,const char* resultDir);
/*!
* \brief makeAnalysis Run all analysis
* \return End status from performance analysis
*/
StatusAnalysis makeAnalysis();
/*!
* \brief ~PerformanceAnalysis Destructor to be free memory
*/
virtual ~PerformanceAnalysis();
};
#endif // PERFORMANCEANALYSIS_H