From c9f2aa8c1888aef0f383bdda0ce6d7d7b5a0c7fc Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 15 Jan 2004 16:33:58 -0500 Subject: Make each stat take up one full line. This allows us to use grep to find and remove stats from the files so we can put less burden on the python interpreter. base/statistics.cc: Manually insert newlines into the python code so that we now have one stat per line. (Make it so we can use grep -v to remove stats) test/stattest.cc: update to reflect changes in how python is accessed --HG-- extra : convert_revision : 554edcf9c795b33d00d3d15554447c8accebebfa --- base/statistics.cc | 58 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 23 deletions(-) (limited to 'base') diff --git a/base/statistics.cc b/base/statistics.cc index 5c9a2bc65..298cc9a36 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -116,7 +116,7 @@ Data::~Data() { if (stream) { delete py; - ccprintf(*stream, "if __name__ == '__main__':\n"); + ccprintf(*stream, "\n\nif __name__ == '__main__':\n"); ccprintf(*stream, " program_display()\n"); stream->close(); delete stream; @@ -209,30 +209,42 @@ Data::python_dump(const string &name, const string &subname) ++i; } } - py->next(); +// py->next(); } void Data::python(const string &name, const string &subname, const string &bin) { - py->start("collections.append"); - py->start("Collection"); + py->name("collections.append"); + py->newline(); + py->name("Collection"); + py->newline(); py->qarg(name); + py->newline(); py->qarg(subname); + py->newline(); py->qarg(bin); + py->newline(); py->qarg(hostname()); + py->newline(); py->qarg(Time::start.date()); - py->startList(); + py->newline(); + py->list(); list_t::iterator i = allStats.begin(); list_t::iterator end = allStats.end(); while (i != end) { StatData *stat = *i; + py->newline(); stat->python(*py); ++i; } - py->endList(); - py->end(); - py->end(); + py->newline(); + py->listEnd(); + py->newline(); + py->nameEnd(); + py->newline(); + py->nameEnd(); + py->newline(); } StatData * @@ -996,7 +1008,7 @@ VectorDistDataBase::display(ostream &stream, DisplayMode mode) const void ScalarDataBase::python(Python &py) const { - py.start("Scalar"); + py.name("Scalar"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1005,7 +1017,7 @@ ScalarDataBase::python(Python &py) const if (prereq) py.qkwarg("prereq", prereq->name); py.kwarg("value", val()); - py.end(); + py.nameEnd(); } void @@ -1013,7 +1025,7 @@ VectorDataBase::python(Python &py) const { const_cast(this)->update(); - py.start("Vector"); + py.name("Vector"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1026,7 +1038,7 @@ VectorDataBase::python(Python &py) const py.qkwarg("subnames", subnames); if (!subdescs.empty()) py.qkwarg("subdescs", subdescs); - py.end(); + py.nameEnd(); } void @@ -1039,7 +1051,7 @@ DistDataData::python(Python &py, const string &name) const else s += "FullDist"; - py.start(s); + py.name(s); py.arg(sum); py.arg(squares); py.arg(samples); @@ -1054,7 +1066,7 @@ DistDataData::python(Python &py, const string &name) const py.arg(bucket_size); py.arg(size); } - py.end(); + py.nameEnd(); } void @@ -1062,7 +1074,7 @@ FormulaDataBase::python(Python &py) const { const_cast(this)->update(); - py.start("Formula"); + py.name("Formula"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1075,7 +1087,7 @@ FormulaDataBase::python(Python &py) const py.qkwarg("subnames", subnames); if (!subdescs.empty()) py.qkwarg("subdescs", subdescs); - py.end(); + py.nameEnd(); } void @@ -1083,7 +1095,7 @@ DistDataBase::python(Python &py) const { const_cast(this)->update(); - py.start("Dist"); + py.name("Dist"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1092,7 +1104,7 @@ DistDataBase::python(Python &py) const if (prereq) py.qkwarg("prereq", prereq->name); data.python(py, "dist"); - py.end(); + py.nameEnd(); } void @@ -1100,7 +1112,7 @@ VectorDistDataBase::python(Python &py) const { const_cast(this)->update(); - py.start("VectorDist"); + py.name("VectorDist"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1121,8 +1133,8 @@ VectorDistDataBase::python(Python &py) const i->python(py, ""); ++i; } - py.endTuple(); - py.end(); + py.tupleEnd(); + py.nameEnd(); } void @@ -1130,7 +1142,7 @@ Vector2dDataBase::python(Python &py) const { const_cast(this)->update(); - py.start("Vector2d"); + py.name("Vector2d"); py.qarg(name); py.qqqarg(desc); py.kwarg("binned", binned()); @@ -1149,7 +1161,7 @@ Vector2dDataBase::python(Python &py) const py.kwarg("x", x); py.kwarg("y", y); - py.end(); + py.nameEnd(); } void -- cgit v1.2.3 From 946b481831e813126de94d3c2c2001c2d51ccdee Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Tue, 20 Jan 2004 13:53:18 -0500 Subject: Set LIBELF_LINUX to 0 to build on zax. Builds but did not test... however the only thing this affects in libelf is the header, so I don't expect any functional problems. base/loader/elf_object.cc: Set LIBELF_LINUX to 0 to build on zax. --HG-- extra : convert_revision : d024b33deff6fc8ea6f1d465f76dc8d9d63254ab --- base/loader/elf_object.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'base') diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc index 93313fac6..f2a67f22e 100644 --- a/base/loader/elf_object.cc +++ b/base/loader/elf_object.cc @@ -30,7 +30,11 @@ // Because of the -Wundef flag we have to do this #define __LIBELF_INTERNAL__ 0 -#define __LIBELF64_LINUX 1 +// counterintuitive, but the flag below causes libelf to define +// 64-bit elf types that apparently didn't exist in some older +// versions of Linux. They seem to be there in 2.4.x, so don't +// set this now (it causes things to break on 64-bit platforms). +#define __LIBELF64_LINUX 0 #define __LIBELF_NEED_LINK_H 0 #include -- cgit v1.2.3 From 801c46d25049bbf1fea4c3b0f115b095b58e6323 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Tue, 27 Jan 2004 17:56:23 -0500 Subject: a bunch of warning fixes arch/alpha/isa_desc: don't say warn: Warning: base/misc.cc: avoid printing two newlines in a row sim/main.cc: print out a message just before we enter the event queue --HG-- extra : convert_revision : 2a824d4b67661903fc739a0fb0759aa91d72382c --- base/misc.cc | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'base') diff --git a/base/misc.cc b/base/misc.cc index 8190caddd..80968bd44 100644 --- a/base/misc.cc +++ b/base/misc.cc @@ -42,7 +42,17 @@ void __panic(const string &format, cp::ArgList &args, const char *func, const char *file, int line) { - string fmt = "panic: " + format + " @ cycle %d\n[%s:%s, line %d]\n"; + string fmt = "panic: " + format; + switch (fmt[fmt.size() - 1]) { + case '\n': + case '\r': + break; + default: + fmt += "\n"; + } + + fmt += " @ cycle %d\n[%s:%s, line %d]\n"; + args.append(curTick); args.append(func); args.append(file); @@ -63,8 +73,18 @@ void __fatal(const string &format, cp::ArgList &args, const char *func, const char *file, int line) { - string fmt = "fatal: " + format + " @ cycle %d\n[%s:%s, line %d]\n" - "Memory Usage: %ld KBytes\n"; + string fmt = "fatal: " + format; + + switch (fmt[fmt.size() - 1]) { + case '\n': + case '\r': + break; + default: + fmt += "\n"; + } + + fmt += " @ cycle %d\n[%s:%s, line %d]\n"; + fmt += "Memory Usage: %ld KBytes\n"; args.append(curTick); args.append(func); @@ -83,15 +103,23 @@ __warn(const string &format, cp::ArgList &args, const char *func, const char *file, int line) { string fmt = "warn: " + format; + + switch (fmt[fmt.size() - 1]) { + case '\n': + case '\r': + break; + default: + fmt += "\n"; + } + #ifdef VERBOSE_WARN fmt += " @ cycle %d\n[%s:%s, line %d]\n"; args.append(curTick); args.append(func); args.append(file); args.append(line); -#else - fmt += "\n"; #endif + args.dump(cerr, fmt); delete &args; -- cgit v1.2.3 From dc70ce3a60a01521ffa42b16a1910369155e4373 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 29 Jan 2004 00:36:22 -0500 Subject: cleanup on aisle 5 base/statistics.cc: dead code --HG-- extra : convert_revision : 8f3fd638acdf7a704475ea90b607a3225a3c174d --- base/statistics.cc | 1 - 1 file changed, 1 deletion(-) (limited to 'base') diff --git a/base/statistics.cc b/base/statistics.cc index 298cc9a36..49294ad27 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -209,7 +209,6 @@ Data::python_dump(const string &name, const string &subname) ++i; } } -// py->next(); } void -- cgit v1.2.3 From 2db1b6ea1b61665908138d7004001d494c168d85 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 29 Jan 2004 00:38:18 -0500 Subject: provide an output stream for simulator output. (This takes place of the statStream catchall that we had before) Also provide an optional output directory that multiple simulator output files can be written to. Make most output files use the output directory base/misc.cc: send warnings to the outputStream as well base/trace.cc: dprintf_stream defaults to cerr dev/console.cc: use the output directory for the console output if it exists dev/etherdump.cc: dump to the output directory if it exists sim/builder.cc: sim/builder.hh: move constructor and destructor to .cc file use a function to get the stream that the builder dumps its output to, and create a separate file in the output directory if able sim/main.cc: statStream -> outputStream sim/serialize.cc: dump checkpoints to the output directory if specified sim/universe.cc: provide an output stream for simulator output. (This takes place of the statStream catchall that we had before) Also provide an optional output directory that multiple simulator output files can be written to. --HG-- extra : convert_revision : 03abce20edbbf7ec19c9ddd8d69ec8485c383532 --- base/misc.cc | 2 ++ base/trace.cc | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'base') diff --git a/base/misc.cc b/base/misc.cc index 80968bd44..5caf96d40 100644 --- a/base/misc.cc +++ b/base/misc.cc @@ -121,6 +121,8 @@ __warn(const string &format, cp::ArgList &args, const char *func, #endif args.dump(cerr, fmt); + if (outputStream != &cerr && outputStream != &cout) + args.dump(*outputStream, fmt); delete &args; } diff --git a/base/trace.cc b/base/trace.cc index 99e97e7ea..156110376 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -49,7 +49,7 @@ FlagVec flags(NumFlags, false); // directly; use DebugOut() (see below) to access this stream for // output. // -ostream *dprintf_stream = NULL; +ostream *dprintf_stream = &cerr; int dprintf_ignore_size; vector dprintf_ignore; @@ -267,10 +267,7 @@ RawDataRecord::dump(ostream &os) std::ostream & DebugOut() { - if (Trace::dprintf_stream) - return *Trace::dprintf_stream; - else - return cerr; + return *Trace::dprintf_stream; } ///////////////////////////////////////////// -- cgit v1.2.3 From cb35f819c5326b37899695345ad78e032e8d7cdf Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 29 Jan 2004 17:44:08 -0500 Subject: delete the data in the arglist when the list is destroyed, not while printing out the data. This allows the data to be dumped more than once. base/cprintf.hh: need a destructor --HG-- extra : convert_revision : 235e9fe24488ac4c0ae1b562ef9fa6e0bd1e899c --- base/cprintf.cc | 26 ++++++++++++++++---------- base/cprintf.hh | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'base') diff --git a/base/cprintf.cc b/base/cprintf.cc index 5796a712b..5cbf0c057 100644 --- a/base/cprintf.cc +++ b/base/cprintf.cc @@ -37,9 +37,20 @@ using namespace std; namespace cp { +ArgList::~ArgList() +{ + while (!objects.empty()) { + delete objects.front(); + objects.pop_front(); + } +} + void ArgList::dump(const string &format) { + list_t::iterator iter = objects.begin(); + list_t::iterator end = objects.end(); + const char *p = format.c_str(); stream->fill(' '); @@ -198,22 +209,19 @@ ArgList::dump(const string &format) } } - if (!objects.empty()) + if (iter != end) { - Base *data = objects.front(); - objects.pop_front(); - ios::fmtflags saved_flags = stream->flags(); char old_fill = stream->fill(); int old_precision = stream->precision(); - data->process(*stream, fmt); + (*iter)->process(*stream, fmt); stream->flags(saved_flags); stream->fill(old_fill); stream->precision(old_precision); - delete data; + ++iter; } else { *stream << ""; } @@ -241,11 +249,9 @@ ArgList::dump(const string &format) } } - while (!objects.empty()) { + while (iter != end) { *stream << ""; - Base *data = objects.front(); - objects.pop_front(); - delete data; + ++iter; } } diff --git a/base/cprintf.hh b/base/cprintf.hh index ac34cd252..ca5c08b16 100644 --- a/base/cprintf.hh +++ b/base/cprintf.hh @@ -89,6 +89,7 @@ class ArgList public: ArgList() : stream(&std::cout) {} + ~ArgList(); template void append(const T &data) { -- cgit v1.2.3