summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/ruby/libruby.cc15
-rw-r--r--src/mem/ruby/libruby.hh14
-rw-r--r--src/mem/ruby/recorder/Tracer.cc9
-rw-r--r--src/mem/ruby/system/System.hh2
4 files changed, 35 insertions, 5 deletions
diff --git a/src/mem/ruby/libruby.cc b/src/mem/ruby/libruby.cc
index d35600960..185797f59 100644
--- a/src/mem/ruby/libruby.cc
+++ b/src/mem/ruby/libruby.cc
@@ -9,6 +9,7 @@
#include "mem/ruby/eventqueue/RubyEventQueue.hh"
#include "mem/ruby/system/MemoryVector.hh"
#include "mem/ruby/common/Address.hh"
+#include "mem/ruby/recorder/Tracer.hh"
string RubyRequestType_to_string(const RubyRequestType& obj)
{
@@ -204,6 +205,20 @@ void libruby_print_stats(std::ostream & out)
{
RubySystem::printStats(out);
}
+void libruby_playback_trace(char * trace_filename)
+{
+ RubySystem::getTracer()->playbackTrace(trace_filename);
+}
+
+void libruby_start_tracing(char * record_filename) {
+ // start the trace
+ RubySystem::getTracer()->startTrace(record_filename);
+}
+
+void libruby_stop_tracing() {
+ // start the trace
+ RubySystem::getTracer()->stopTrace();
+}
uint64_t libruby_get_time() {
return RubySystem::getCycleCount(0);
diff --git a/src/mem/ruby/libruby.hh b/src/mem/ruby/libruby.hh
index 85de794f1..5eb5e965c 100644
--- a/src/mem/ruby/libruby.hh
+++ b/src/mem/ruby/libruby.hh
@@ -102,6 +102,20 @@ void libruby_print_config(std::ostream & out);
*/
void libruby_print_stats(std::ostream & out);
+/**
+ * does not return until done
+ */
+void libruby_playback_trace(char * trace_filename);
+
+/*
+ * enables the tracer and opens the trace file
+ */
+void libruby_start_tracing(char * record_filename);
+
+/*
+ * closes the trace file
+ */
+void libruby_stop_tracing();
/**
* get time
diff --git a/src/mem/ruby/recorder/Tracer.cc b/src/mem/ruby/recorder/Tracer.cc
index d2df544d8..5b1e4274b 100644
--- a/src/mem/ruby/recorder/Tracer.cc
+++ b/src/mem/ruby/recorder/Tracer.cc
@@ -92,10 +92,11 @@ void Tracer::startTrace(string filename)
void Tracer::stopTrace()
{
- assert(m_enabled == true);
- m_trace_file.close();
- cout << "Request trace file closed." << endl;
- m_enabled = false;
+ if (m_enabled == true) {
+ m_trace_file.close();
+ cout << "Request trace file closed." << endl;
+ m_enabled = false;
+ }
}
void Tracer::traceRequest(const string & sequencer_name, const Address& data_addr, const Address& pc_addr, RubyRequestType type, Time time)
diff --git a/src/mem/ruby/system/System.hh b/src/mem/ruby/system/System.hh
index 40c425ad7..8cbeb2b0e 100644
--- a/src/mem/ruby/system/System.hh
+++ b/src/mem/ruby/system/System.hh
@@ -106,7 +106,7 @@ public:
static int getNumberOfSequencers() { return m_sequencers.size(); }
Profiler* getProfiler() {assert(m_profiler_ptr != NULL); return m_profiler_ptr; }
- Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; }
+ static Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; }
static MemoryVector* getMemoryVector() { assert(m_mem_vec_ptr != NULL); return m_mem_vec_ptr;}
void recordCacheContents(CacheRecorder& tr) const;