AbstractController.cc (10005:8c2b0dc16ccd) AbstractController.cc (10012:ec5a5bfb941d)
1/*
2 * Copyright (c) 2011 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "mem/ruby/slicc_interface/AbstractController.hh"
30#include "mem/ruby/system/Sequencer.hh"
31#include "mem/ruby/system/System.hh"
32
33AbstractController::AbstractController(const Params *p)
1/*
2 * Copyright (c) 2011 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "mem/ruby/slicc_interface/AbstractController.hh"
30#include "mem/ruby/system/Sequencer.hh"
31#include "mem/ruby/system/System.hh"
32
33AbstractController::AbstractController(const Params *p)
34 : ClockedObject(p), Consumer(this), m_fully_busy_cycles(0),
35 m_request_count(0)
34 : ClockedObject(p), Consumer(this)
36{
37 m_version = p->version;
38 m_clusterID = p->cluster_id;
39
40 m_transitions_per_cycle = p->transitions_per_cycle;
41 m_buffer_size = p->buffer_size;
42 m_recycle_latency = p->recycle_latency;
43 m_number_of_TBEs = p->number_of_TBEs;

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

49 Stats::registerDumpCallback(new StatsCallback(this));
50 }
51}
52
53void
54AbstractController::init()
55{
56 params()->ruby_system->registerAbstractController(this);
35{
36 m_version = p->version;
37 m_clusterID = p->cluster_id;
38
39 m_transitions_per_cycle = p->transitions_per_cycle;
40 m_buffer_size = p->buffer_size;
41 m_recycle_latency = p->recycle_latency;
42 m_number_of_TBEs = p->number_of_TBEs;

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

48 Stats::registerDumpCallback(new StatsCallback(this));
49 }
50}
51
52void
53AbstractController::init()
54{
55 params()->ruby_system->registerAbstractController(this);
56 m_delayHistogram.init(10);
57 uint32_t size = Network::getNumberOfVirtualNetworks();
58 for (uint32_t i = 0; i < size; i++) {
59 m_delayVCHistogram.push_back(new Stats::Histogram());
60 m_delayVCHistogram[i]->init(10);
61 }
57}
58
59void
62}
63
64void
60AbstractController::clearStats()
65AbstractController::resetStats()
61{
66{
62 m_requestProfileMap.clear();
63 m_request_count = 0;
64
65 m_delayHistogram.clear();
66
67 m_delayHistogram.reset();
67 uint32_t size = Network::getNumberOfVirtualNetworks();
68 uint32_t size = Network::getNumberOfVirtualNetworks();
68 m_delayVCHistogram.resize(size);
69 for (uint32_t i = 0; i < size; i++) {
69 for (uint32_t i = 0; i < size; i++) {
70 m_delayVCHistogram[i].clear();
70 m_delayVCHistogram[i]->reset();
71 }
71 }
72
73 Sequencer *seq = getSequencer();
74 if (seq != NULL) {
75 seq->clearStats();
76 }
77}
78
79void
72}
73
74void
80AbstractController::profileRequest(const std::string &request)
75AbstractController::regStats()
81{
76{
82 m_request_count++;
83
84 // if it doesn't exist, conveniently, it will be created with the
85 // default value which is 0
86 m_requestProfileMap[request]++;
77 m_fully_busy_cycles
78 .name(name() + ".fully_busy_cycles")
79 .desc("cycles for which number of transistions == max transitions")
80 .flags(Stats::nozero);
87}
88
89void
90AbstractController::profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
91{
92 assert(virtualNetwork < m_delayVCHistogram.size());
81}
82
83void
84AbstractController::profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
85{
86 assert(virtualNetwork < m_delayVCHistogram.size());
93 m_delayHistogram.add(delay);
94 m_delayVCHistogram[virtualNetwork].add(delay);
87 m_delayHistogram.sample(delay);
88 m_delayVCHistogram[virtualNetwork]->sample(delay);
95}
96
97void
98AbstractController::connectWithPeer(AbstractController *c)
99{
100 getQueuesFromPeer(c);
101 c->getQueuesFromPeer(this);
102}

--- 100 unchanged lines hidden ---
89}
90
91void
92AbstractController::connectWithPeer(AbstractController *c)
93{
94 getQueuesFromPeer(c);
95 c->getQueuesFromPeer(this);
96}

--- 100 unchanged lines hidden ---