diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/inifile.cc | 41 | ||||
-rw-r--r-- | base/inifile.hh | 18 | ||||
-rw-r--r-- | base/misc.cc | 5 | ||||
-rw-r--r-- | base/output.cc | 129 | ||||
-rw-r--r-- | base/output.hh | 61 | ||||
-rw-r--r-- | base/random.hh | 20 | ||||
-rw-r--r-- | base/range.hh | 1 | ||||
-rw-r--r-- | base/res_list.hh | 2 | ||||
-rw-r--r-- | base/statistics.cc | 7 | ||||
-rw-r--r-- | base/statistics.hh | 136 | ||||
-rw-r--r-- | base/stats/events.cc | 2 | ||||
-rw-r--r-- | base/stats/text.cc | 2 | ||||
-rw-r--r-- | base/str.cc | 30 | ||||
-rw-r--r-- | base/str.hh | 14 | ||||
-rw-r--r-- | base/trace.cc | 4 | ||||
-rw-r--r-- | base/trace.hh | 6 | ||||
-rw-r--r-- | base/traceflags.py | 3 |
17 files changed, 331 insertions, 150 deletions
diff --git a/base/inifile.cc b/base/inifile.cc index 94b17966a..862e4082f 100644 --- a/base/inifile.cc +++ b/base/inifile.cc @@ -334,47 +334,6 @@ IniFile::find(const string §ionName, const string &entryName, } bool -IniFile::findDefault(const string &_section, const string &entry, - string &value) const -{ - string section = _section; - while (!findAppend(section, entry, value)) { - if (!find(section, "default", section)) { - return false; - } - } - - return true; -} - -bool -IniFile::findAppend(const string &_section, const string &entry, - string &value) const -{ - string section = _section; - bool ret = false; - bool first = true; - - do { - string val; - if (find(section, entry, val)) { - ret = true; - if (first) { - value = val; - first = false; - } else { - value += " "; - value += val; - } - - } - } while (find(section, "append", section)); - - return ret; -} - - -bool IniFile::sectionExists(const string §ionName) const { return findSection(sectionName) != NULL; diff --git a/base/inifile.hh b/base/inifile.hh index 58a657db4..d5d6bab5e 100644 --- a/base/inifile.hh +++ b/base/inifile.hh @@ -190,24 +190,6 @@ class IniFile bool find(const std::string §ion, const std::string &entry, std::string &value) const; - /// Find value corresponding to given section and entry names, - /// following "default" links to other sections where possible. - /// Value is returned by reference in 'value' param. - /// @return True if found, false if not. - bool findDefault(const std::string §ion, const std::string &entry, - std::string &value) const; - - /** - * Find a value corresponding to the given section and entry names - * following "append" links to other sections where possible. - * @param section The section to start with. - * @param entry The entry to find. - * @param value The value found. - * @return True if the entry was found. - */ - bool findAppend(const std::string §ion, const std::string &entry, - std::string &value) const; - /// Determine whether the named section exists in the .ini file. /// Note that the 'Section' class is (intentionally) not public, /// so all clients can do is get a bool that says whether there diff --git a/base/misc.cc b/base/misc.cc index 0c459352f..4b7c3632a 100644 --- a/base/misc.cc +++ b/base/misc.cc @@ -30,10 +30,11 @@ #include <string> #include "base/cprintf.hh" -#include "sim/host.hh" #include "base/hostinfo.hh" #include "base/misc.hh" +#include "base/output.hh" #include "base/trace.hh" +#include "sim/host.hh" #include "sim/universe.hh" using namespace std; @@ -116,7 +117,7 @@ __warn(const string &format, cp::ArgList &args, const char *func, #endif args.dump(cerr, fmt); - if (outputStream != &cerr && outputStream != &cout) + if (simout.isFile(*outputStream)) args.dump(*outputStream, fmt); delete &args; diff --git a/base/output.cc b/base/output.cc new file mode 100644 index 000000000..2b1733f21 --- /dev/null +++ b/base/output.cc @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2005 The Regents of The University of Michigan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <errno.h> +#include <limits.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include <fstream> + +#include "base/misc.hh" +#include "base/output.hh" + +using namespace std; + +OutputDirectory simout; + +/** + * + */ +OutputDirectory::OutputDirectory() +{} + +OutputDirectory::~OutputDirectory() +{} + +void +OutputDirectory::setDirectory(const string &d) +{ + if (!dir.empty()) + panic("Output directory already set!\n"); + + dir = d; + + if (dir != ".") { + if (mkdir(dir.c_str(), 0777) < 0 && errno != EEXIST) + panic("couldn't make output dir %s: %s\n", + dir, strerror(errno)); + } + + // guarantee that directory ends with a '/' + if (dir[dir.size() - 1] != '/') + dir += "/"; +} + +const string & +OutputDirectory::directory() +{ + if (dir.empty()) + panic("Output directory not set!"); + + return dir; +} + +string +OutputDirectory::resolve(const string &name) +{ + return (name[0] != '/') ? dir + name : name; +} + +ostream * +OutputDirectory::create(const string &name) +{ + if (name == "cerr" || name == "stderr") + return &cerr; + + if (name == "cout" || name == "stdout") + return &cout; + + ofstream *file = new ofstream(resolve(name).c_str(), ios::trunc); + if (!file->is_open()) + panic("Cannot open file %s", name); + + return file; +} + +ostream * +OutputDirectory::find(const string &name) +{ + if (name == "cerr" || name == "stderr") + return &cerr; + + if (name == "cout" || name == "stdout") + return &cout; + + string filename = resolve(name); + map_t::iterator i = files.find(filename); + if (i != files.end()) + return (*i).second; + + ofstream *file = new ofstream(filename.c_str(), ios::trunc); + if (!file->is_open()) + panic("Cannot open file %s", filename); + + files[filename] = file; + return file; +} + +bool +OutputDirectory::isFile(const std::ostream *os) +{ + return os && os != &cerr && os != &cout; +} diff --git a/base/output.hh b/base/output.hh new file mode 100644 index 000000000..3bbe73e3b --- /dev/null +++ b/base/output.hh @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2005 The Regents of The University of Michigan + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __BASE_OUTPUT_HH__ +#define __BASE_OUTPUT_HH__ + +#include <iosfwd> +#include <map> +#include <string> + +class OutputDirectory +{ + private: + typedef std::map<std::string, std::ostream *> map_t; + + map_t files; + std::string dir; + + public: + OutputDirectory(); + ~OutputDirectory(); + + void setDirectory(const std::string &dir); + const std::string &directory(); + + std::string resolve(const std::string &name); + std::ostream *create(const std::string &name); + std::ostream *find(const std::string &name); + + static bool isFile(const std::ostream *os); + static inline bool isFile(const std::ostream &os) { return isFile(&os); } +}; + +extern OutputDirectory simout; + +#endif // __BASE_OUTPUT_HH__ diff --git a/base/random.hh b/base/random.hh index 0bfed100c..fe93a98a6 100644 --- a/base/random.hh +++ b/base/random.hh @@ -37,61 +37,61 @@ double getDouble(); template <typename T> struct Random; -struct Random<int8_t> +template<> struct Random<int8_t> { static int8_t get() { return getLong() & (int8_t)-1; } }; -struct Random<uint8_t> +template<> struct Random<uint8_t> { static uint8_t get() { return getLong() & (uint8_t)-1; } }; -struct Random<int16_t> +template<> struct Random<int16_t> { static int16_t get() { return getLong() & (int16_t)-1; } }; -struct Random<uint16_t> +template<> struct Random<uint16_t> { static uint16_t get() { return getLong() & (uint16_t)-1; } }; -struct Random<int32_t> +template<> struct Random<int32_t> { static int32_t get() { return (int32_t)getLong(); } }; -struct Random<uint32_t> +template<> struct Random<uint32_t> { static uint32_t get() { return (uint32_t)getLong(); } }; -struct Random<int64_t> +template<> struct Random<int64_t> { static int64_t get() { return (int64_t)getLong() << 32 || (uint64_t)getLong(); } }; -struct Random<uint64_t> +template<> struct Random<uint64_t> { static uint64_t get() { return (uint64_t)getLong() << 32 || (uint64_t)getLong(); } }; -struct Random<float> +template<> struct Random<float> { static float get() { return getDouble(); } }; -struct Random<double> +template<> struct Random<double> { static double get() { return getDouble(); } diff --git a/base/range.hh b/base/range.hh index 9289792ea..57b6e6a77 100644 --- a/base/range.hh +++ b/base/range.hh @@ -30,6 +30,7 @@ #define __BASE_RANGE_HH__ #include <cassert> +#include <iostream> #include <string> /** diff --git a/base/res_list.hh b/base/res_list.hh index 7080a3ba7..5dc798fed 100644 --- a/base/res_list.hh +++ b/base/res_list.hh @@ -352,7 +352,7 @@ res_list<T>::insert_after(iterator prev, T *d) iterator p; if (!allocate_storage) - panic("Can't copy data... not allocating storage"); + this->panic("Can't copy data... not allocating storage"); p = insert_after(prev); if (p.notnull()) diff --git a/base/statistics.cc b/base/statistics.cc index 6e3dae1ef..6f5caf1fe 100644 --- a/base/statistics.cc +++ b/base/statistics.cc @@ -286,6 +286,13 @@ check() Database::stats().sort(StatData::less); +#if defined(STATS_BINNING) + if (MainBin::curBin() == NULL) { + static MainBin mainBin("main bin"); + mainBin.activate(); + } +#endif + if (i == end) return; diff --git a/base/statistics.hh b/base/statistics.hh index f3b8a3922..98d50a5bc 100644 --- a/base/statistics.hh +++ b/base/statistics.hh @@ -407,7 +407,7 @@ class Wrap : public Child public: Wrap() { - map(new Data<Child>(*this)); + map(new Data<Child>(*this)); } /** @@ -417,10 +417,10 @@ class Wrap : public Child */ Parent &name(const std::string &_name) { - Data<Child> *data = statData(); + Data<Child> *data = this->statData(); data->name = _name; - setPrint(); - return self(); + this->setPrint(); + return this->self(); } /** @@ -431,8 +431,8 @@ class Wrap : public Child */ Parent &desc(const std::string &_desc) { - statData()->desc = _desc; - return self(); + this->statData()->desc = _desc; + return this->self(); } /** @@ -442,8 +442,8 @@ class Wrap : public Child */ Parent &precision(int _precision) { - statData()->precision = _precision; - return self(); + this->statData()->precision = _precision; + return this->self(); } /** @@ -453,8 +453,8 @@ class Wrap : public Child */ Parent &flags(StatFlags _flags) { - statData()->flags |= _flags; - return self(); + this->statData()->flags |= _flags; + return this->self(); } /** @@ -466,8 +466,8 @@ class Wrap : public Child template <class Stat> Parent &prereq(const Stat &prereq) { - statData()->prereq = prereq.statData(); - return self(); + this->statData()->prereq = prereq.statData(); + return this->self(); } }; @@ -487,11 +487,11 @@ class WrapVec : public Wrap<Parent, Child, Data> */ Parent &subname(int index, const std::string &name) { - std::vector<std::string> &subn = statData()->subnames; + std::vector<std::string> &subn = this->statData()->subnames; if (subn.size() <= index) subn.resize(index + 1); subn[index] = name; - return self(); + return this->self(); } /** @@ -503,12 +503,12 @@ class WrapVec : public Wrap<Parent, Child, Data> */ Parent &subdesc(int index, const std::string &desc) { - std::vector<std::string> &subd = statData()->subdescs; + std::vector<std::string> &subd = this->statData()->subdescs; if (subd.size() <= index) subd.resize(index + 1); subd[index] = desc; - return self(); + return this->self(); } }; @@ -523,19 +523,19 @@ class WrapVec2d : public WrapVec<Parent, Child, Data> */ Parent &ysubnames(const char **names) { - Data<Child> *data = statData(); - data->y_subnames.resize(y); - for (int i = 0; i < y; ++i) + Data<Child> *data = this->statData(); + data->y_subnames.resize(this->y); + for (int i = 0; i < this->y; ++i) data->y_subnames[i] = names[i]; - return self(); + return this->self(); } Parent &ysubname(int index, const std::string subname) { - Data<Child> *data = statData(); - assert(index < y); - data->y_subnames.resize(y); + Data<Child> *data = this->statData(); + assert(index < this->y); + data->y_subnames.resize(this->y); data->y_subnames[index] = subname.c_str(); - return self(); + return this->self(); } }; @@ -711,7 +711,7 @@ class ScalarBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -914,7 +914,7 @@ class VectorBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -1022,7 +1022,7 @@ class ScalarProxy /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; private: /** Pointer to the bin in the parent VectorBase. */ @@ -1155,7 +1155,7 @@ class ScalarProxy const StatData *statData() const { return getStatData(stat); } std::string str() const { - return csprintf("%s[%d]", statData()->name, index); + return csprintf("%s[%d]", this->statData()->name, index); } }; @@ -1176,7 +1176,7 @@ class Vector2dBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: size_t x; @@ -1204,7 +1204,7 @@ class Vector2dBase : public DataAccess data->cvec[i] = this->data(i)->value(params); } - std::string ysubname(int i) const { return (*y_subnames)[i]; } + std::string ysubname(int i) const { return (*this->y_subnames)[i]; } friend class VectorProxy<Storage, Bin>; VectorProxy<Storage, Bin> operator[](int index); @@ -1225,7 +1225,7 @@ class VectorProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; private: bin_t *bin; @@ -1622,7 +1622,7 @@ class DistBase : public DataAccess /** Define the params of the storage class. */ typedef typename Storage::Params params_t; /** Define the bin type. */ - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; protected: /** The bin of this stat. */ @@ -1698,7 +1698,7 @@ class VectorDistBase : public DataAccess { public: typedef typename Storage::Params params_t; - typedef typename Bin::VectorBin<Storage> bin_t; + typedef typename Bin::template VectorBin<Storage> bin_t; protected: bin_t bin; @@ -1749,7 +1749,7 @@ class DistProxy { public: typedef typename Storage::Params params_t; - typedef typename Bin::Bin<Storage> bin_t; + typedef typename Bin::template Bin<Storage> bin_t; typedef VectorDistBase<Storage, Bin> base_t; private: @@ -2184,7 +2184,7 @@ class SumNode : public Node * binned. If the typedef is NoBin, nothing is binned. If it is * MainBin, then all stats are binned under that Bin. */ -#if defined(FS_MEASURE) || defined(STATS_BINNING) +#if defined(STATS_BINNING) typedef MainBin DefaultBin; #else typedef NoBin DefaultBin; @@ -2206,7 +2206,7 @@ class Scalar Scalar() { - setInit(); + this->setInit(); } /** @@ -2258,7 +2258,7 @@ class Average Average() { - setInit(); + this->setInit(); } /** @@ -2290,8 +2290,8 @@ class Vector * @return A reference to this stat. */ Vector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2314,8 +2314,8 @@ class AverageVector * @return A reference to this stat. */ AverageVector &init(size_t size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2333,10 +2333,10 @@ class Vector2d { public: Vector2d &init(size_t _x, size_t _y) { - statData()->x = x = _x; - statData()->y = y = _y; - bin.init(x * y, params); - setInit(); + this->statData()->x = this->x = _x; + this->statData()->y = this->y = _y; + this->bin.init(this->x * this->y, this->params); + this->setInit(); return *this; } @@ -2367,12 +2367,12 @@ class Distribution * @return A reference to this distribution. */ Distribution &init(Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(this->params); + this->setInit(); return *this; } @@ -2399,8 +2399,8 @@ class StandardDeviation * Construct and initialize this distribution. */ StandardDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2426,8 +2426,8 @@ class AverageDeviation */ AverageDeviation() { - bin.init(params); - setInit(); + this->bin.init(this->params); + this->setInit(); } }; @@ -2457,12 +2457,12 @@ class VectorDistribution * @return A reference to this distribution. */ VectorDistribution &init(int size, Counter min, Counter max, Counter bkt) { - params.min = min; - params.max = max; - params.bucket_size = bkt; - params.size = (int)rint((max - min) / bkt + 1.0); - bin.init(size, params); - setInit(); + this->params.min = min; + this->params.max = max; + this->params.bucket_size = bkt; + this->params.size = (int)rint((max - min) / bkt + 1.0); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2491,8 +2491,8 @@ class VectorStandardDeviation * @return A reference to this distribution. */ VectorStandardDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2521,8 +2521,8 @@ class VectorAverageDeviation * @return A reference to this distribution. */ VectorAverageDeviation &init(int size) { - bin.init(size, params); - setInit(); + this->bin.init(size, this->params); + this->setInit(); return *this; } @@ -2873,12 +2873,6 @@ operator/(Temp l, Temp r) } inline Temp -operator%(Temp l, Temp r) -{ - return NodePtr(new BinaryNode<std::modulus<Result> >(l, r)); -} - -inline Temp operator-(Temp l) { return NodePtr(new UnaryNode<std::negate<Result> >(l)); diff --git a/base/stats/events.cc b/base/stats/events.cc index e5efceabe..d716fa4d3 100644 --- a/base/stats/events.cc +++ b/base/stats/events.cc @@ -134,7 +134,7 @@ InsertEvent::insert(const string &stat) first = false; size += sprintf(query + size, "(%u,%u,%llu)", - event, run, curTick); + event, run, (unsigned long long)curTick); } void diff --git a/base/stats/text.cc b/base/stats/text.cc index f7e82a30f..8cc5ff65e 100644 --- a/base/stats/text.cc +++ b/base/stats/text.cc @@ -126,7 +126,7 @@ Text::output() using namespace Database; ccprintf(*stream, "\n---------- Begin Simulation Statistics ----------\n"); - if (bins().empty()) { + if (bins().empty() || bins().size() == 1) { stat_list_t::const_iterator i, end = stats().end(); for (i = stats().begin(); i != end; ++i) (*i)->visit(*this); diff --git a/base/str.cc b/base/str.cc index dd8d80043..5357ba79f 100644 --- a/base/str.cc +++ b/base/str.cc @@ -39,6 +39,36 @@ using namespace std; +bool +split_first(const string &s, string &lhs, string &rhs, char c) +{ + string::size_type offset = s.find(c); + if (offset == string::npos) { + lhs = s; + rhs = ""; + return false; + } + + lhs = s.substr(0, offset); + rhs = s.substr(offset + 1); + return true; +} + +bool +split_last(const string &s, string &lhs, string &rhs, char c) +{ + string::size_type offset = s.rfind(c); + if (offset == string::npos) { + lhs = s; + rhs = ""; + return false; + } + + lhs = s.substr(0, offset); + rhs = s.substr(offset + 1); + return true; +} + void tokenize(vector<string>& v, const string &s, char token, bool ignore) { diff --git a/base/str.hh b/base/str.hh index 812f4d41a..41433f2bd 100644 --- a/base/str.hh +++ b/base/str.hh @@ -90,6 +90,20 @@ to_lower(const std::string &s) return lower; } +// Split the string s into lhs and rhs on the first occurence of the +// character c. +bool +split_first(const std::string &s, std::string &lhs, std::string &rhs, char c); + +// Split the string s into lhs and rhs on the last occurence of the +// character c. +bool +split_last(const std::string &s, std::string &lhs, std::string &rhs, char c); + +// Tokenize the string <s> splitting on the character <token>, and +// place the result in the string vector <vector>. If <ign> is true, +// then empty result strings (due to trailing tokens, or consecutive +// tokens) are skipped. void tokenize(std::vector<std::string> &vector, const std::string &s, char token, bool ign = true); diff --git a/base/trace.cc b/base/trace.cc index bc6c9aa7a..c9d4a0f78 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -71,7 +71,7 @@ Log::init(int _size) size = _size; - buffer = new (Record *)[size]; + buffer = new Record *[size]; for (int i = 0; i < size; ++i) { buffer[i] = NULL; @@ -98,6 +98,8 @@ Log::append(Record *rec) // dump record to output stream if there's one open if (dprintf_stream != NULL) { rec->dump(*dprintf_stream); + } else { + rec->dump(cout); } // no buffering: justget rid of it now diff --git a/base/trace.hh b/base/trace.hh index 5e05d6e5e..054b14546 100644 --- a/base/trace.hh +++ b/base/trace.hh @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __TRACE_HH__ -#define __TRACE_HH__ +#ifndef __BASE_TRACE_HH__ +#define __BASE_TRACE_HH__ #include <vector> @@ -228,4 +228,4 @@ do { \ #endif // TRACING_ON -#endif // __TRACE_HH__ +#endif // __BASE_TRACE_HH__ diff --git a/base/traceflags.py b/base/traceflags.py index 8f20a9692..800c47bd3 100644 --- a/base/traceflags.py +++ b/base/traceflags.py @@ -110,7 +110,7 @@ baseFlags = [ 'IICMore', 'MSHR', 'Chains', - 'Dispatch', + 'Pipeline', 'Stats', 'StatEvents', 'Context', @@ -139,6 +139,7 @@ compoundFlagMap = { 'ScsiAll' : [ 'ScsiDisk', 'ScsiCtrl', 'ScsiNone' ], 'DiskImageAll' : [ 'DiskImage', 'DiskImageRead', 'DiskImageWrite' ], 'EthernetAll' : [ 'Ethernet', 'EthernetPIO', 'EthernetDMA', 'EthernetData' , 'EthernetDesc', 'EthernetIntr', 'EthernetSM', 'EthernetCksum' ], + 'EthernetNoData' : [ 'Ethernet', 'EthernetPIO', 'EthernetDesc', 'EthernetIntr', 'EthernetSM', 'EthernetCksum' ], 'IdeAll' : [ 'IdeCtrl', 'IdeDisk' ] } |