From 5383e1ada49b59daf4ff8703076923d4ccb6207d Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 27 Nov 2015 14:41:59 +0000 Subject: base: Add support for changing output directories This changeset adds support for changing the simulator output directory. This can be useful when the simulation goes through several stages (e.g., a warming phase, a simulation phase, and a verification phase) since it allows the output from each stage to be located in a different directory. Relocation is done by calling core.setOutputDir() from Python or simout.setOutputDirectory() from C++. This change affects several parts of the design of the gem5's output subsystem. First, files returned by an OutputDirectory instance (e.g., simout) are of the type OutputStream instead of a std::ostream. This allows us to do some more book keeping and control re-opening of files when the output directory is changed. Second, new subdirectories are OutputDirectory instances, which should be used to create files in that sub-directory. Signed-off-by: Andreas Sandberg [sascha.bischoff@arm.com: Rebased patches onto a newer gem5 version] Signed-off-by: Sascha Bischoff Signed-off-by: Andreas Sandberg --- src/base/vnc/vncinput.cc | 7 +++---- src/base/vnc/vncinput.hh | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/base/vnc') diff --git a/src/base/vnc/vncinput.cc b/src/base/vnc/vncinput.cc index 017fc3876..d97306f03 100644 --- a/src/base/vnc/vncinput.cc +++ b/src/base/vnc/vncinput.cc @@ -123,10 +123,9 @@ VncInput::captureFrameBuffer() const string frameFilename(frameFilenameBuffer); // create the compressed framebuffer file - ostream *fb_out = simout.create(captureOutputDirectory + frameFilename, - true); - captureBitmap->write(*fb_out); - simout.close(fb_out); + OutputStream *fb_out(captureOutputDirectory->create(frameFilename, true)); + captureBitmap->write(*fb_out->stream()); + captureOutputDirectory->close(fb_out); ++captureCurrentFrame; } diff --git a/src/base/vnc/vncinput.hh b/src/base/vnc/vncinput.hh index 96235fec7..15ddc5c58 100644 --- a/src/base/vnc/vncinput.hh +++ b/src/base/vnc/vncinput.hh @@ -52,6 +52,8 @@ #include "params/VncInput.hh" #include "sim/sim_object.hh" +class OutputDirectory; + /** * A device that expects to receive input from the vnc server should derrive * (through mulitple inheritence if necessary from VncKeyboard or VncMouse @@ -219,7 +221,7 @@ class VncInput : public SimObject int captureCurrentFrame; /** Directory to store captured frames to */ - std::string captureOutputDirectory; + OutputDirectory *captureOutputDirectory; /** Computed hash of the last captured frame */ uint64_t captureLastHash; -- cgit v1.2.3