tracefile.cc (13253:32260b162ae7) tracefile.cc (13256:c1de139c72e5)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 23 unchanged lines hidden (view full) ---

32#include <ctime>
33#include <iomanip>
34
35#include "base/logging.hh"
36#include "base/output.hh"
37#include "sim/core.hh"
38#include "systemc/core/time.hh"
39#include "systemc/ext/core/sc_main.hh"
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 23 unchanged lines hidden (view full) ---

32#include <ctime>
33#include <iomanip>
34
35#include "base/logging.hh"
36#include "base/output.hh"
37#include "sim/core.hh"
38#include "systemc/core/time.hh"
39#include "systemc/ext/core/sc_main.hh"
40#include "systemc/ext/core/sc_time.hh"
40#include "systemc/ext/utils/functions.hh"
41
42namespace sc_gem5
43{
44
45TraceFile::TraceFile(const std::string &name) :
46 _os(simout.create(name, true, true)), timeUnitTicks(0),
41#include "systemc/ext/utils/functions.hh"
42
43namespace sc_gem5
44{
45
46TraceFile::TraceFile(const std::string &name) :
47 _os(simout.create(name, true, true)), timeUnitTicks(0),
47 timeUnitValue(1.0), timeUnitUnit(::sc_core::SC_PS), _traceDeltas(false)
48 timeUnitValue(0.0), timeUnitUnit(::sc_core::SC_PS), _traceDeltas(false)
48{}
49
50TraceFile::~TraceFile()
51{
52 simout.close(_os);
53}
54
55std::ostream &TraceFile::stream() { return *_os->stream(); }

--- 15 unchanged lines hidden (view full) ---

71 std::ostringstream ss;
72 ss << i << " " << TimeUnitNames[tu] << " (" << _os->name() << ")";
73 SC_REPORT_INFO("(I703) tracing timescale unit set", ss.str().c_str());
74}
75
76void
77TraceFile::finalizeTime()
78{
49{}
50
51TraceFile::~TraceFile()
52{
53 simout.close(_os);
54}
55
56std::ostream &TraceFile::stream() { return *_os->stream(); }

--- 15 unchanged lines hidden (view full) ---

72 std::ostringstream ss;
73 ss << i << " " << TimeUnitNames[tu] << " (" << _os->name() << ")";
74 SC_REPORT_INFO("(I703) tracing timescale unit set", ss.str().c_str());
75}
76
77void
78TraceFile::finalizeTime()
79{
79 timeUnitTicks = ::sc_core::sc_time(timeUnitValue, timeUnitUnit).value();
80 ::sc_core::sc_time time;
81 if (timeUnitValue == 0.0) {
82 // The time scale was never set. Use the global time resolution.
83 time = ::sc_core::sc_get_time_resolution();
84 } else {
85 time = ::sc_core::sc_time(timeUnitValue, timeUnitUnit);
86 }
87 timeUnitTicks = time.value();
80}
81
82} // namespace sc_gem5
88}
89
90} // namespace sc_gem5