X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=base%2Ftrace.cc;h=90db7f045c094ae04156f4bdb43d14c28d51d575;hb=5aa71721193c49016ffa69934b44ce38672e4eed;hp=e56bdb11b450dba96ec331794a37c4b8b19e0a9e;hpb=45f377bcd8c07b100aacc2de07023c836af04174;p=gem5.git diff --git a/base/trace.cc b/base/trace.cc index e56bdb11b..90db7f045 100644 --- a/base/trace.cc +++ b/base/trace.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2001-2005 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,39 +51,7 @@ FlagVec flags(NumFlags, false); // ostream *dprintf_stream = &cerr; -int dprintf_ignore_size; -vector dprintf_ignore; -vector > ignore_tokens; -vector ignore_size; - -bool -dprintf_ignore_name(const string &name) -{ - vector name_tokens; - tokenize(name_tokens, name, '.'); - int ntsize = name_tokens.size(); - - for (int i = 0; i < dprintf_ignore_size; ++i) { - bool match = true; - int jstop = ignore_size[i]; - for (int j = 0; j < jstop; ++j) { - if (j >= ntsize) - break; - - const string &ignore = ignore_tokens[i][j]; - if (ignore != "*" && ignore != name_tokens[j]) { - match = false; - break; - } - } - - if (match == true) - return true; - } - - return false; -} - +ObjectMatch ignore; Log theLog; @@ -103,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; @@ -130,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 @@ -184,7 +154,6 @@ PrintfRecord::~PrintfRecord() delete &args; } - void PrintfRecord::dump(ostream &os) { @@ -206,29 +175,26 @@ PrintfRecord::dump(ostream &os) os.flush(); } - - -RawDataRecord::RawDataRecord(Tick _cycle, const void *_data, int _len) - : Record(_cycle), len(_len) +DataRecord::DataRecord(Tick _cycle, const string &_name, + const void *_data, int _len) + : Record(_cycle), name(_name), len(_len) { data = new uint8_t[len]; memcpy(data, _data, len); } - -RawDataRecord::~RawDataRecord() +DataRecord::~DataRecord() { delete [] data; } - void -RawDataRecord::dump(ostream &os) +DataRecord::dump(ostream &os) { int c, i, j; for (i = 0; i < len; i += 16) { - ccprintf(os, "%08x ", i); + ccprintf(os, "%d: %s: %08x ", cycle, name, i); c = len - i; if (c > 16) c = 16;