add in the files to the SConscript for split caches
[gem5.git] / base / trace.cc
index e56bdb11b450dba96ec331794a37c4b8b19e0a9e..90db7f045c094ae04156f4bdb43d14c28d51d575 100644 (file)
@@ -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<string> dprintf_ignore;
-vector<vector<string> > ignore_tokens;
-vector<int> ignore_size;
-
-bool
-dprintf_ignore_name(const string &name)
-{
-    vector<string> 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;