#ifndef CHECKTABLE_H
#define CHECKTABLE_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
// bool isTableFull() const;
// Need a method to select a check or retrieve a check
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private Methods
void addCheck(const Address& address);
};
// Output operator declaration
-ostream& operator<<(ostream& out, const CheckTable& obj);
+std::ostream& operator<<(std::ostream& out, const CheckTable& obj);
// ******************* Definitions *******************
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const CheckTable& obj)
+std::ostream& operator<<(std::ostream& out, const CheckTable& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
#ifndef MAP_H
#define MAP_H
+#include <iostream>
+
#include "base/hashmap.hh"
#include "mem/gems_common/Vector.hh"
template <class KEY_TYPE, class VALUE_TYPE>
class Map
{
+ private:
+ typedef typename m5::hash_map<KEY_TYPE, VALUE_TYPE> MapType;
+ typedef typename MapType::iterator iterator;
+ typedef typename MapType::const_iterator const_iterator;
+
public:
Map() { /* empty */ }
~Map() { /* empty */ }
void deleteValues();
VALUE_TYPE& lookup(const KEY_TYPE& key) const;
void clear() { m_map.clear(); }
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
// Synonyms
void remove(const KEY_TYPE& key) { erase(key); }
};
template <class KEY_TYPE, class VALUE_TYPE>
-ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map);
+std::ostream&
+operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map);
// *********************
VALUE_TYPE& Map<KEY_TYPE, VALUE_TYPE>::lookup(const KEY_TYPE& key) const
{
if (!exist(key))
- cerr << *this << " is looking for " << key << endl;
+ std::cerr << *this << " is looking for " << key << std::endl;
assert(exist(key));
return m_map[key];
}
Vector<KEY_TYPE> Map<KEY_TYPE, VALUE_TYPE>::keys() const
{
Vector<KEY_TYPE> keys;
- typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
+ const_iterator iter;
for (iter = m_map.begin(); iter != m_map.end(); iter++) {
keys.insertAtBottom((*iter).first);
}
Vector<VALUE_TYPE> Map<KEY_TYPE, VALUE_TYPE>::values() const
{
Vector<VALUE_TYPE> values;
- typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
- pair<KEY_TYPE, VALUE_TYPE> p;
+ const_iterator iter;
+ std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter;
template <class KEY_TYPE, class VALUE_TYPE>
void Map<KEY_TYPE, VALUE_TYPE>::deleteKeys()
{
- typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
- pair<KEY_TYPE, VALUE_TYPE> p;
+ const_iterator iter;
+ std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter;
template <class KEY_TYPE, class VALUE_TYPE>
void Map<KEY_TYPE, VALUE_TYPE>::deleteValues()
{
- typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
- pair<KEY_TYPE, VALUE_TYPE> p;
+ const_iterator iter;
+ std::pair<KEY_TYPE, VALUE_TYPE> p;
for (iter = m_map.begin(); iter != m_map.end(); iter++) {
p = *iter;
}
template <class KEY_TYPE, class VALUE_TYPE>
-void Map<KEY_TYPE, VALUE_TYPE>::print(ostream& out) const
+void Map<KEY_TYPE, VALUE_TYPE>::print(std::ostream& out) const
{
- typename hash_map<KEY_TYPE, VALUE_TYPE>::const_iterator iter;
- pair<KEY_TYPE, VALUE_TYPE> p;
+ const_iterator iter;
+ std::pair<KEY_TYPE, VALUE_TYPE> p;
out << "[";
for (iter = m_map.begin(); iter != m_map.end(); iter++) {
}
template <class KEY_TYPE, class VALUE_TYPE>
-ostream& operator<<(ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map)
+std::ostream&
+operator<<(std::ostream& out, const Map<KEY_TYPE, VALUE_TYPE>& map)
{
map.print(out);
return out;
#ifndef PRIOHEAP_H
#define PRIOHEAP_H
+#include <iostream>
+
#include "mem/gems_common/Vector.hh"
typedef unsigned int HeapIndex;
const TYPE& peekMin() const;
const TYPE& peekElement(int index) const;
TYPE extractMin();
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private Methods
bool verifyHeap() const;
// Output operator declaration
template <class TYPE>
-ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj);
+std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj);
// ******************* Helper Functions *******************
inline
}
template <class TYPE>
-void PrioHeap<TYPE>::print(ostream& out) const
+void PrioHeap<TYPE>::print(std::ostream& out) const
{
Vector<TYPE> copyHeap(m_heap);
// Output operator definition
template <class TYPE>
-ostream& operator<<(ostream& out, const PrioHeap<TYPE>& obj)
+std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
#ifndef REFCNT_H
#define REFCNT_H
+#include <iostream>
+
template <class TYPE>
class RefCnt {
public:
TYPE* ref() { return m_data_ptr; }
TYPE* mod_ref() const { return m_data_ptr; }
void freeRef();
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
// Public copy constructor and assignment operator
RefCnt(const RefCnt& obj);
// Output operator declaration
template <class TYPE>
inline
-ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj);
+std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj);
// ******************* Definitions *******************
template <class TYPE>
inline
-void RefCnt<TYPE>::print(ostream& out) const
+void RefCnt<TYPE>::print(std::ostream& out) const
{
if (m_data_ptr == NULL) {
out << "[RefCnt: Null]";
// Output operator definition
template <class TYPE>
inline
-ostream& operator<<(ostream& out, const RefCnt<TYPE>& obj)
+std::ostream& operator<<(std::ostream& out, const RefCnt<TYPE>& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
#ifndef VECTOR_H
#define VECTOR_H
-#include "mem/gems_common/std-includes.hh"
+#include <cassert>
+#include <iostream>
+#include <vector>
template <class TYPE>
class Vector
// elements and sets them to NULL, can only
// be used when the TYPE is a pointer type.
void removeFromTop(int num); // removes elements from top
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
// Array Reference operator overloading
};
template <class TYPE>
-ostream& operator<<(ostream& out, const Vector<TYPE>& vec);
+std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec);
// *********************
{
// FIXME - this should also decrease or shrink the size of the array at some point.
if (new_size > m_max_size) {
- grow(max((m_max_size+1)*2, new_size));
+ grow(std::max((m_max_size+1)*2, new_size));
}
m_size = new_size;
#ifndef NO_VECTOR_BOUNDS_CHECKS
{
assert(new_size >= m_size);
if (new_size >= m_max_size) {
- grow(max((m_max_size+1)*2, new_size));
+ grow(std::max((m_max_size+1)*2, new_size));
}
int old_size = m_size;
m_size = new_size;
}
template <class TYPE>
-void Vector<TYPE>::print(ostream& out) const
+void Vector<TYPE>::print(std::ostream& out) const
{
out << "[ ";
for(int i=0; i<m_size; i++) {
out << ref(i);
}
out << " ]";
- out << flush;
+ out << std::flush;
}
// Copy constructor
}
template <class TYPE>
-ostream& operator<<(ostream& out, const Vector<TYPE>& vec)
+std::ostream& operator<<(std::ostream& out, const Vector<TYPE>& vec)
{
vec.print(out);
return out;
+++ /dev/null
-/*
- * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * $Id: std-includes.hh,v 3.7 2003/02/24 21:05:24 xu Exp $
- */
-
-#ifndef INCLUDES_H
-#define INCLUDES_H
-
-#include <cstring>
-#include <iomanip>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include <ext/hash_map>
-#include <stdio.h>
-#include <math.h>
-#include <time.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <cassert>
-
-using namespace std;
-using namespace __gnu_cxx;
-
-typedef unsigned int uint;
-
-#endif //INCLUDES_H
*/
#include <cassert>
+#include <iomanip>
+#include <sstream>
#include "mem/gems_common/util.hh"
+using namespace std;
+
// Split a string into a head and tail strings on the specified
// character. Return the head and the string passed in is modified by
// removing the head, leaving just the tail.
string head = "";
string tail = "";
- uint counter = 0;
+ unsigned counter = 0;
while(counter < str.size()) {
if (str[counter] == split_character) {
counter++;
#ifndef UTIL_H
#define UTIL_H
-#include "mem/gems_common/std-includes.hh"
+#include <string>
-string string_split(string& str, char split_character);
-string bool_to_string(bool value);
-string int_to_string(int n, bool zero_fill = false, int width = 0);
-float string_to_float(string& str);
-bool string_to_bool(const string & str);
+std::string string_split(std::string& str, char split_character);
+std::string bool_to_string(bool value);
+std::string int_to_string(int n, bool zero_fill = false, int width = 0);
+float string_to_float(std::string& str);
+bool string_to_bool(const std::string & str);
int log_int(long long n);
bool is_power_of_2(long long n);
#ifndef MESSAGEBUFFER_H
#define MESSAGEBUFFER_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Consumer.hh"
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
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; }
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:
// Data Members (m_ prefix)
Consumer* m_consumer_ptr; // Consumer to signal a wakeup(), can be NULL
PrioHeap<MessageBufferNode> m_prio_heap;
- string m_name;
+ std::string m_name;
int m_max_size;
int m_size;
// Output operator declaration
//template <class TYPE>
-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;
}
#include "mem/ruby/buffers/MessageBufferNode.hh"
-void MessageBufferNode::print(ostream& out) const
+void
+MessageBufferNode::print(std::ostream& out) const
{
out << "[";
out << m_time << ", ";
#ifndef MESSAGEBUFFERNODE_H
#define MESSAGEBUFFERNODE_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/Message.hh"
//~MessageBufferNode();
// Public Methods
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private Methods
};
// Output operator declaration
-ostream& operator<<(ostream& out, const MessageBufferNode& obj);
+std::ostream& operator<<(std::ostream& out, const MessageBufferNode& obj);
// ******************* Definitions *******************
// 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;
}
#define ADDRESS_H
#include <iomanip>
+
+#include "base/hashmap.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh"
#include "mem/ruby/system/NodeID.hh"
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<Address>
{
size_t operator()(const Address &s) const { return (size_t) s.getAddress(); }
#ifndef CONSUMER_H
#define CONSUMER_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
// 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; }
// 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;
}
#ifndef DATABLOCK_H
#define DATABLOCK_H
+#include <iomanip>
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/System.hh"
#include "mem/gems_common/Vector.hh"
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();
};
// 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);
}
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++) {
// 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;
}
#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
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;
}
#define __MEM_RUBY_DEBUG_HH__
#include <unistd.h>
+
+#include <fstream>
#include <iostream>
#include <string>
#include <vector>
std::ostream& operator<<(std::ostream& out, const Debug& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
#undef ASSERT
#define ASSERT(EXPR)\
{\
+ using namespace std;\
if (ASSERT_FLAG) {\
if (!(EXPR)) {\
cerr << "failed assertion '"\
#define BREAK(X)\
{\
+ using namespace std;\
cerr << "breakpoint '"\
<< #X << "' reached at fn "\
<< __PRETTY_FUNCTION__ << " in "\
#define ERROR_MSG(MESSAGE)\
{\
+ using namespace std;\
if (ERROR_MESSAGE_FLAG) {\
cerr << "Fatal Error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
#define WARN_MSG(MESSAGE)\
{\
+ using namespace std;\
if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
#define WARN_EXPR(EXPR)\
{\
+ using namespace std;\
if (WARNING_MESSAGE_FLAG) {\
cerr << "Warning: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
#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 "\
#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 "\
#define DEBUG_NEWLINE(module, priority)\
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
if (g_debug_ptr->validDebug(module, priority)) {\
(* debug_cout_ptr) << endl << flush;\
#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;\
#define DEBUG_OUT( rest... ) \
{\
+ using namespace std;\
if (RUBY_DEBUG) {\
cout << "Debug: in fn "\
<< __PRETTY_FUNCTION__\
#define ERROR_OUT( rest... ) \
{\
+ using namespace std;\
if (ERROR_MESSAGE_FLAG) {\
cout << "error: in fn "\
<< __PRETTY_FUNCTION__ << " in "\
// 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
*
*/
+#include <cmath>
+#include <iomanip>
+
#include "mem/ruby/common/Histogram.hh"
+using namespace std;
+
Histogram::Histogram(int binsize, int bins)
{
m_binsize = binsize;
#ifndef HISTOGRAM_H
#define HISTOGRAM_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
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
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;
}
#ifndef RUBYEVENTQUEUE_H
#define RUBYEVENTQUEUE_H
+#include <iostream>
+
#include "config/no_vector_bounds_checks.hh"
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
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); }
// 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;
}
#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) {
#ifndef RUBYEVENTQUEUENODE_H
#define RUBYEVENTQUEUENODE_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "sim/eventq.hh"
#include "mem/ruby/common/Consumer.hh"
//~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"; }
};
// 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;
}
* Authors: Niket Agarwal
*/
+#include <cmath>
+
#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"
* Authors: Niket Agarwal
*/
+#include <cmath>
+
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
}
}
-void PerfectSwitch::printStats(ostream& out) const
+void PerfectSwitch::printStats(std::ostream& out) const
{
out << "PerfectSwitch printStats" << endl;
}
{
}
-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 << "]";
}
#ifndef PerfectSwitch_H
#define PerfectSwitch_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/common/Consumer.hh"
// 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
};
// 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;
}
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;
}
}
-void Switch::printConfig(ostream& out) const
+void Switch::printConfig(std::ostream& out) const
{
m_perfect_switch_ptr->printConfig(out);
for (int i=0; i<m_throttles.size(); i++) {
}
}
-void Switch::print(ostream& out) const
+void Switch::print(std::ostream& out) const
{
// FIXME printing
out << "[Switch]";
#ifndef Switch_H
#define Switch_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
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
};
// 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;
}
#include "mem/protocol/MachineType.hh"
#include "mem/protocol/Protocol.hh"
#include "mem/ruby/system/System.hh"
-#include <string>
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 :)
}
}
-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);
}
}
-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);
#ifndef TOPOLOGY_H
#define TOPOLOGY_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/system/NodeID.hh"
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
// void makeSwitchesPerChip(Vector< Vector < SwitchID > > &nodePairs, Vector<int> &latencies, Vector<int> &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;
};
// 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;
}
#ifndef CACHEPROFILER_H
#define CACHEPROFILER_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/system/NodeID.hh"
#include "mem/ruby/common/Histogram.hh"
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
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;
};
// 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;
}
#include "mem/ruby/profiler/MemCntrlProfiler.hh"
+using namespace std;
+
MemCntrlProfiler::MemCntrlProfiler(const string& description,
int banks_per_rank,
int ranks_per_dimm,
#ifndef MEM_CNTRL_PROFILER_H
#define MEM_CNTRL_PROFILER_H
+#include <iostream>
+#include <string>
+
#include "mem/gems_common/Vector.hh"
#include "mem/ruby/common/Global.hh"
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);
~MemCntrlProfiler();
// Public Methods
- void printStats(ostream& out) const;
+ void printStats(std::ostream& out) const;
void clearStats();
void profileMemReq(int bank);
void profileMemRandBusy();
void profileMemNotOld();
- void print(ostream& out) const;
+ void print(std::ostream& out) const;
private:
// Private Methods
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;
};
// 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;
}
*
*/
+// Allows use of times() library call, which determines virtual runtime
+#include <sys/resource.h>
+#include <sys/times.h>
+
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/profiler/AddressProfiler.hh"
#include "mem/ruby/system/System.hh"
#include "mem/ruby/system/System.hh"
-// Allows use of times() library call, which determines virtual runtime
-#include <sys/times.h>
-
extern std::ostream * debug_cout_ptr;
static double process_memory_total();
#ifndef CACHERECORDER_H
#define CACHERECORDER_H
-#include "mem/ruby/libruby_internal.hh"
+#include <iostream>
+#include <string>
+#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 TYPE> class PrioHeap;
class Address;
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
};
// 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;
}
{
}
-void Tracer::startTrace(string filename)
+void Tracer::startTrace(std::string filename)
{
if (m_enabled) {
stopTrace();
}
// Class method
-int Tracer::playbackTrace(string filename)
+int Tracer::playbackTrace(std::string filename)
{
igzstream in(filename.c_str());
if (in.fail()) {
return counter;
}
-void Tracer::print(ostream& out) const
+void Tracer::print(std::ostream& out) const
{
}
#ifndef TRACER_H
#define TRACER_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/libruby_internal.hh"
#include "mem/ruby/common/Global.hh"
~Tracer();
// Public Methods
- void startTrace(string filename);
+ void startTrace(std::string filename);
void stopTrace();
bool traceEnabled() { return m_enabled; }
void traceRequest(Sequencer* sequencer,
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
};
// 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;
}
#ifndef MESSAGE_H
#define MESSAGE_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/RefCnt.hh"
#include "mem/gems_common/RefCountable.hh"
// 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;}
};
// 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;
}
#ifndef MACHINEID_H
#define MACHINEID_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/util.hh"
#include "mem/protocol/MachineType.hh"
};
extern inline
-string MachineIDToString (MachineID machine) {
+std::string MachineIDToString (MachineID machine) {
return MachineType_to_string(machine.type)+"_"+int_to_string(machine.num);
}
}
// 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);
}
out << "-";
out << obj.num;
- out << flush;
+ out << std::flush;
return out;
}
#include "mem/ruby/system/MemoryNode.hh"
+using namespace std;
+
void MemoryNode::print(ostream& out) const
{
out << "[";
#ifndef MEMORYNODE_H
#define MEMORYNODE_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/Message.hh"
#include "mem/protocol/MemoryRequestType.hh"
~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)
};
// 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;
}
#ifndef NODEID_H
#define NODEID_H
+#include <string>
+
#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
#ifndef PSEUDOLRUPOLICY_H
#define PSEUDOLRUPOLICY_H
+#include <cmath>
+
#include "mem/ruby/system/AbstractReplacementPolicy.hh"
/**
#ifndef ${ident}_CONTROLLER_H
#define ${ident}_CONTROLLER_H
+#include <iostream>
+#include <sstream>
+#include <string>
+
#include "params/$c_ident.hh"
#include "mem/ruby/common/Global.hh"
# for adding information to the protocol debug trace
code('''
-extern stringstream ${ident}_transitionComment;
+extern std::stringstream ${ident}_transitionComment;
class $c_ident : public AbstractController {
#ifdef CHECK_COHERENCE
void init();
MessageBuffer* getMandatoryQueue() const;
const int & getVersion() const;
- const string toString() const;
- const string getName() const;
+ const std::string toString() const;
+ const std::string getName() const;
const MachineType getMachineType() const;
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
- void print(ostream& out) const;
- void printConfig(ostream& out) const;
+ void print(std::ostream& out) const;
+ void printConfig(std::ostream& out) const;
void wakeup();
- void printStats(ostream& out) const;
+ void printStats(std::ostream& out) const;
void clearStats();
void blockOnQueue(Address addr, MessageBuffer* port);
void unblock(Address addr);
TransitionResult doTransition(${ident}_Event event, ${ident}_State state, const Address& addr); // in ${ident}_Transitions.cc
TransitionResult doTransitionWorker(${ident}_Event event, ${ident}_State state, ${ident}_State& next_state, const Address& addr); // in ${ident}_Transitions.cc
-string m_name;
+std::string m_name;
int m_transitions_per_cycle;
int m_buffer_size;
int m_recycle_latency;
-map< string, string > m_cfg;
+map<std::string, std::string> m_cfg;
NodeID m_version;
Network* m_net_ptr;
MachineID m_machineID;
* Created by slicc definition of Module "${{self.short}}"
*/
+#include <sstream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
#include "mem/ruby/slicc_interface/RubySlicc_includes.hh"
#include "mem/protocol/${ident}_Controller.hh"
#include "mem/protocol/${ident}_Event.hh"
#include "mem/protocol/Types.hh"
#include "mem/ruby/system/System.hh"
+
+using namespace std;
''')
# include object classes
#ifndef ${ident}_PROFILER_H
#define ${ident}_PROFILER_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/protocol/${ident}_State.hh"
#include "mem/protocol/${ident}_Event.hh"
void setVersion(int version);
void countTransition(${ident}_State state, ${ident}_Event event);
void possibleTransition(${ident}_State state, ${ident}_Event event);
- void dumpStats(ostream& out) const;
+ void dumpStats(std::ostream& out) const;
void clearStats();
private:
{
m_possible[state][event] = true;
}
-void ${ident}_Profiler::dumpStats(ostream& out) const
+void ${ident}_Profiler::dumpStats(std::ostream& out) const
{
+ using namespace std;
+
out << " --- ${ident} " << m_version << " ---" << endl;
out << " - Event Counts -" << endl;
for (int event = 0; event < ${ident}_Event_NUM; event++) {
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+
#include "mem/ruby/common/Global.hh"
#include "mem/gems_common/Allocator.hh"
''')
void set${{dm.ident}}(const ${{dm.type.c_ident}}& local_${{dm.ident}}) { m_${{dm.ident}} = local_${{dm.ident}}; }
''')
- code('void print(ostream& out) const;')
+ code('void print(std::ostream& out) const;')
code.dedent()
code(' //private:')
code.indent()
code('''
// Output operator declaration
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
// Output operator definition
extern inline
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj)
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj)
{
obj.print(out);
- out << flush;
+ out << std::flush;
return out;
}
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+
+using namespace std;
''')
if self.isMessage:
#ifndef ${{self.c_ident}}_H
#define ${{self.c_ident}}_H
+#include <iostream>
+#include <string>
+
#include "mem/ruby/common/Global.hh"
/** \\enum ${{self.c_ident}}
code('''
${{self.c_ident}}_NUM
};
-${{self.c_ident}} string_to_${{self.c_ident}}(const string& str);
-string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
+${{self.c_ident}} string_to_${{self.c_ident}}(const std::string& str);
+std::string ${{self.c_ident}}_to_string(const ${{self.c_ident}}& obj);
${{self.c_ident}} &operator++(${{self.c_ident}} &e);
''')
# Trailer
code('''
-ostream& operator<<(ostream& out, const ${{self.c_ident}}& obj);
+std::ostream& operator<<(std::ostream& out, const ${{self.c_ident}}& obj);
#endif // ${{self.c_ident}}_H
''')
* Auto generated C++ code started by $__file__:$__line__
*/
+#include <iostream>
+#include <string>
+
#include "mem/protocol/${{self.c_ident}}.hh"
+using namespace std;
+
''')
if self.isMachineType: