From 140785d24c27f3afddbe95c9e504e27bf8274290 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Wed, 10 Mar 2010 18:33:11 -0800 Subject: ruby: get rid of std-includes.hh Do not use "using namespace std;" in headers Include header files as needed --- src/mem/ruby/buffers/MessageBuffer.hh | 23 ++++++++++++---------- src/mem/ruby/buffers/MessageBufferNode.cc | 3 ++- src/mem/ruby/buffers/MessageBufferNode.hh | 10 ++++++---- src/mem/ruby/common/Address.hh | 7 +++++-- src/mem/ruby/common/Consumer.hh | 10 ++++++---- src/mem/ruby/common/DataBlock.hh | 15 +++++++++----- src/mem/ruby/common/Debug.cc | 6 ++++-- src/mem/ruby/common/Debug.hh | 15 +++++++++++++- src/mem/ruby/common/Global.hh | 1 - src/mem/ruby/common/Histogram.cc | 5 +++++ src/mem/ruby/common/Histogram.hh | 14 +++++++------ src/mem/ruby/eventqueue/RubyEventQueue.hh | 10 ++++++---- src/mem/ruby/eventqueue/RubyEventQueueNode.cc | 2 +- src/mem/ruby/eventqueue/RubyEventQueueNode.hh | 10 ++++++---- .../garnet/fixed-pipeline/NetworkInterface_d.cc | 2 ++ .../garnet/flexible-pipeline/NetworkInterface.cc | 2 ++ src/mem/ruby/network/simple/PerfectSwitch.cc | 6 +++--- src/mem/ruby/network/simple/PerfectSwitch.hh | 14 +++++++------ src/mem/ruby/network/simple/Switch.cc | 8 +++++--- src/mem/ruby/network/simple/Switch.hh | 14 +++++++------ src/mem/ruby/network/simple/Topology.cc | 7 ++++--- src/mem/ruby/network/simple/Topology.hh | 21 +++++++++++--------- src/mem/ruby/profiler/CacheProfiler.hh | 17 +++++++++------- src/mem/ruby/profiler/MemCntrlProfiler.cc | 2 ++ src/mem/ruby/profiler/MemCntrlProfiler.hh | 17 +++++++++------- src/mem/ruby/profiler/Profiler.cc | 7 ++++--- src/mem/ruby/recorder/CacheRecorder.hh | 16 ++++++++------- src/mem/ruby/recorder/Tracer.cc | 6 +++--- src/mem/ruby/recorder/Tracer.hh | 15 ++++++++------ src/mem/ruby/slicc_interface/Message.hh | 10 ++++++---- src/mem/ruby/system/MachineID.hh | 11 +++++++---- src/mem/ruby/system/MemoryNode.cc | 2 ++ src/mem/ruby/system/MemoryNode.hh | 10 ++++++---- src/mem/ruby/system/NodeID.hh | 4 +++- src/mem/ruby/system/PseudoLRUPolicy.hh | 2 ++ 35 files changed, 203 insertions(+), 121 deletions(-) (limited to 'src/mem/ruby') diff --git a/src/mem/ruby/buffers/MessageBuffer.hh b/src/mem/ruby/buffers/MessageBuffer.hh index 950423ee5..8d5a8de25 100644 --- a/src/mem/ruby/buffers/MessageBuffer.hh +++ b/src/mem/ruby/buffers/MessageBuffer.hh @@ -38,6 +38,9 @@ #ifndef MESSAGEBUFFER_H #define MESSAGEBUFFER_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/buffers/MessageBufferNode.hh" #include "mem/ruby/common/Consumer.hh" @@ -49,13 +52,13 @@ class MessageBuffer { public: // Constructors - MessageBuffer(const string &name = ""); + MessageBuffer(const std::string &name = ""); // ~MessageBuffer() // Public Methods - static void printConfig(ostream& out) {} + static void printConfig(std::ostream& out) {} void setRecycleLatency(int recycle_latency) { m_recycle_latency = recycle_latency; } // TRUE if head of queue timestamp <= SystemTime @@ -73,8 +76,8 @@ public: int getPriority() { return m_priority_rank; } void setPriority(int rank) { m_priority_rank = rank; } void setConsumer(Consumer* consumer_ptr) { ASSERT(m_consumer_ptr==NULL); m_consumer_ptr = consumer_ptr; } - void setDescription(const string& name) { m_name = name; } - string getDescription() { return m_name;} + void setDescription(const std::string& name) { m_name = name; } + std::string getDescription() { return m_name;} Consumer* getConsumer() { return m_consumer_ptr; } @@ -102,8 +105,8 @@ public: void clear(); - void print(ostream& out) const; - void printStats(ostream& out); + void print(std::ostream& out) const; + void printStats(std::ostream& out); void clearStats() { m_not_avail_count = 0; m_msg_counter = 0; } private: @@ -120,7 +123,7 @@ private: // Data Members (m_ prefix) Consumer* m_consumer_ptr; // Consumer to signal a wakeup(), can be NULL PrioHeap m_prio_heap; - string m_name; + std::string m_name; int m_max_size; int m_size; @@ -145,16 +148,16 @@ private: // Output operator declaration //template -ostream& operator<<(ostream& out, const MessageBuffer& obj); +std::ostream& operator<<(std::ostream& out, const MessageBuffer& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const MessageBuffer& obj) +std::ostream& operator<<(std::ostream& out, const MessageBuffer& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/buffers/MessageBufferNode.cc b/src/mem/ruby/buffers/MessageBufferNode.cc index 22b077363..aec977acd 100644 --- a/src/mem/ruby/buffers/MessageBufferNode.cc +++ b/src/mem/ruby/buffers/MessageBufferNode.cc @@ -29,7 +29,8 @@ #include "mem/ruby/buffers/MessageBufferNode.hh" -void MessageBufferNode::print(ostream& out) const +void +MessageBufferNode::print(std::ostream& out) const { out << "["; out << m_time << ", "; diff --git a/src/mem/ruby/buffers/MessageBufferNode.hh b/src/mem/ruby/buffers/MessageBufferNode.hh index cb64974d5..747c1d889 100644 --- a/src/mem/ruby/buffers/MessageBufferNode.hh +++ b/src/mem/ruby/buffers/MessageBufferNode.hh @@ -30,6 +30,8 @@ #ifndef MESSAGEBUFFERNODE_H #define MESSAGEBUFFERNODE_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/slicc_interface/Message.hh" @@ -43,7 +45,7 @@ public: //~MessageBufferNode(); // Public Methods - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private Methods @@ -59,7 +61,7 @@ public: }; // Output operator declaration -ostream& operator<<(ostream& out, const MessageBufferNode& obj); +std::ostream& operator<<(std::ostream& out, const MessageBufferNode& obj); // ******************* Definitions ******************* @@ -78,10 +80,10 @@ bool node_less_then_eq(const MessageBufferNode& n1, const MessageBufferNode& n2) // Output operator definition extern inline -ostream& operator<<(ostream& out, const MessageBufferNode& obj) +std::ostream& operator<<(std::ostream& out, const MessageBufferNode& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/common/Address.hh b/src/mem/ruby/common/Address.hh index 88cd2668a..44dff7d83 100644 --- a/src/mem/ruby/common/Address.hh +++ b/src/mem/ruby/common/Address.hh @@ -35,6 +35,8 @@ #define ADDRESS_H #include + +#include "base/hashmap.hh" #include "mem/ruby/common/Global.hh" #include "mem/ruby/system/System.hh" #include "mem/ruby/system/NodeID.hh" @@ -223,11 +225,12 @@ ADDRESS_WIDTH MEMORY_SIZE_BITS PAGE_SIZE_BITS DATA_BLOCK_BITS inline void Address::print(ostream& out) const { - out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush; + using namespace std; + out << "[" << hex << "0x" << m_address << "," << " line 0x" << maskLowOrderBits(RubySystem::getBlockSizeBits()) << dec << "]" << flush; } class Address; -namespace __gnu_cxx { +namespace __hash_namespace { template <> struct hash
{ size_t operator()(const Address &s) const { return (size_t) s.getAddress(); } diff --git a/src/mem/ruby/common/Consumer.hh b/src/mem/ruby/common/Consumer.hh index beb50a891..955c1ffa9 100644 --- a/src/mem/ruby/common/Consumer.hh +++ b/src/mem/ruby/common/Consumer.hh @@ -39,6 +39,8 @@ #ifndef CONSUMER_H #define CONSUMER_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/eventqueue/RubyEventQueue.hh" @@ -56,7 +58,7 @@ public: // void triggerWakeup() { Time time = g_eventQueue_ptr->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }} void triggerWakeup(RubyEventQueue * eventQueue) { Time time = eventQueue->getTime(); if (m_last_wakeup != time) { wakeup(); m_last_wakeup = time; }} virtual void wakeup() = 0; - virtual void print(ostream& out) const = 0; + virtual void print(std::ostream& out) const = 0; const Time& getLastScheduledWakeup() const { return m_last_scheduled_wakeup; } void setLastScheduledWakeup(const Time& time) { m_last_scheduled_wakeup = time; } @@ -70,16 +72,16 @@ private: // Output operator declaration inline extern -ostream& operator<<(ostream& out, const Consumer& obj); +std::ostream& operator<<(std::ostream& out, const Consumer& obj); // ******************* Definitions ******************* // Output operator definition inline extern -ostream& operator<<(ostream& out, const Consumer& obj) +std::ostream& operator<<(std::ostream& out, const Consumer& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh index d62efc72b..5407033bf 100644 --- a/src/mem/ruby/common/DataBlock.hh +++ b/src/mem/ruby/common/DataBlock.hh @@ -30,6 +30,9 @@ #ifndef DATABLOCK_H #define DATABLOCK_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/system/System.hh" #include "mem/gems_common/Vector.hh" @@ -63,7 +66,7 @@ class DataBlock { void setData(uint8* data, int offset, int len); void copyPartial(const DataBlock & dblk, int offset, int len); bool equal(const DataBlock& obj) const; - void print(ostream& out) const; + void print(std::ostream& out) const; private: void alloc(); @@ -73,7 +76,7 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const DataBlock& obj); +std::ostream& operator<<(std::ostream& out, const DataBlock& obj); bool operator==(const DataBlock& obj1, const DataBlock& obj2); @@ -110,8 +113,10 @@ bool DataBlock::equal(const DataBlock& obj) const } inline -void DataBlock::print(ostream& out) const +void DataBlock::print(std::ostream& out) const { + using namespace std; + int size = RubySystem::getBlockSizeBytes(); out << "[ "; for (int i = 0; i < size; i++) { @@ -157,10 +162,10 @@ void DataBlock::copyPartial(const DataBlock & dblk, int offset, int len) // Output operator definition extern inline -ostream& operator<<(ostream& out, const DataBlock& obj) +std::ostream& operator<<(std::ostream& out, const DataBlock& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/common/Debug.cc b/src/mem/ruby/common/Debug.cc index 68ab2448b..e67dc68ba 100644 --- a/src/mem/ruby/common/Debug.cc +++ b/src/mem/ruby/common/Debug.cc @@ -41,9 +41,11 @@ #include "mem/gems_common/util.hh" #include "base/misc.hh" +using namespace std; + class Debug; extern Debug* g_debug_ptr; -std::ostream * debug_cout_ptr; +ostream *debug_cout_ptr; bool Debug::m_protocol_trace = false; struct DebugComponentData @@ -328,7 +330,7 @@ void Debug::setDebugOutputFile (const char * filename) if (m_fout.is_open() ) { m_fout.close (); } - m_fout.open (filename, std::ios::out); + m_fout.open (filename, ios::out); if (! m_fout.is_open() ) { cerr << "setDebugOutputFile: can't open file " << filename << endl; } diff --git a/src/mem/ruby/common/Debug.hh b/src/mem/ruby/common/Debug.hh index 5fb4d412f..a7b1a15d1 100644 --- a/src/mem/ruby/common/Debug.hh +++ b/src/mem/ruby/common/Debug.hh @@ -35,6 +35,8 @@ #define __MEM_RUBY_DEBUG_HH__ #include + +#include #include #include #include @@ -133,7 +135,7 @@ extern inline std::ostream& operator<<(std::ostream& out, const Debug& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } @@ -151,6 +153,7 @@ const bool ASSERT_FLAG = true; #undef ASSERT #define ASSERT(EXPR)\ {\ + using namespace std;\ if (ASSERT_FLAG) {\ if (!(EXPR)) {\ cerr << "failed assertion '"\ @@ -179,6 +182,7 @@ const bool ASSERT_FLAG = true; #define BREAK(X)\ {\ + using namespace std;\ cerr << "breakpoint '"\ << #X << "' reached at fn "\ << __PRETTY_FUNCTION__ << " in "\ @@ -195,6 +199,7 @@ const bool ASSERT_FLAG = true; #define ERROR_MSG(MESSAGE)\ {\ + using namespace std;\ if (ERROR_MESSAGE_FLAG) {\ cerr << "Fatal Error: in fn "\ << __PRETTY_FUNCTION__ << " in "\ @@ -212,6 +217,7 @@ const bool ASSERT_FLAG = true; #define WARN_MSG(MESSAGE)\ {\ + using namespace std;\ if (WARNING_MESSAGE_FLAG) {\ cerr << "Warning: in fn "\ << __PRETTY_FUNCTION__ << " in "\ @@ -228,6 +234,7 @@ const bool ASSERT_FLAG = true; #define WARN_EXPR(EXPR)\ {\ + using namespace std;\ if (WARNING_MESSAGE_FLAG) {\ cerr << "Warning: in fn "\ << __PRETTY_FUNCTION__ << " in "\ @@ -246,6 +253,7 @@ const bool ASSERT_FLAG = true; #define DEBUG_MSG(module, priority, MESSAGE)\ {\ + using namespace std;\ if (RUBY_DEBUG) {\ if (g_debug_ptr->validDebug(module, priority)) {\ (* debug_cout_ptr) << "Debug: in fn "\ @@ -259,6 +267,7 @@ const bool ASSERT_FLAG = true; #define DEBUG_EXPR(module, priority, EXPR)\ {\ + using namespace std;\ if (RUBY_DEBUG) {\ if (g_debug_ptr->validDebug(module, priority)) {\ (* debug_cout_ptr) << "Debug: in fn "\ @@ -273,6 +282,7 @@ const bool ASSERT_FLAG = true; #define DEBUG_NEWLINE(module, priority)\ {\ + using namespace std;\ if (RUBY_DEBUG) {\ if (g_debug_ptr->validDebug(module, priority)) {\ (* debug_cout_ptr) << endl << flush;\ @@ -282,6 +292,7 @@ const bool ASSERT_FLAG = true; #define DEBUG_SLICC(priority, LINE, MESSAGE)\ {\ + using namespace std;\ if (RUBY_DEBUG) {\ if (g_debug_ptr->validDebug(SLICC_COMP, priority)) {\ (* debug_cout_ptr) << (LINE) << (MESSAGE) << endl << flush;\ @@ -291,6 +302,7 @@ const bool ASSERT_FLAG = true; #define DEBUG_OUT( rest... ) \ {\ + using namespace std;\ if (RUBY_DEBUG) {\ cout << "Debug: in fn "\ << __PRETTY_FUNCTION__\ @@ -302,6 +314,7 @@ const bool ASSERT_FLAG = true; #define ERROR_OUT( rest... ) \ {\ + using namespace std;\ if (ERROR_MESSAGE_FLAG) {\ cout << "error: in fn "\ << __PRETTY_FUNCTION__ << " in "\ diff --git a/src/mem/ruby/common/Global.hh b/src/mem/ruby/common/Global.hh index 591ffed1e..16465656d 100644 --- a/src/mem/ruby/common/Global.hh +++ b/src/mem/ruby/common/Global.hh @@ -66,7 +66,6 @@ const bool TWO_LEVEL_CACHE = true; // external includes for all classes #include "mem/ruby/common/TypeDefines.hh" -#include "mem/gems_common/std-includes.hh" #include "mem/ruby/common/Debug.hh" // simple type declarations diff --git a/src/mem/ruby/common/Histogram.cc b/src/mem/ruby/common/Histogram.cc index 7f9a7027e..2a25cfeb1 100644 --- a/src/mem/ruby/common/Histogram.cc +++ b/src/mem/ruby/common/Histogram.cc @@ -32,8 +32,13 @@ * */ +#include +#include + #include "mem/ruby/common/Histogram.hh" +using namespace std; + Histogram::Histogram(int binsize, int bins) { m_binsize = binsize; diff --git a/src/mem/ruby/common/Histogram.hh b/src/mem/ruby/common/Histogram.hh index 59afde867..64247d64a 100644 --- a/src/mem/ruby/common/Histogram.hh +++ b/src/mem/ruby/common/Histogram.hh @@ -37,6 +37,8 @@ #ifndef HISTOGRAM_H #define HISTOGRAM_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" @@ -61,9 +63,9 @@ public: int64 getTotal() const { return m_sumSamples; } int64 getData(int index) const { return m_data[index]; } - void printWithMultiplier(ostream& out, double multiplier) const; - void printPercent(ostream& out) const; - void print(ostream& out) const; + void printWithMultiplier(std::ostream& out, double multiplier) const; + void printPercent(std::ostream& out) const; + void print(std::ostream& out) const; private: // Private Methods @@ -88,16 +90,16 @@ private: bool node_less_then_eq(const Histogram* n1, const Histogram* n2); // Output operator declaration -ostream& operator<<(ostream& out, const Histogram& obj); +std::ostream& operator<<(std::ostream& out, const Histogram& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Histogram& obj) +std::ostream& operator<<(std::ostream& out, const Histogram& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/eventqueue/RubyEventQueue.hh b/src/mem/ruby/eventqueue/RubyEventQueue.hh index f9b4aa060..468b21edb 100644 --- a/src/mem/ruby/eventqueue/RubyEventQueue.hh +++ b/src/mem/ruby/eventqueue/RubyEventQueue.hh @@ -59,6 +59,8 @@ #ifndef RUBYEVENTQUEUE_H #define RUBYEVENTQUEUE_H +#include + #include "config/no_vector_bounds_checks.hh" #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" @@ -82,7 +84,7 @@ public: Tick getClock() const { return m_clock; } void scheduleEvent(Consumer* consumer, Time timeDelta); void scheduleEventAbsolute(Consumer* consumer, Time timeAbs); - void print(ostream& out) const; + void print(std::ostream& out) const; void triggerEvents(Time t) { assert(0); } void triggerAllEvents() { assert(0); } @@ -99,16 +101,16 @@ private: // Output operator declaration inline extern -ostream& operator<<(ostream& out, const RubyEventQueue& obj); +std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj); // ******************* Definitions ******************* // Output operator definition inline extern -ostream& operator<<(ostream& out, const RubyEventQueue& obj) +std::ostream& operator<<(std::ostream& out, const RubyEventQueue& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc b/src/mem/ruby/eventqueue/RubyEventQueueNode.cc index 5034069cc..31aa2088a 100644 --- a/src/mem/ruby/eventqueue/RubyEventQueueNode.cc +++ b/src/mem/ruby/eventqueue/RubyEventQueueNode.cc @@ -34,7 +34,7 @@ #include "mem/ruby/eventqueue/RubyEventQueueNode.hh" -void RubyEventQueueNode::print(ostream& out) const +void RubyEventQueueNode::print(std::ostream& out) const { out << "["; if (m_consumer_ptr != NULL) { diff --git a/src/mem/ruby/eventqueue/RubyEventQueueNode.hh b/src/mem/ruby/eventqueue/RubyEventQueueNode.hh index 3b0c23162..dc2fc92e7 100644 --- a/src/mem/ruby/eventqueue/RubyEventQueueNode.hh +++ b/src/mem/ruby/eventqueue/RubyEventQueueNode.hh @@ -35,6 +35,8 @@ #ifndef RUBYEVENTQUEUENODE_H #define RUBYEVENTQUEUENODE_H +#include + #include "mem/ruby/common/Global.hh" #include "sim/eventq.hh" #include "mem/ruby/common/Consumer.hh" @@ -53,7 +55,7 @@ public: //~RubyEventQueueNode(); // Public Methods - void print(ostream& out) const; + void print(std::ostream& out) const; virtual void process() { m_consumer_ptr->wakeup(); } virtual const char *description() const { return "Ruby Event"; } @@ -68,16 +70,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const RubyEventQueueNode& obj); +std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const RubyEventQueueNode& obj) +std::ostream& operator<<(std::ostream& out, const RubyEventQueueNode& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index 26399e68e..6c61cef26 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -28,6 +28,8 @@ * Authors: Niket Agarwal */ +#include + #include "mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.hh" #include "mem/ruby/buffers/MessageBuffer.hh" #include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh" diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index 5f48d2f5e..71c433aff 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -28,6 +28,8 @@ * Authors: Niket Agarwal */ +#include + #include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh" #include "mem/ruby/buffers/MessageBuffer.hh" #include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh" diff --git a/src/mem/ruby/network/simple/PerfectSwitch.cc b/src/mem/ruby/network/simple/PerfectSwitch.cc index fab699ea4..d60c5332c 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.cc +++ b/src/mem/ruby/network/simple/PerfectSwitch.cc @@ -295,7 +295,7 @@ void PerfectSwitch::wakeup() } } -void PerfectSwitch::printStats(ostream& out) const +void PerfectSwitch::printStats(std::ostream& out) const { out << "PerfectSwitch printStats" << endl; } @@ -304,11 +304,11 @@ void PerfectSwitch::clearStats() { } -void PerfectSwitch::printConfig(ostream& out) const +void PerfectSwitch::printConfig(std::ostream& out) const { } -void PerfectSwitch::print(ostream& out) const +void PerfectSwitch::print(std::ostream& out) const { out << "[PerfectSwitch " << m_switch_id << "]"; } diff --git a/src/mem/ruby/network/simple/PerfectSwitch.hh b/src/mem/ruby/network/simple/PerfectSwitch.hh index 9cc28fff8..2956e261a 100644 --- a/src/mem/ruby/network/simple/PerfectSwitch.hh +++ b/src/mem/ruby/network/simple/PerfectSwitch.hh @@ -41,6 +41,8 @@ #ifndef PerfectSwitch_H #define PerfectSwitch_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/common/Consumer.hh" @@ -76,11 +78,11 @@ public: // Public Methods void wakeup(); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private copy constructor and assignment operator @@ -102,16 +104,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const PerfectSwitch& obj); +std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const PerfectSwitch& obj) +std::ostream& operator<<(std::ostream& out, const PerfectSwitch& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Switch.cc b/src/mem/ruby/network/simple/Switch.cc index 87021471f..88695250c 100644 --- a/src/mem/ruby/network/simple/Switch.cc +++ b/src/mem/ruby/network/simple/Switch.cc @@ -129,8 +129,10 @@ const Vector* Switch::getThrottles() const return &m_throttles; } -void Switch::printStats(ostream& out) const +void Switch::printStats(std::ostream& out) const { + using namespace std; + out << "switch_" << m_switch_id << "_inlinks: " << m_perfect_switch_ptr->getInLinks() << endl; out << "switch_" << m_switch_id << "_outlinks: " << m_perfect_switch_ptr->getOutLinks() << endl; @@ -188,7 +190,7 @@ void Switch::clearStats() } } -void Switch::printConfig(ostream& out) const +void Switch::printConfig(std::ostream& out) const { m_perfect_switch_ptr->printConfig(out); for (int i=0; i + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" @@ -68,14 +70,14 @@ public: void clearBuffers(); void reconfigureOutPort(const NetDest& routing_table_entry); - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; + void printConfig(std::ostream& out) const; // Destructor ~Switch(); - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private copy constructor and assignment operator @@ -91,16 +93,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const Switch& obj); +std::ostream& operator<<(std::ostream& out, const Switch& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Switch& obj) +std::ostream& operator<<(std::ostream& out, const Switch& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/network/simple/Topology.cc b/src/mem/ruby/network/simple/Topology.cc index e7fbe1ce3..a8ce4db84 100644 --- a/src/mem/ruby/network/simple/Topology.cc +++ b/src/mem/ruby/network/simple/Topology.cc @@ -45,7 +45,6 @@ #include "mem/protocol/MachineType.hh" #include "mem/protocol/Protocol.hh" #include "mem/ruby/system/System.hh" -#include static const int INFINITE_LATENCY = 10000; // Yes, this is a big hack static const int DEFAULT_BW_MULTIPLIER = 1; // Just to be consistent with above :) @@ -238,7 +237,7 @@ void Topology::makeLink(Network *net, SwitchID src, SwitchID dest, const NetDest } } -void Topology::printStats(ostream& out) const +void Topology::printStats(std::ostream& out) const { for (int cntrl = 0; cntrl < m_controller_vector.size(); cntrl++) { m_controller_vector[cntrl]->printStats(out); @@ -252,8 +251,10 @@ void Topology::clearStats() } } -void Topology::printConfig(ostream& out) const +void Topology::printConfig(std::ostream& out) const { + using namespace std; + if (m_print_config == false) return; assert(m_component_latencies.size() > 0); diff --git a/src/mem/ruby/network/simple/Topology.hh b/src/mem/ruby/network/simple/Topology.hh index c274ed330..7202c4446 100644 --- a/src/mem/ruby/network/simple/Topology.hh +++ b/src/mem/ruby/network/simple/Topology.hh @@ -47,6 +47,9 @@ #ifndef TOPOLOGY_H #define TOPOLOGY_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/Vector.hh" #include "mem/ruby/system/NodeID.hh" @@ -101,11 +104,11 @@ public: void initNetworkPtr(Network* net_ptr); - const string getName() { return m_name; } - void printStats(ostream& out) const; + const std::string getName() { return m_name; } + void printStats(std::ostream& out) const; void clearStats(); - void printConfig(ostream& out) const; - void print(ostream& out) const { out << "[Topology]"; } + void printConfig(std::ostream& out) const; + void print(std::ostream& out) const { out << "[Topology]"; } protected: // Private Methods @@ -117,13 +120,13 @@ protected: // void makeSwitchesPerChip(Vector< Vector < SwitchID > > &nodePairs, Vector &latencies, Vector &bw_multis, int numberOfChips); - string getDesignStr(); + std::string getDesignStr(); // Private copy constructor and assignment operator Topology(const Topology& obj); Topology& operator=(const Topology& obj); // Data Members (m_ prefix) - string m_name; + std::string m_name; bool m_print_config; NodeID m_nodes; int m_number_of_switches; @@ -141,16 +144,16 @@ protected: }; // Output operator declaration -ostream& operator<<(ostream& out, const Topology& obj); +std::ostream& operator<<(std::ostream& out, const Topology& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Topology& obj) +std::ostream& operator<<(std::ostream& out, const Topology& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/profiler/CacheProfiler.hh b/src/mem/ruby/profiler/CacheProfiler.hh index 6c5fbb988..11f189148 100644 --- a/src/mem/ruby/profiler/CacheProfiler.hh +++ b/src/mem/ruby/profiler/CacheProfiler.hh @@ -39,6 +39,9 @@ #ifndef CACHEPROFILER_H #define CACHEPROFILER_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/system/NodeID.hh" #include "mem/ruby/common/Histogram.hh" @@ -51,18 +54,18 @@ template class Vector; class CacheProfiler { public: // Constructors - CacheProfiler(const string& description); + CacheProfiler(const std::string& description); // Destructor ~CacheProfiler(); // Public Methods - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); void addStatSample(CacheRequestType requestType, AccessModeType type, int msgSize, PrefetchBit pfBit); - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private Methods @@ -71,7 +74,7 @@ private: CacheProfiler& operator=(const CacheProfiler& obj); // Data Members (m_ prefix) - string m_description; + std::string m_description; Histogram m_requestSize; int64 m_misses; int64 m_demand_misses; @@ -84,16 +87,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const CacheProfiler& obj); +std::ostream& operator<<(std::ostream& out, const CacheProfiler& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const CacheProfiler& obj) +std::ostream& operator<<(std::ostream& out, const CacheProfiler& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/profiler/MemCntrlProfiler.cc b/src/mem/ruby/profiler/MemCntrlProfiler.cc index 693d43dc7..b41d7de78 100644 --- a/src/mem/ruby/profiler/MemCntrlProfiler.cc +++ b/src/mem/ruby/profiler/MemCntrlProfiler.cc @@ -29,6 +29,8 @@ #include "mem/ruby/profiler/MemCntrlProfiler.hh" +using namespace std; + MemCntrlProfiler::MemCntrlProfiler(const string& description, int banks_per_rank, int ranks_per_dimm, diff --git a/src/mem/ruby/profiler/MemCntrlProfiler.hh b/src/mem/ruby/profiler/MemCntrlProfiler.hh index 5343fac1b..ebedd5185 100644 --- a/src/mem/ruby/profiler/MemCntrlProfiler.hh +++ b/src/mem/ruby/profiler/MemCntrlProfiler.hh @@ -39,6 +39,9 @@ #ifndef MEM_CNTRL_PROFILER_H #define MEM_CNTRL_PROFILER_H +#include +#include + #include "mem/gems_common/Vector.hh" #include "mem/ruby/common/Global.hh" @@ -47,7 +50,7 @@ template class Vector; class MemCntrlProfiler { public: // Constructors - MemCntrlProfiler(const string& description, + MemCntrlProfiler(const std::string& description, int banks_per_rank, int ranks_per_dimm, int dimms_per_channel); @@ -56,7 +59,7 @@ public: ~MemCntrlProfiler(); // Public Methods - void printStats(ostream& out) const; + void printStats(std::ostream& out) const; void clearStats(); void profileMemReq(int bank); @@ -75,7 +78,7 @@ public: void profileMemRandBusy(); void profileMemNotOld(); - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private Methods @@ -84,7 +87,7 @@ private: MemCntrlProfiler& operator=(const MemCntrlProfiler& obj); // Data Members (m_ prefix) - string m_description; + std::string m_description; uint64 m_memReq; uint64 m_memBankBusy; uint64 m_memBusBusy; @@ -107,16 +110,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const MemCntrlProfiler& obj); +std::ostream& operator<<(std::ostream& out, const MemCntrlProfiler& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const MemCntrlProfiler& obj) +std::ostream& operator<<(std::ostream& out, const MemCntrlProfiler& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc index f09b93216..33425371f 100644 --- a/src/mem/ruby/profiler/Profiler.cc +++ b/src/mem/ruby/profiler/Profiler.cc @@ -51,6 +51,10 @@ * */ +// Allows use of times() library call, which determines virtual runtime +#include +#include + #include "mem/ruby/profiler/Profiler.hh" #include "mem/ruby/profiler/AddressProfiler.hh" #include "mem/ruby/system/System.hh" @@ -65,9 +69,6 @@ #include "mem/ruby/system/System.hh" -// Allows use of times() library call, which determines virtual runtime -#include - extern std::ostream * debug_cout_ptr; static double process_memory_total(); diff --git a/src/mem/ruby/recorder/CacheRecorder.hh b/src/mem/ruby/recorder/CacheRecorder.hh index 88cc5eaca..2616f73ae 100644 --- a/src/mem/ruby/recorder/CacheRecorder.hh +++ b/src/mem/ruby/recorder/CacheRecorder.hh @@ -38,11 +38,13 @@ #ifndef CACHERECORDER_H #define CACHERECORDER_H -#include "mem/ruby/libruby_internal.hh" +#include +#include +#include "mem/protocol/CacheRequestType.hh" #include "mem/ruby/common/Global.hh" +#include "mem/ruby/libruby_internal.hh" #include "mem/ruby/system/NodeID.hh" -#include "mem/protocol/CacheRequestType.hh" template class PrioHeap; class Address; @@ -63,9 +65,9 @@ public: const Address& pc_addr, RubyRequestType type, Time time); - int dumpRecords(string filename); + int dumpRecords(std::string filename); - void print(ostream& out) const; + void print(std::ostream& out) const; private: // Private Methods @@ -78,16 +80,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const CacheRecorder& obj); +std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const CacheRecorder& obj) +std::ostream& operator<<(std::ostream& out, const CacheRecorder& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/recorder/Tracer.cc b/src/mem/ruby/recorder/Tracer.cc index b58fa1eb6..5a20c2b02 100644 --- a/src/mem/ruby/recorder/Tracer.cc +++ b/src/mem/ruby/recorder/Tracer.cc @@ -62,7 +62,7 @@ void Tracer::init() { } -void Tracer::startTrace(string filename) +void Tracer::startTrace(std::string filename) { if (m_enabled) { stopTrace(); @@ -101,7 +101,7 @@ void Tracer::traceRequest(Sequencer* sequencer, } // Class method -int Tracer::playbackTrace(string filename) +int Tracer::playbackTrace(std::string filename) { igzstream in(filename.c_str()); if (in.fail()) { @@ -147,7 +147,7 @@ int Tracer::playbackTrace(string filename) return counter; } -void Tracer::print(ostream& out) const +void Tracer::print(std::ostream& out) const { } diff --git a/src/mem/ruby/recorder/Tracer.hh b/src/mem/ruby/recorder/Tracer.hh index 16432f5fc..a068c32eb 100644 --- a/src/mem/ruby/recorder/Tracer.hh +++ b/src/mem/ruby/recorder/Tracer.hh @@ -38,6 +38,9 @@ #ifndef TRACER_H #define TRACER_H +#include +#include + #include "mem/ruby/libruby_internal.hh" #include "mem/ruby/common/Global.hh" @@ -65,7 +68,7 @@ public: ~Tracer(); // Public Methods - void startTrace(string filename); + void startTrace(std::string filename); void stopTrace(); bool traceEnabled() { return m_enabled; } void traceRequest(Sequencer* sequencer, @@ -74,10 +77,10 @@ public: RubyRequestType type, Time time); - void print(ostream& out) const; + void print(std::ostream& out) const; // Public Class Methods - int playbackTrace(string filename); + int playbackTrace(std::string filename); void init(); private: // Private Methods @@ -95,16 +98,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const Tracer& obj); +std::ostream& operator<<(std::ostream& out, const Tracer& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Tracer& obj) +std::ostream& operator<<(std::ostream& out, const Tracer& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/slicc_interface/Message.hh b/src/mem/ruby/slicc_interface/Message.hh index c8917795b..fef4bdf59 100644 --- a/src/mem/ruby/slicc_interface/Message.hh +++ b/src/mem/ruby/slicc_interface/Message.hh @@ -34,6 +34,8 @@ #ifndef MESSAGE_H #define MESSAGE_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/RefCnt.hh" #include "mem/gems_common/RefCountable.hh" @@ -53,7 +55,7 @@ public: // Public Methods virtual Message* clone() const = 0; virtual void destroy() = 0; - virtual void print(ostream& out) const = 0; + virtual void print(std::ostream& out) const = 0; void setDelayedCycles(const int& cycles) { m_DelayedCycles = cycles; } const int& getDelayedCycles() const {return m_DelayedCycles;} @@ -75,16 +77,16 @@ private: }; // Output operator declaration -ostream& operator<<(ostream& out, const Message& obj); +std::ostream& operator<<(std::ostream& out, const Message& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const Message& obj) +std::ostream& operator<<(std::ostream& out, const Message& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/system/MachineID.hh b/src/mem/ruby/system/MachineID.hh index 5bfa1584c..9da71f349 100644 --- a/src/mem/ruby/system/MachineID.hh +++ b/src/mem/ruby/system/MachineID.hh @@ -39,6 +39,9 @@ #ifndef MACHINEID_H #define MACHINEID_H +#include +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/util.hh" #include "mem/protocol/MachineType.hh" @@ -49,7 +52,7 @@ struct MachineID { }; extern inline -string MachineIDToString (MachineID machine) { +std::string MachineIDToString (MachineID machine) { return MachineType_to_string(machine.type)+"_"+int_to_string(machine.num); } @@ -66,13 +69,13 @@ bool operator!=(const MachineID & obj1, const MachineID & obj2) } // Output operator declaration -ostream& operator<<(ostream& out, const MachineID& obj); +std::ostream& operator<<(std::ostream& out, const MachineID& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const MachineID& obj) +std::ostream& operator<<(std::ostream& out, const MachineID& obj) { if ((obj.type < MachineType_NUM) && (obj.type >= MachineType_FIRST)) { out << MachineType_to_string(obj.type); @@ -81,7 +84,7 @@ ostream& operator<<(ostream& out, const MachineID& obj) } out << "-"; out << obj.num; - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/system/MemoryNode.cc b/src/mem/ruby/system/MemoryNode.cc index 3ab3d05ef..5b74f497a 100644 --- a/src/mem/ruby/system/MemoryNode.cc +++ b/src/mem/ruby/system/MemoryNode.cc @@ -28,6 +28,8 @@ #include "mem/ruby/system/MemoryNode.hh" +using namespace std; + void MemoryNode::print(ostream& out) const { out << "["; diff --git a/src/mem/ruby/system/MemoryNode.hh b/src/mem/ruby/system/MemoryNode.hh index 95d4227f9..d56057dee 100644 --- a/src/mem/ruby/system/MemoryNode.hh +++ b/src/mem/ruby/system/MemoryNode.hh @@ -28,6 +28,8 @@ #ifndef MEMORYNODE_H #define MEMORYNODE_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/ruby/slicc_interface/Message.hh" #include "mem/protocol/MemoryRequestType.hh" @@ -61,7 +63,7 @@ public: ~MemoryNode() {}; // Public Methods - void print(ostream& out) const; + void print(std::ostream& out) const; // Data Members (m_ prefix) (all public -- this is really more a struct) @@ -74,16 +76,16 @@ public: }; // Output operator declaration -ostream& operator<<(ostream& out, const MemoryNode& obj); +std::ostream& operator<<(std::ostream& out, const MemoryNode& obj); // ******************* Definitions ******************* // Output operator definition extern inline -ostream& operator<<(ostream& out, const MemoryNode& obj) +std::ostream& operator<<(std::ostream& out, const MemoryNode& obj) { obj.print(out); - out << flush; + out << std::flush; return out; } diff --git a/src/mem/ruby/system/NodeID.hh b/src/mem/ruby/system/NodeID.hh index e5d5f4d98..6191ad489 100644 --- a/src/mem/ruby/system/NodeID.hh +++ b/src/mem/ruby/system/NodeID.hh @@ -39,12 +39,14 @@ #ifndef NODEID_H #define NODEID_H +#include + #include "mem/ruby/common/Global.hh" #include "mem/gems_common/util.hh" typedef int NodeID; extern inline -string NodeIDToString (NodeID node) { return int_to_string(node); } +std::string NodeIDToString (NodeID node) { return int_to_string(node); } #endif //NODEID_H diff --git a/src/mem/ruby/system/PseudoLRUPolicy.hh b/src/mem/ruby/system/PseudoLRUPolicy.hh index 57a0b40e9..fbbe5191a 100644 --- a/src/mem/ruby/system/PseudoLRUPolicy.hh +++ b/src/mem/ruby/system/PseudoLRUPolicy.hh @@ -2,6 +2,8 @@ #ifndef PSEUDOLRUPOLICY_H #define PSEUDOLRUPOLICY_H +#include + #include "mem/ruby/system/AbstractReplacementPolicy.hh" /** -- cgit v1.2.3