comm_monitor.cc (14084:9e60f14d5f0d) comm_monitor.cc (14208:1c8f93faf08f)
1/*
1/*
2 * Copyright (c) 2012-2013, 2015, 2018 ARM Limited
2 * Copyright (c) 2012-2013, 2015, 2018-2019 ARM Limited
3 * Copyright (c) 2016 Google Inc.
4 * Copyright (c) 2017, Centre National de la Recherche Scientifique
5 * All rights reserved.
6 *
7 * The license below extends only to copyright in the software and shall
8 * not be construed as granting a license to any other intellectual
9 * property including but not limited to intellectual property relating
10 * to a hardware implementation of the functionality of the software

--- 39 unchanged lines hidden (view full) ---

50
51CommMonitor::CommMonitor(Params* params)
52 : SimObject(params),
53 masterPort(name() + "-master", *this),
54 slavePort(name() + "-slave", *this),
55 samplePeriodicEvent([this]{ samplePeriodic(); }, name()),
56 samplePeriodTicks(params->sample_period),
57 samplePeriod(params->sample_period / SimClock::Float::s),
3 * Copyright (c) 2016 Google Inc.
4 * Copyright (c) 2017, Centre National de la Recherche Scientifique
5 * All rights reserved.
6 *
7 * The license below extends only to copyright in the software and shall
8 * not be construed as granting a license to any other intellectual
9 * property including but not limited to intellectual property relating
10 * to a hardware implementation of the functionality of the software

--- 39 unchanged lines hidden (view full) ---

50
51CommMonitor::CommMonitor(Params* params)
52 : SimObject(params),
53 masterPort(name() + "-master", *this),
54 slavePort(name() + "-slave", *this),
55 samplePeriodicEvent([this]{ samplePeriodic(); }, name()),
56 samplePeriodTicks(params->sample_period),
57 samplePeriod(params->sample_period / SimClock::Float::s),
58 stats(params)
58 stats(this, params)
59{
60 DPRINTF(CommMonitor,
61 "Created monitor %s with sample period %d ticks (%f ms)\n",
62 name(), samplePeriodTicks, samplePeriod * 1E3);
63}
64
65CommMonitor*
66CommMonitorParams::create()

--- 35 unchanged lines hidden (view full) ---

102}
103
104void
105CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
106{
107 slavePort.sendFunctionalSnoop(pkt);
108}
109
59{
60 DPRINTF(CommMonitor,
61 "Created monitor %s with sample period %d ticks (%f ms)\n",
62 name(), samplePeriodTicks, samplePeriod * 1E3);
63}
64
65CommMonitor*
66CommMonitorParams::create()

--- 35 unchanged lines hidden (view full) ---

102}
103
104void
105CommMonitor::recvFunctionalSnoop(PacketPtr pkt)
106{
107 slavePort.sendFunctionalSnoop(pkt);
108}
109
110CommMonitor::MonitorStats::MonitorStats(Stats::Group *parent,
111 const CommMonitorParams *params)
112 : Stats::Group(parent),
113
114 disableBurstLengthHists(params->disable_burst_length_hists),
115 ADD_STAT(readBurstLengthHist,
116 "Histogram of burst lengths of transmitted packets"),
117 ADD_STAT(writeBurstLengthHist,
118 "Histogram of burst lengths of transmitted packets"),
119
120 disableBandwidthHists(params->disable_bandwidth_hists),
121 readBytes(0),
122 ADD_STAT(readBandwidthHist,
123 "Histogram of read bandwidth per sample period (bytes/s)"),
124 ADD_STAT(totalReadBytes, "Number of bytes read"),
125 ADD_STAT(averageReadBandwidth, "Average read bandwidth (bytes/s)",
126 totalReadBytes / simSeconds),
127
128 writtenBytes(0),
129 ADD_STAT(writeBandwidthHist, "Histogram of write bandwidth (bytes/s)"),
130 ADD_STAT(totalWrittenBytes, "Number of bytes written"),
131 ADD_STAT(averageWriteBandwidth, "Average write bandwidth (bytes/s)",
132 totalWrittenBytes / simSeconds),
133
134 disableLatencyHists(params->disable_latency_hists),
135 ADD_STAT(readLatencyHist, "Read request-response latency"),
136 ADD_STAT(writeLatencyHist, "Write request-response latency"),
137
138 disableITTDists(params->disable_itt_dists),
139 ADD_STAT(ittReadRead, "Read-to-read inter transaction time"),
140 ADD_STAT(ittWriteWrite , "Write-to-write inter transaction time"),
141 ADD_STAT(ittReqReq, "Request-to-request inter transaction time"),
142 timeOfLastRead(0), timeOfLastWrite(0), timeOfLastReq(0),
143
144 disableOutstandingHists(params->disable_outstanding_hists),
145 ADD_STAT(outstandingReadsHist, "Outstanding read transactions"),
146 outstandingReadReqs(0),
147 ADD_STAT(outstandingWritesHist, "Outstanding write transactions"),
148 outstandingWriteReqs(0),
149
150 disableTransactionHists(params->disable_transaction_hists),
151 ADD_STAT(readTransHist,
152 "Histogram of read transactions per sample period"),
153 readTrans(0),
154 ADD_STAT(writeTransHist,
155 "Histogram of write transactions per sample period"),
156 writeTrans(0),
157
158 disableAddrDists(params->disable_addr_dists),
159 readAddrMask(params->read_addr_mask),
160 writeAddrMask(params->write_addr_mask),
161 ADD_STAT(readAddrDist, "Read address distribution"),
162 ADD_STAT(writeAddrDist, "Write address distribution")
163{
164 using namespace Stats;
165
166 readBurstLengthHist
167 .init(params->burst_length_bins)
168 .flags(disableBurstLengthHists ? nozero : pdf);
169
170 writeBurstLengthHist
171 .init(params->burst_length_bins)
172 .flags(disableBurstLengthHists ? nozero : pdf);
173
174 // Stats based on received responses
175 readBandwidthHist
176 .init(params->bandwidth_bins)
177 .flags(disableBandwidthHists ? nozero : pdf);
178
179 averageReadBandwidth
180 .flags(disableBandwidthHists ? nozero : pdf);
181
182 totalReadBytes
183 .flags(disableBandwidthHists ? nozero : pdf);
184
185 // Stats based on successfully sent requests
186 writeBandwidthHist
187 .init(params->bandwidth_bins)
188 .flags(disableBandwidthHists ? (pdf | nozero) : pdf);
189
190 averageWriteBandwidth
191 .flags(disableBandwidthHists ? nozero : pdf);
192
193 totalWrittenBytes
194 .flags(disableBandwidthHists ? nozero : pdf);
195
196
197 readLatencyHist
198 .init(params->latency_bins)
199 .flags(disableLatencyHists ? nozero : pdf);
200
201 writeLatencyHist
202 .init(params->latency_bins)
203 .flags(disableLatencyHists ? nozero : pdf);
204
205 ittReadRead
206 .init(1, params->itt_max_bin, params->itt_max_bin /
207 params->itt_bins)
208 .flags(disableITTDists ? nozero : pdf);
209
210 ittWriteWrite
211 .init(1, params->itt_max_bin, params->itt_max_bin /
212 params->itt_bins)
213 .flags(disableITTDists ? nozero : pdf);
214
215 ittReqReq
216 .init(1, params->itt_max_bin, params->itt_max_bin /
217 params->itt_bins)
218 .flags(disableITTDists ? nozero : pdf);
219
220 outstandingReadsHist
221 .init(params->outstanding_bins)
222 .flags(disableOutstandingHists ? nozero : pdf);
223
224 outstandingWritesHist
225 .init(params->outstanding_bins)
226 .flags(disableOutstandingHists ? nozero : pdf);
227
228 readTransHist
229 .init(params->transaction_bins)
230 .flags(disableTransactionHists ? nozero : pdf);
231
232 writeTransHist
233 .init(params->transaction_bins)
234 .flags(disableTransactionHists ? nozero : pdf);
235
236 readAddrDist
237 .init(0)
238 .flags(disableAddrDists ? nozero : pdf);
239
240 writeAddrDist
241 .init(0)
242 .flags(disableAddrDists ? nozero : pdf);
243}
244
110void
111CommMonitor::MonitorStats::updateReqStats(
112 const ProbePoints::PacketInfo& pkt_info, bool is_atomic,
113 bool expects_response)
114{
115 if (pkt_info.cmd.isRead()) {
116 // Increment number of observed read transactions
117 if (!disableTransactionHists)

--- 257 unchanged lines hidden (view full) ---

375
376void
377CommMonitor::recvRangeChange()
378{
379 slavePort.sendRangeChange();
380}
381
382void
245void
246CommMonitor::MonitorStats::updateReqStats(
247 const ProbePoints::PacketInfo& pkt_info, bool is_atomic,
248 bool expects_response)
249{
250 if (pkt_info.cmd.isRead()) {
251 // Increment number of observed read transactions
252 if (!disableTransactionHists)

--- 257 unchanged lines hidden (view full) ---

510
511void
512CommMonitor::recvRangeChange()
513{
514 slavePort.sendRangeChange();
515}
516
517void
383CommMonitor::regStats()
384{
385 SimObject::regStats();
386
387 // Initialise all the monitor stats
388 using namespace Stats;
389
390 stats.readBurstLengthHist
391 .init(params()->burst_length_bins)
392 .name(name() + ".readBurstLengthHist")
393 .desc("Histogram of burst lengths of transmitted packets")
394 .flags(stats.disableBurstLengthHists ? nozero : pdf);
395
396 stats.writeBurstLengthHist
397 .init(params()->burst_length_bins)
398 .name(name() + ".writeBurstLengthHist")
399 .desc("Histogram of burst lengths of transmitted packets")
400 .flags(stats.disableBurstLengthHists ? nozero : pdf);
401
402 // Stats based on received responses
403 stats.readBandwidthHist
404 .init(params()->bandwidth_bins)
405 .name(name() + ".readBandwidthHist")
406 .desc("Histogram of read bandwidth per sample period (bytes/s)")
407 .flags(stats.disableBandwidthHists ? nozero : pdf);
408
409 stats.averageReadBW
410 .name(name() + ".averageReadBandwidth")
411 .desc("Average read bandwidth (bytes/s)")
412 .flags(stats.disableBandwidthHists ? nozero : pdf);
413
414 stats.totalReadBytes
415 .name(name() + ".totalReadBytes")
416 .desc("Number of bytes read")
417 .flags(stats.disableBandwidthHists ? nozero : pdf);
418
419 stats.averageReadBW = stats.totalReadBytes / simSeconds;
420
421 // Stats based on successfully sent requests
422 stats.writeBandwidthHist
423 .init(params()->bandwidth_bins)
424 .name(name() + ".writeBandwidthHist")
425 .desc("Histogram of write bandwidth (bytes/s)")
426 .flags(stats.disableBandwidthHists ? (pdf | nozero) : pdf);
427
428 stats.averageWriteBW
429 .name(name() + ".averageWriteBandwidth")
430 .desc("Average write bandwidth (bytes/s)")
431 .flags(stats.disableBandwidthHists ? nozero : pdf);
432
433 stats.totalWrittenBytes
434 .name(name() + ".totalWrittenBytes")
435 .desc("Number of bytes written")
436 .flags(stats.disableBandwidthHists ? nozero : pdf);
437
438 stats.averageWriteBW = stats.totalWrittenBytes / simSeconds;
439
440 stats.readLatencyHist
441 .init(params()->latency_bins)
442 .name(name() + ".readLatencyHist")
443 .desc("Read request-response latency")
444 .flags(stats.disableLatencyHists ? nozero : pdf);
445
446 stats.writeLatencyHist
447 .init(params()->latency_bins)
448 .name(name() + ".writeLatencyHist")
449 .desc("Write request-response latency")
450 .flags(stats.disableLatencyHists ? nozero : pdf);
451
452 stats.ittReadRead
453 .init(1, params()->itt_max_bin, params()->itt_max_bin /
454 params()->itt_bins)
455 .name(name() + ".ittReadRead")
456 .desc("Read-to-read inter transaction time")
457 .flags(stats.disableITTDists ? nozero : pdf);
458
459 stats.ittWriteWrite
460 .init(1, params()->itt_max_bin, params()->itt_max_bin /
461 params()->itt_bins)
462 .name(name() + ".ittWriteWrite")
463 .desc("Write-to-write inter transaction time")
464 .flags(stats.disableITTDists ? nozero : pdf);
465
466 stats.ittReqReq
467 .init(1, params()->itt_max_bin, params()->itt_max_bin /
468 params()->itt_bins)
469 .name(name() + ".ittReqReq")
470 .desc("Request-to-request inter transaction time")
471 .flags(stats.disableITTDists ? nozero : pdf);
472
473 stats.outstandingReadsHist
474 .init(params()->outstanding_bins)
475 .name(name() + ".outstandingReadsHist")
476 .desc("Outstanding read transactions")
477 .flags(stats.disableOutstandingHists ? nozero : pdf);
478
479 stats.outstandingWritesHist
480 .init(params()->outstanding_bins)
481 .name(name() + ".outstandingWritesHist")
482 .desc("Outstanding write transactions")
483 .flags(stats.disableOutstandingHists ? nozero : pdf);
484
485 stats.readTransHist
486 .init(params()->transaction_bins)
487 .name(name() + ".readTransHist")
488 .desc("Histogram of read transactions per sample period")
489 .flags(stats.disableTransactionHists ? nozero : pdf);
490
491 stats.writeTransHist
492 .init(params()->transaction_bins)
493 .name(name() + ".writeTransHist")
494 .desc("Histogram of write transactions per sample period")
495 .flags(stats.disableTransactionHists ? nozero : pdf);
496
497 stats.readAddrDist
498 .init(0)
499 .name(name() + ".readAddrDist")
500 .desc("Read address distribution")
501 .flags(stats.disableAddrDists ? nozero : pdf);
502
503 stats.writeAddrDist
504 .init(0)
505 .name(name() + ".writeAddrDist")
506 .desc("Write address distribution")
507 .flags(stats.disableAddrDists ? nozero : pdf);
508}
509
510void
511CommMonitor::samplePeriodic()
512{
513 // the periodic stats update runs on the granularity of sample
514 // periods, but in combination with this there may also be a
515 // external resets and dumps of the stats (through schedStatEvent)
516 // causing the stats themselves to capture less than a sample
517 // period
518

--- 34 unchanged lines hidden ---
518CommMonitor::samplePeriodic()
519{
520 // the periodic stats update runs on the granularity of sample
521 // periods, but in combination with this there may also be a
522 // external resets and dumps of the stats (through schedStatEvent)
523 // causing the stats themselves to capture less than a sample
524 // period
525

--- 34 unchanged lines hidden ---