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" |
64#include "base/stats/types.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 |
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 |
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 |
2936/** Dump all statistics data to the registered outputs */ |
2937void dump(); |
2938void reset(); |
2939 2940/** |
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__ |