+++ /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.
- */
-
-#ifndef PRIOHEAP_H
-#define PRIOHEAP_H
-
-#include <cassert>
-#include <iostream>
-#include <vector>
-
-typedef unsigned int HeapIndex;
-
-template <class TYPE>
-class PrioHeap {
-public:
- // Constructors
- PrioHeap() { init(); }
-
- // Destructor
- //~PrioHeap();
-
- // Public Methods
- void init() { m_current_size = 0; }
- int size() const { return m_current_size; }
- void insert(const TYPE& key);
- const TYPE& peekMin() const;
- const TYPE& peekElement(int index) const;
- TYPE extractMin();
- void print(std::ostream& out) const;
-private:
- // Private Methods
- bool verifyHeap() const;
- bool verifyHeap(HeapIndex index) const;
- void heapify();
-
- // Private copy constructor and assignment operator
- PrioHeap(const PrioHeap& obj);
- PrioHeap<TYPE>& operator=(const PrioHeap& obj);
-
- // Data Members (m_ prefix)
- std::vector<TYPE> m_heap;
- HeapIndex m_current_size;
-};
-
-// Output operator declaration
-template <class TYPE>
-std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj);
-
-// ******************* Helper Functions *******************
-inline
-HeapIndex get_parent(HeapIndex i)
-{
- // return (i/2);
- return (i>>1);
-}
-
-inline
-HeapIndex get_right(HeapIndex i)
-{
- // return (2*i) + 1;
- return (i<<1) | 1;
-}
-
-inline
-HeapIndex get_left(HeapIndex i)
-{
- // return (2*i);
- return (i<<1);
-}
-
-template <class TYPE>
-void prio_heap_swap(TYPE& n1, TYPE& n2)
-{
- TYPE temp = n1;
- n1 = n2;
- n2 = temp;
-}
-
-// ******************* Definitions *******************
-
-template <class TYPE>
-void PrioHeap<TYPE>::insert(const TYPE& key)
-{
- int i;
- // grow the vector size
- m_current_size++;
- m_heap.resize(m_current_size+1);
-
- if(m_current_size == 1){ // HACK: need to initialize index 0 to avoid purify UMCs
- m_heap[0] = key;
- }
-
- i = m_current_size;
- while ((i > 1) && (node_less_then_eq(key, m_heap[get_parent(i)]))) {
- m_heap[i] = m_heap[get_parent(i)];
- i = get_parent(i);
- }
- m_heap[i] = key;
- // assert(verifyHeap());
-}
-
-template <class TYPE>
-const TYPE& PrioHeap<TYPE>::peekMin() const
-{
- assert(size() > 0);
- return m_heap[1]; // 1, not 0, is the first element
-}
-
-template <class TYPE>
-const TYPE& PrioHeap<TYPE>::peekElement(int index) const
-{
- assert(size() > 0);
- return m_heap[index];
-}
-
-template <class TYPE>
-TYPE PrioHeap<TYPE>::extractMin()
-{
- // TYPE temp;
- assert(size() > 0);
- TYPE temp = m_heap[1]; // 1, not 0, is the first element
- m_heap[1] = m_heap[m_current_size];
- m_current_size--;
- heapify();
- return temp;
-}
-
-template <class TYPE>
-bool PrioHeap<TYPE>::verifyHeap() const
-{
- return verifyHeap(1);
-}
-
-template <class TYPE>
-bool PrioHeap<TYPE>::verifyHeap(HeapIndex index) const
-{
- // Recursively verify that each node is <= its parent
- if(index > m_current_size) {
- return true;
- } else if (index == 1) {
- return
- verifyHeap(get_right(index)) &&
- verifyHeap(get_left(index));
- } else if (node_less_then_eq(m_heap[get_parent(index)], m_heap[index])) {
- return
- verifyHeap(get_right(index)) &&
- verifyHeap(get_left(index));
- } else {
- // Heap property violation
- return false;
- }
-}
-
-template <class TYPE>
-void PrioHeap<TYPE>::heapify()
-{
- HeapIndex current_node = 1;
- HeapIndex left, right, smallest;
- // HeapIndex size = m_current_size;
-
- while(true) {
- left = get_left(current_node);
- right = get_right(current_node);
-
- // Find the smallest of the current node and children
- if (left <= m_current_size && node_less_then_eq(m_heap[left], m_heap[current_node])) {
- smallest = left;
- } else {
- smallest = current_node;
- }
-
- if (right <= m_current_size && node_less_then_eq(m_heap[right], m_heap[smallest])) {
- smallest = right;
- }
-
- // Check to see if we are done
- if (smallest == current_node) {
- // We are done
- break;
- } else {
- // Not done, heapify on the smallest child
- prio_heap_swap(m_heap[current_node], m_heap[smallest]);
- current_node = smallest;
- }
- }
- // assert(verifyHeap());
-}
-
-template <class TYPE>
-void PrioHeap<TYPE>::print(std::ostream& out) const
-{
- std::vector<TYPE> copyHeap(m_heap);
-
- // sort copyHeap (inefficient, but will not be done often)
-
- for(HeapIndex i=0;i<m_current_size; i++){
- for(HeapIndex j=0; j< m_current_size; j++){
- if(copyHeap[i].m_time < copyHeap[j].m_time){
- prio_heap_swap(copyHeap[i], copyHeap[j]);
- }
- }
- }
-
- out << "[PrioHeap: ";
-
- for(HeapIndex i=1; i<= m_current_size; i++){
- out << copyHeap[i];
-
- if(i != m_current_size-1){
- out << ",";
- }
- out << " ";
- }
- out << "]";
-}
-
-// Output operator definition
-template <class TYPE>
-std::ostream& operator<<(std::ostream& out, const PrioHeap<TYPE>& obj)
-{
- obj.print(out);
- out << std::flush;
- return out;
-}
-
-#endif //PRIOHEAP_H
*/
#include "base/cprintf.hh"
+#include "base/stl_helpers.hh"
#include "mem/ruby/buffers/MessageBuffer.hh"
#include "mem/ruby/system/System.hh"
using namespace std;
+using m5::stl_helpers::operator<<;
MessageBuffer::MessageBuffer(const string &name)
{
{
assert(isReady());
- return m_prio_heap.peekMin().m_msgptr->clone();
+ return m_prio_heap.front().m_msgptr->clone();
}
const Message*
m_name, g_eventQueue_ptr->getTime()));
assert(isReady());
- const Message* msg_ptr = m_prio_heap.peekMin().m_msgptr.get();
+ const Message* msg_ptr = m_prio_heap.front().m_msgptr.get();
assert(msg_ptr);
DEBUG_EXPR(QUEUE_COMP, MedPrio, *msg_ptr);
// Insert the message into the priority heap
MessageBufferNode thisNode(arrival_time, m_msg_counter, message);
- m_prio_heap.insert(thisNode);
+ m_prio_heap.push_back(thisNode);
+ push_heap(m_prio_heap.begin(), m_prio_heap.end(),
+ greater<MessageBufferNode>());
DEBUG_NEWLINE(QUEUE_COMP, HighPrio);
DEBUG_MSG(QUEUE_COMP, HighPrio,
MessageBuffer::dequeue(MsgPtr& message)
{
DEBUG_MSG(QUEUE_COMP, MedPrio, "dequeue from " + m_name);
- message = m_prio_heap.peekMin().m_msgptr;
+ message = m_prio_heap.front().m_msgptr;
pop();
DEBUG_EXPR(QUEUE_COMP, MedPrio, message);
int delay_cycles = -1; // null value
// get MsgPtr of the message about to be dequeued
- MsgPtr message = m_prio_heap.peekMin().m_msgptr;
+ MsgPtr message = m_prio_heap.front().m_msgptr;
// get the delay cycles
delay_cycles = setAndReturnDelayCycles(message);
{
DEBUG_MSG(QUEUE_COMP, MedPrio, "pop from " + m_name);
assert(isReady());
- m_prio_heap.extractMin();
+ pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
+ greater<MessageBufferNode>());
+ m_prio_heap.pop_back();
+
// record previous size and time so the current buffer size isn't
// adjusted until next cycle
if (m_time_last_time_pop < g_eventQueue_ptr->getTime()) {
void
MessageBuffer::clear()
{
- while(m_prio_heap.size() > 0){
- m_prio_heap.extractMin();
- }
-
- ASSERT(m_prio_heap.size() == 0);
+ m_prio_heap.clear();
m_msg_counter = 0;
m_size = 0;
{
DEBUG_MSG(QUEUE_COMP, MedPrio, "recycling " + m_name);
assert(isReady());
- MessageBufferNode node = m_prio_heap.extractMin();
+ MessageBufferNode node = m_prio_heap.front();
+ pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
+ greater<MessageBufferNode>());
node.m_time = g_eventQueue_ptr->getTime() + m_recycle_latency;
- m_prio_heap.insert(node);
+ m_prio_heap.back() = node;
+ push_heap(m_prio_heap.begin(), m_prio_heap.end(),
+ greater<MessageBufferNode>());
g_eventQueue_ptr->scheduleEventAbsolute(m_consumer_ptr,
g_eventQueue_ptr->getTime() + m_recycle_latency);
}
if (m_consumer_ptr != NULL) {
out << " consumer-yes ";
}
- out << m_prio_heap << "] " << m_name << endl;
+
+ vector<MessageBufferNode> copy(m_prio_heap);
+ sort_heap(copy.begin(), copy.end(), greater<MessageBufferNode>());
+ out << copy << "] " << m_name << endl;
}
void
#ifndef __MEM_RUBY_BUFFERS_MESSAGEBUFFER_HH__
#define __MEM_RUBY_BUFFERS_MESSAGEBUFFER_HH__
+#include <algorithm>
+#include <functional>
#include <iostream>
+#include <vector>
#include <string>
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/buffers/MessageBufferNode.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/common/Global.hh"
isReady() const
{
return ((m_prio_heap.size() > 0) &&
- (m_prio_heap.peekMin().m_time <= g_eventQueue_ptr->getTime()));
+ (m_prio_heap.front().m_time <= g_eventQueue_ptr->getTime()));
}
void
delayHead()
{
- MessageBufferNode node = m_prio_heap.extractMin();
+ MessageBufferNode node = m_prio_heap.front();
+ std::pop_heap(m_prio_heap.begin(), m_prio_heap.end(),
+ std::greater<MessageBufferNode>());
+ m_prio_heap.pop_back();
enqueue(node.m_msgptr, 1);
}
peekMsgPtr() const
{
assert(isReady());
- return m_prio_heap.peekMin().m_msgptr;
+ return m_prio_heap.front().m_msgptr;
}
const MsgPtr&
peekMsgPtrEvenIfNotReady() const
{
- return m_prio_heap.peekMin().m_msgptr;
+ return m_prio_heap.front().m_msgptr;
}
void enqueue(MsgPtr message) { enqueue(message, 1); }
// Data Members (m_ prefix)
Consumer* m_consumer_ptr; // Consumer to signal a wakeup(), can be NULL
- PrioHeap<MessageBufferNode> m_prio_heap;
+ std::vector<MessageBufferNode> m_prio_heap;
std::string m_name;
int m_max_size;
};
inline bool
-node_less_then_eq(const MessageBufferNode& n1, const MessageBufferNode& n2)
+operator>(const MessageBufferNode& n1, const MessageBufferNode& n2)
{
if (n1.m_time == n2.m_time) {
assert(n1.m_msg_counter != n2.m_msg_counter);
- return (n1.m_msg_counter <= n2.m_msg_counter);
+ return n1.m_msg_counter > n2.m_msg_counter;
} else {
- return (n1.m_time <= n2.m_time);
+ return n1.m_time > n2.m_time;
}
}
#include "sim/eventq.hh"
class Consumer;
-template <class TYPE> class PrioHeap;
class RubyEventQueueNode;
class RubyEventQueue : public EventManager
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/orion/power_bus.hh"
class GarnetNetwork_d;
{
if(m_buffer.size() != 0 )
{
- flit_d *t_flit = m_buffer.peekMin();
+ flit_d *t_flit = peekTopFlit();
if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
return true;
}
{
if(m_buffer.size() != 0 )
{
- flit_d *t_flit = m_buffer.peekMin();
+ flit_d *t_flit = peekTopFlit();
if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
return true;
}
#ifndef FLIT_BUFFER_D_H
#define FLIT_BUFFER_D_H
+#include <algorithm>
#include <iostream>
+#include <vector>
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
class flitBuffer_d {
inline flit_d* getTopFlit()
{
- return m_buffer.extractMin();
+ flit_d *f = m_buffer.front();
+ std::pop_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
+ m_buffer.pop_back();
+ return f;
}
inline flit_d* peekTopFlit()
{
- return m_buffer.peekMin();
+ return m_buffer.front();
}
inline void insert(flit_d *flt)
{
- m_buffer.insert(flt);
+ m_buffer.push_back(flt);
+ std::push_heap(m_buffer.begin(), m_buffer.end(), flit_d::greater);
}
/**********Data Members*********/
private:
- PrioHeap <flit_d *> m_buffer;
+ std::vector<flit_d *> m_buffer;
int size, max_size;
};
return src_delay;
}
+ static bool
+ greater(flit_d* n1, flit_d* n2)
+ {
+ if (n1->get_time() == n2->get_time()) {
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ } else {
+ return (n1->get_time() > n2->get_time());
+ }
+ }
private:
/************Data Members*************/
};
-inline extern bool node_less_then_eq(flit_d* n1, flit_d* n2);
-
-inline extern
-bool node_less_then_eq(flit_d* n1, flit_d* n2)
-{
- if (n1->get_time() == n2->get_time()) {
-// ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() <= n2->get_id());
- } else {
- return (n1->get_time() <= n2->get_time());
- }
-}
-
inline std::ostream&
operator<<(std::ostream& out, const flit_d& obj)
{
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/common/NetDest.hh"
class GarnetNetwork;
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/FlexibleConsumer.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/NetworkLink.hh"
#include "mem/ruby/common/NetDest.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
flit_type get_type();
void print(std::ostream& out) const;
+ static bool
+ greater(flit* n1, flit* n2)
+ {
+ if (n1->get_time() == n2->get_time())
+ //ASSERT(n1->flit_id != n2->flit_id);
+ return (n1->get_id() > n2->get_id());
+ else
+ return (n1->get_time() > n2->get_time());
+ }
+
private:
/************Data Members*************/
int m_id;
};
-inline extern bool node_less_then_eq(flit* n1, flit* n2);
-
-inline extern
-bool node_less_then_eq(flit* n1, flit* n2)
-{
- if (n1->get_time() == n2->get_time()) {
-// ASSERT(n1->flit_id != n2->flit_id);
- return (n1->get_id() <= n2->get_id());
- } else {
- return (n1->get_time() <= n2->get_time());
- }
-}
-
inline std::ostream&
operator<<(std::ostream& out, const flit& obj)
{
* Authors: Niket Agarwal
*/
+#include <algorithm>
+
#include "mem/ruby/network/garnet/flexible-pipeline/flitBuffer.hh"
+using namespace std;
+
flitBuffer::flitBuffer()
{
max_size = INFINITE_;
{
if(m_buffer.size() != 0 )
{
- flit *t_flit = m_buffer.peekMin();
+ flit *t_flit = m_buffer.front();
if(t_flit->get_time() <= g_eventQueue_ptr->getTime())
return true;
}
{
if(m_buffer.size() != 0 )
{
- flit *t_flit = m_buffer.peekMin();
+ flit *t_flit = m_buffer.front();
if(t_flit->get_time() <= (g_eventQueue_ptr->getTime() + 1))
return true;
}
flit* flitBuffer:: getTopFlit()
{
- return m_buffer.extractMin();
+ flit *f = m_buffer.front();
+ pop_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
+ m_buffer.pop_back();
+ return f;
}
flit* flitBuffer::peekTopFlit()
{
- return m_buffer.peekMin();
+ return m_buffer.front();
}
void flitBuffer::insert(flit *flt)
{
- m_buffer.insert(flt);
+ m_buffer.push_back(flt);
+ push_heap(m_buffer.begin(), m_buffer.end(), flit::greater);
}
void flitBuffer::print(std::ostream& out) const
#define FLIT_BUFFER_H
#include <iostream>
+#include <vector>
#include "mem/ruby/network/garnet/NetworkHeader.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/network/garnet/flexible-pipeline/flit.hh"
class flitBuffer {
/**********Data Members*********/
private:
- PrioHeap <flit *> m_buffer;
+ std::vector<flit *> m_buffer;
int size, max_size;
};
void print(std::ostream& out) const;
+ static inline bool
+ less_equal(const AccessTraceForAddress* n1,
+ const AccessTraceForAddress* n2)
+ {
+ return n1->getTotal() <= n2->getTotal();
+ }
+
private:
Address m_addr;
uint64 m_loads;
Histogram* m_histogram_ptr;
};
-inline bool
-node_less_then_eq(const AccessTraceForAddress* n1,
- const AccessTraceForAddress* n2)
-{
- return n1->getTotal() > n2->getTotal();
-}
-
inline std::ostream&
operator<<(std::ostream& out, const AccessTraceForAddress& obj)
{
#include <vector>
#include "base/stl_helpers.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/protocol/CacheMsg.hh"
#include "mem/ruby/profiler/AddressProfiler.hh"
#include "mem/ruby/profiler/Profiler.hh"
const int records_printed = 100;
uint64 misses = 0;
- PrioHeap<const AccessTraceForAddress*> heap;
+ std::vector<const AccessTraceForAddress *> sorted;
AddressMap::const_iterator i = record_map.begin();
AddressMap::const_iterator end = record_map.end();
for (; i != end; ++i) {
const AccessTraceForAddress* record = &i->second;
misses += record->getTotal();
- heap.insert(record);
+ sorted.push_back(record);
}
+ sort(sorted.begin(), sorted.end(), AccessTraceForAddress::less_equal);
out << "Total_entries_" << description << ": " << record_map.size()
<< endl;
}
int counter = 0;
- while (heap.size() > 0 && counter < records_printed) {
- const AccessTraceForAddress* record = heap.extractMin();
+ int max = sorted.size();
+ while (counter < max && counter < records_printed) {
+ const AccessTraceForAddress* record = sorted[counter];
double percent = 100.0 * (record->getTotal() / double(misses));
out << description << " | " << percent << " % " << *record << endl;
all_records.add(record->getTotal());
m_touched_weighted_vec[record->getTouchedBy()] += record->getTotal();
}
- while (heap.size() > 0) {
- const AccessTraceForAddress* record = heap.extractMin();
+ while (counter < max) {
+ const AccessTraceForAddress* record = sorted[counter];
all_records.add(record->getTotal());
remaining_records.add(record->getTotal());
all_records_log.add(record->getTotal());
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/profiler/CacheProfiler.hh"
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/system/System.hh"
#include "base/stl_helpers.hh"
#include "base/str.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/protocol/CacheMsg.hh"
#include "mem/protocol/MachineType.hh"
#include "mem/protocol/Protocol.hh"
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+
#include "gzstream.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/recorder/CacheRecorder.hh"
-#include "mem/ruby/recorder/TraceRecord.hh"
using namespace std;
-CacheRecorder::CacheRecorder()
-{
- m_records_ptr = new PrioHeap<TraceRecord>;
-}
-
-CacheRecorder::~CacheRecorder()
-{
- delete m_records_ptr;
-}
-
void
CacheRecorder::addRecord(Sequencer* sequencer, const Address& data_addr,
const Address& pc_addr, RubyRequestType type, Time time)
{
- m_records_ptr->
- insert(TraceRecord(sequencer, data_addr, pc_addr, type, time));
+ TraceRecord rec(sequencer, data_addr, pc_addr, type, time);
+ m_records.push_back(rec);
}
int
return 0;
}
- int counter = 0;
- while (m_records_ptr->size() != 0) {
- TraceRecord record = m_records_ptr->extractMin();
- record.output(out);
- counter++;
- }
- return counter;
+ std::sort(m_records.begin(), m_records.end(), greater<TraceRecord>());
+
+ int size = m_records.size();
+ for (int i = 0; i < size; ++i)
+ m_records[i].output(out);
+
+ m_records.clear();
+
+ return size;
}
void
#include <iostream>
#include <string>
+#include <vector>
#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/ruby/recorder/TraceRecord.hh"
-template <class TYPE> class PrioHeap;
class Address;
class TraceRecord;
class Sequencer;
class CacheRecorder
{
public:
- CacheRecorder();
- ~CacheRecorder();
-
void addRecord(Sequencer* sequencer, const Address& data_addr,
const Address& pc_addr, RubyRequestType type, Time time);
int dumpRecords(std::string filename);
CacheRecorder(const CacheRecorder& obj);
CacheRecorder& operator=(const CacheRecorder& obj);
- PrioHeap<TraceRecord>* m_records_ptr;
+ std::vector<TraceRecord> m_records;
};
inline std::ostream&
TraceRecord(const TraceRecord& obj);
TraceRecord& operator=(const TraceRecord& obj);
- bool
- node_less_then_eq(const TraceRecord& rec) const
- {
- return this->m_time <= rec.m_time;
- }
-
void issueRequest() const;
void print(std::ostream& out) const;
bool input(std::istream& in);
private:
+ friend bool operator>(const TraceRecord& n1, const TraceRecord& n2);
+
Sequencer* m_sequencer_ptr;
Time m_time;
Address m_data_address;
};
inline bool
-node_less_then_eq(const TraceRecord& n1, const TraceRecord& n2)
+operator>(const TraceRecord& n1, const TraceRecord& n2)
{
- return n1.node_less_then_eq(n2);
+ return n1.m_time > n2.m_time;
}
inline std::ostream&
*/
#include "base/cprintf.hh"
-#include "mem/gems_common/PrioHeap.hh"
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/recorder/TraceRecord.hh"
#include "mem/ruby/recorder/Tracer.hh"
#include "params/RubyTracer.hh"
#include "sim/sim_object.hh"
-template <class TYPE> class PrioHeap;
class Address;
class TraceRecord;
class Sequencer;