changeset a1c1c3aa359b in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=a1c1c3aa359b
description:
        ruby: Use the const serialize interface in RubySystem

        The new serialization code (kudos to Tim Jones) moves all of the state
        mangling in RubySystem to memWriteback. This makes it possible to use
        the new const serialization interface.

        This changeset moves the cache recorder cleanup from the checkpoint()
        method to drainResume() to make checkpointing truly constant and
        updates the checkpointing code to use the new interface.

diffstat:

 src/mem/ruby/system/System.cc |  15 +++++++++++----
 src/mem/ruby/system/System.hh |  13 +++++++------
 2 files changed, 18 insertions(+), 10 deletions(-)

diffs (64 lines):

diff -r 40e622551656 -r a1c1c3aa359b src/mem/ruby/system/System.cc
--- a/src/mem/ruby/system/System.cc     Thu Aug 27 12:51:40 2015 -0500
+++ b/src/mem/ruby/system/System.cc     Fri Aug 28 10:58:44 2015 +0100
@@ -235,7 +235,7 @@
 }
 
 void
-RubySystem::serializeOld(CheckpointOut &cp)
+RubySystem::serialize(CheckpointOut &cp) const
 {
     // Store the cache-block size, so we are able to restore on systems with a
     // different cache-block size. CacheRecorder depends on the correct
@@ -259,10 +259,17 @@
 
     SERIALIZE_SCALAR(cache_trace_file);
     SERIALIZE_SCALAR(cache_trace_size);
+}
 
-    // Now finished with the cache recorder.
-    delete m_cache_recorder;
-    m_cache_recorder = NULL;
+void
+RubySystem::drainResume()
+{
+    // Delete the cache recorder if it was created in memWriteback()
+    // to checkpoint the current cache state.
+    if (m_cache_recorder) {
+        delete m_cache_recorder;
+        m_cache_recorder = NULL;
+    }
 }
 
 void
diff -r 40e622551656 -r a1c1c3aa359b src/mem/ruby/system/System.hh
--- a/src/mem/ruby/system/System.hh     Thu Aug 27 12:51:40 2015 -0500
+++ b/src/mem/ruby/system/System.hh     Fri Aug 28 10:58:44 2015 +0100
@@ -95,8 +95,9 @@
     void resetStats();
 
     void memWriteback();
-    void serializeOld(CheckpointOut &cp) M5_ATTR_OVERRIDE;
+    void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
     void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
+    void drainResume() M5_ATTR_OVERRIDE;
     void process();
     void startup();
     bool functionalRead(Packet *ptr);
@@ -121,11 +122,11 @@
                            uint64 cache_trace_size,
                            uint64 block_size_bytes);
 
-    void readCompressedTrace(std::string filename,
-                             uint8_t *&raw_data,
-                             uint64& uncompressed_trace_size);
-    void writeCompressedTrace(uint8_t *raw_data, std::string file,
-                              uint64 uncompressed_trace_size);
+    static void readCompressedTrace(std::string filename,
+                                    uint8_t *&raw_data,
+                                    uint64& uncompressed_trace_size);
+    static void writeCompressedTrace(uint8_t *raw_data, std::string file,
+                                     uint64 uncompressed_trace_size);
 
   private:
     // configuration parameters
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to