Deleted Added
sdiff udiff text old ( 2665:a124942bacb8 ) new ( 2716:b9114064d77a )
full compact
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;

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

38#include "base/cprintf.hh"
39#include "base/hostinfo.hh"
40#include "base/misc.hh"
41#include "base/statistics.hh"
42#include "base/str.hh"
43#include "base/time.hh"
44#include "base/trace.hh"
45#include "base/stats/statdb.hh"
46
47using namespace std;
48
49namespace Stats {
50
51StatData *
52DataAccess::find() const
53{

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

168FormulaBase::size() const
169{
170 if (!root)
171 return 0;
172 else
173 return root->size();
174}
175
176void
177FormulaBase::reset()
178{
179}
180
181bool
182FormulaBase::zero() const
183{

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

226 if (root)
227 root = NodePtr(new BinaryNode<std::plus<Result> >(root, r));
228 else
229 root = r;
230 assert(size());
231 return *this;
232}
233
234void
235check()
236{
237 typedef Database::stat_list_t::iterator iter_t;
238
239 iter_t i, end = Database::stats().end();
240 for (i = Database::stats().begin(); i != end; ++i) {
241 StatData *data = *i;

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

248 for (i = Database::stats().begin(); i != end; ++i) {
249 StatData *data = *i;
250 if (!(data->flags & print))
251 data->name = "__Stat" + to_string(j++);
252 }
253
254 Database::stats().sort(StatData::less);
255
256 if (i == end)
257 return;
258
259 iter_t last = i;
260 ++i;
261
262 for (i = Database::stats().begin(); i != end; ++i) {
263 if ((*i)->name == (*last)->name)
264 panic("same name used twice! name=%s\n", (*i)->name);
265
266 last = i;
267 }
268}
269
270CallbackQueue resetQueue;
271
272void
273reset()
274{
275 Database::stat_list_t::iterator i = Database::stats().begin();
276 Database::stat_list_t::iterator end = Database::stats().end();
277 while (i != end) {
278 StatData *data = *i;
279 data->reset();
280 ++i;
281 }
282
283 resetQueue.process();
284}
285
286void
287registerResetCallback(Callback *cb)
288{
289 resetQueue.add(cb);
290}
291
292/* namespace Stats */ }