statistics.cc (8248:d69720504203) statistics.cc (8296:be7f03723412)
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;

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

428}
429
430string
431Formula::str() const
432{
433 return root ? root->str() : "";
434}
435
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;

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

428}
429
430string
431Formula::str() const
432{
433 return root ? root->str() : "";
434}
435
436void
437enable()
438{
439 typedef list<Info *>::iterator iter_t;
440
441 iter_t i, end = statsList().end();
442 for (i = statsList().begin(); i != end; ++i) {
443 Info *info = *i;
444 assert(info);
445 if (!info->check() || !info->baseCheck())
446 panic("stat check failed for '%s' %d\n", info->name, info->id);
447 }
448
449 off_t j = 0;
450 for (i = statsList().begin(); i != end; ++i) {
451 Info *info = *i;
452 if (!(info->flags & display))
453 info->name = "__Stat" + to_string(j++);
454 }
455
456 statsList().sort(Info::less);
457
458 for (i = statsList().begin(); i != end; ++i) {
459 Info *info = *i;
460 info->enable();
461 }
462}
463
464void
465prepare()
466{
467 list<Info *>::iterator i = statsList().begin();
468 list<Info *>::iterator end = statsList().end();
469 while (i != end) {
470 Info *info = *i;
471 info->prepare();
472 ++i;
473 }
474}
475
476CallbackQueue resetQueue;
477
478void
436CallbackQueue resetQueue;
437
438void
479reset()
480{
481 list<Info *>::iterator i = statsList().begin();
482 list<Info *>::iterator end = statsList().end();
483 while (i != end) {
484 Info *info = *i;
485 info->reset();
486 ++i;
487 }
488
489 resetQueue.process();
490}
491
492void
493registerResetCallback(Callback *cb)
494{
495 resetQueue.add(cb);
496}
497
498} // namespace Stats
439registerResetCallback(Callback *cb)
440{
441 resetQueue.add(cb);
442}
443
444} // namespace Stats
445
446void
447debugDumpStats()
448{
449 Stats::dump();
450}