statistics.hh (8243:63e849f0f341) | statistics.hh (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; --- 46 unchanged lines hidden (view full) --- 55#include <cmath> 56#include <functional> 57#include <iosfwd> 58#include <list> 59#include <string> 60#include <vector> 61 62#include "base/stats/info.hh" | 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; --- 46 unchanged lines hidden (view full) --- 55#include <cmath> 56#include <functional> 57#include <iosfwd> 58#include <list> 59#include <string> 60#include <vector> 61 62#include "base/stats/info.hh" |
63#include "base/stats/output.hh" |
|
63#include "base/stats/types.hh" | 64#include "base/stats/types.hh" |
64#include "base/stats/visit.hh" | |
65#include "base/cast.hh" 66#include "base/cprintf.hh" 67#include "base/intmath.hh" 68#include "base/refcnt.hh" 69#include "base/str.hh" 70#include "base/types.hh" 71 72class Callback; --- 12 unchanged lines hidden (view full) --- 85 86 public: 87 InfoProxy(Stat &stat) : s(stat) {} 88 89 bool check() const { return s.check(); } 90 void prepare() { s.prepare(); } 91 void reset() { s.reset(); } 92 void | 65#include "base/cast.hh" 66#include "base/cprintf.hh" 67#include "base/intmath.hh" 68#include "base/refcnt.hh" 69#include "base/str.hh" 70#include "base/types.hh" 71 72class Callback; --- 12 unchanged lines hidden (view full) --- 85 86 public: 87 InfoProxy(Stat &stat) : s(stat) {} 88 89 bool check() const { return s.check(); } 90 void prepare() { s.prepare(); } 91 void reset() { s.reset(); } 92 void |
93 visit(Visit &visitor) | 93 visit(Output &visitor) |
94 { 95 visitor.visit(*static_cast<Base *>(this)); 96 } 97 bool zero() const { return s.zero(); } 98}; 99 100template <class Stat> 101class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo> --- 631 unchanged lines hidden (view full) --- 733 public: 734 std::string str() const { return to_string(value()); } 735 size_type size() const { return 1; } 736 bool check() const { return true; } 737 void prepare() { } 738 void reset() { } 739 bool zero() const { return value() == 0; } 740 | 94 { 95 visitor.visit(*static_cast<Base *>(this)); 96 } 97 bool zero() const { return s.zero(); } 98}; 99 100template <class Stat> 101class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo> --- 631 unchanged lines hidden (view full) --- 733 public: 734 std::string str() const { return to_string(value()); } 735 size_type size() const { return 1; } 736 bool check() const { return true; } 737 void prepare() { } 738 void reset() { } 739 bool zero() const { return value() == 0; } 740 |
741 void visit(Visit &visitor) { visitor.visit(*this); } | 741 void visit(Output &visitor) { visitor.visit(*this); } |
742}; 743 744template <class T> 745class ValueProxy : public ProxyInfo 746{ 747 private: 748 T *scalar; 749 --- 2178 unchanged lines hidden (view full) --- 2928} 2929 2930inline Temp 2931sum(Temp val) 2932{ 2933 return NodePtr(new SumNode<std::plus<Result> >(val)); 2934} 2935 | 742}; 743 744template <class T> 745class ValueProxy : public ProxyInfo 746{ 747 private: 748 T *scalar; 749 --- 2178 unchanged lines hidden (view full) --- 2928} 2929 2930inline Temp 2931sum(Temp val) 2932{ 2933 return NodePtr(new SumNode<std::plus<Result> >(val)); 2934} 2935 |
2936/** 2937 * Enable the statistics package. Before the statistics package is 2938 * enabled, all statistics must be created and initialized and once 2939 * the package is enabled, no more statistics can be created. 2940 */ 2941void enable(); 2942 2943/** 2944 * Prepare all stats for data access. This must be done before 2945 * dumping and serialization. 2946 */ 2947void prepare(); 2948 2949/** 2950 * Dump all statistics data to the registered outputs 2951 */ | 2936/** Dump all statistics data to the registered outputs */ |
2952void dump(); | 2937void dump(); |
2938void reset(); |
|
2953 2954/** | 2939 2940/** |
2955 * Reset all statistics to the base state 2956 */ 2957void reset(); 2958/** | |
2959 * Register a callback that should be called whenever statistics are 2960 * reset 2961 */ 2962void registerResetCallback(Callback *cb); 2963 2964std::list<Info *> &statsList(); 2965 2966} // namespace Stats 2967 2968#endif // __BASE_STATISTICS_HH__ | 2941 * Register a callback that should be called whenever statistics are 2942 * reset 2943 */ 2944void registerResetCallback(Callback *cb); 2945 2946std::list<Info *> &statsList(); 2947 2948} // namespace Stats 2949 2950#endif // __BASE_STATISTICS_HH__ |