statistics.cc (6000:4f887be9e1b6) statistics.cc (6001:00251eb95de7)
1/*
2 * Copyright (c) 2003-2005 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;

--- 18 unchanged lines hidden (view full) ---

27 *
28 * Authors: Nathan Binkert
29 */
30
31#include <iomanip>
32#include <fstream>
33#include <list>
34#include <map>
1/*
2 * Copyright (c) 2003-2005 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;

--- 18 unchanged lines hidden (view full) ---

27 *
28 * Authors: Nathan Binkert
29 */
30
31#include <iomanip>
32#include <fstream>
33#include <list>
34#include <map>
35#include <set>
35#include <string>
36
37#include "base/callback.hh"
38#include "base/cprintf.hh"
39#include "base/debug.hh"
40#include "base/hostinfo.hh"
41#include "base/misc.hh"
42#include "base/statistics.hh"

--- 126 unchanged lines hidden (view full) ---

169 if ((flags & print) && name.empty()) {
170 panic("all printable stats must be named");
171 return false;
172 }
173
174 return true;
175}
176
36#include <string>
37
38#include "base/callback.hh"
39#include "base/cprintf.hh"
40#include "base/debug.hh"
41#include "base/hostinfo.hh"
42#include "base/misc.hh"
43#include "base/statistics.hh"

--- 126 unchanged lines hidden (view full) ---

170 if ((flags & print) && name.empty()) {
171 panic("all printable stats must be named");
172 return false;
173 }
174
175 return true;
176}
177
178void
179Info::enable()
180{
181}
177
182
183void
184VectorInfoBase::enable()
185{
186 size_type s = size();
187 if (subnames.size() < s)
188 subnames.resize(s);
189 if (subdescs.size() < s)
190 subdescs.resize(s);
191}
192
193void
194VectorDistInfoBase::enable()
195{
196 size_type s = size();
197 if (subnames.size() < s)
198 subnames.resize(s);
199 if (subdescs.size() < s)
200 subdescs.resize(s);
201}
202
203void
204Vector2dInfoBase::enable()
205{
206 if (subnames.size() < x)
207 subnames.resize(x);
208 if (subdescs.size() < x)
209 subdescs.resize(x);
210 if (y_subnames.size() < y)
211 y_subnames.resize(y);
212}
213
178Formula::Formula()
179{
180 setInit();
181}
182
183Formula::Formula(Temp r)
184{
185 root = r;

--- 53 unchanged lines hidden (view full) ---

239 VResult vec;
240 result(vec);
241 for (off_t i = 0; i < vec.size(); ++i)
242 if (vec[i] != 0.0)
243 return false;
244 return true;
245}
246
214Formula::Formula()
215{
216 setInit();
217}
218
219Formula::Formula(Temp r)
220{
221 root = r;

--- 53 unchanged lines hidden (view full) ---

275 VResult vec;
276 result(vec);
277 for (off_t i = 0; i < vec.size(); ++i)
278 if (vec[i] != 0.0)
279 return false;
280 return true;
281}
282
247void
248Formula::update()
249{
250}
251
252string
253Formula::str() const
254{
255 return root ? root->str() : "";
256}
257
258void
283string
284Formula::str() const
285{
286 return root ? root->str() : "";
287}
288
289void
259check()
290enable()
260{
261 typedef list<Info *>::iterator iter_t;
262
263 iter_t i, end = statsList().end();
264 for (i = statsList().begin(); i != end; ++i) {
265 Info *info = *i;
266 assert(info);
267 if (!info->check() || !info->baseCheck())

--- 4 unchanged lines hidden (view full) ---

272 for (i = statsList().begin(); i != end; ++i) {
273 Info *info = *i;
274 if (!(info->flags & print))
275 info->name = "__Stat" + to_string(j++);
276 }
277
278 statsList().sort(Info::less);
279
291{
292 typedef list<Info *>::iterator iter_t;
293
294 iter_t i, end = statsList().end();
295 for (i = statsList().begin(); i != end; ++i) {
296 Info *info = *i;
297 assert(info);
298 if (!info->check() || !info->baseCheck())

--- 4 unchanged lines hidden (view full) ---

303 for (i = statsList().begin(); i != end; ++i) {
304 Info *info = *i;
305 if (!(info->flags & print))
306 info->name = "__Stat" + to_string(j++);
307 }
308
309 statsList().sort(Info::less);
310
280 if (i == end)
281 return;
282
283 iter_t last = i;
284 ++i;
285
286 for (i = statsList().begin(); i != end; ++i) {
311 for (i = statsList().begin(); i != end; ++i) {
287 if ((*i)->name == (*last)->name)
288 panic("same name used twice! name=%s\n", (*i)->name);
312 Info *info = *i;
313 info->enable();
314 }
315}
289
316
290 last = i;
317void
318prepare()
319{
320 list<Info *>::iterator i = statsList().begin();
321 list<Info *>::iterator end = statsList().end();
322 while (i != end) {
323 Info *info = *i;
324 info->prepare();
325 ++i;
291 }
292}
293
294CallbackQueue resetQueue;
295
296void
297reset()
298{

--- 18 unchanged lines hidden ---
326 }
327}
328
329CallbackQueue resetQueue;
330
331void
332reset()
333{

--- 18 unchanged lines hidden ---