trace.cc (2802:babfc298ac86) | trace.cc (4039:b910b61a52b9) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan | 2 * Copyright (c) 2001-2006 The Regents of The University of Michigan |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the --- 23 unchanged lines hidden (view full) --- 34#include <iostream> 35#include <list> 36#include <string> 37#include <vector> 38 39#include "base/misc.hh" 40#include "base/trace.hh" 41#include "base/str.hh" | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the --- 23 unchanged lines hidden (view full) --- 34#include <iostream> 35#include <list> 36#include <string> 37#include <vector> 38 39#include "base/misc.hh" 40#include "base/trace.hh" 41#include "base/str.hh" |
42#include "base/varargs.hh" |
|
42 43using namespace std; 44 45namespace Trace { 46const string DefaultName("global"); 47FlagVec flags(NumFlags, false); 48 49// --- 98 unchanged lines hidden (view full) --- 148 149 if (++bufPtr == wrapRecPtr) { 150 bufPtr = &buffer[0]; 151 } 152 } while (bufPtr != nextRecPtr); 153} 154 155PrintfRecord::~PrintfRecord() | 43 44using namespace std; 45 46namespace Trace { 47const string DefaultName("global"); 48FlagVec flags(NumFlags, false); 49 50// --- 98 unchanged lines hidden (view full) --- 149 150 if (++bufPtr == wrapRecPtr) { 151 bufPtr = &buffer[0]; 152 } 153 } while (bufPtr != nextRecPtr); 154} 155 156PrintfRecord::~PrintfRecord() |
156{ 157 delete &args; 158} | 157{} |
159 160void 161PrintfRecord::dump(ostream &os) 162{ 163 string fmt = ""; 164 165 if (!name.empty()) { 166 fmt = "%s: " + fmt; | 158 159void 160PrintfRecord::dump(ostream &os) 161{ 162 string fmt = ""; 163 164 if (!name.empty()) { 165 fmt = "%s: " + fmt; |
167 args.prepend(name); | 166 args.push_front(name); |
168 } 169 170 if (cycle != (Tick)-1) { 171 fmt = "%7d: " + fmt; | 167 } 168 169 if (cycle != (Tick)-1) { 170 fmt = "%7d: " + fmt; |
172 args.prepend(cycle); | 171 args.push_front(cycle); |
173 } 174 175 fmt += format; 176 | 172 } 173 174 fmt += format; 175 |
177 args.dump(os, fmt); | 176 ccprintf(os, fmt.c_str(), args); |
178 os.flush(); 179} 180 181DataRecord::DataRecord(Tick _cycle, const string &_name, 182 const void *_data, int _len) 183 : Record(_cycle), name(_name), len(_len) 184{ 185 data = new uint8_t[len]; --- 163 unchanged lines hidden --- | 177 os.flush(); 178} 179 180DataRecord::DataRecord(Tick _cycle, const string &_name, 181 const void *_data, int _len) 182 : Record(_cycle), name(_name), len(_len) 183{ 184 data = new uint8_t[len]; --- 163 unchanged lines hidden --- |