32#ifndef _util_misc_regtime_h
33#define _util_misc_regtime_h
37#include <util/class/class.h>
45 TimedRegion *subregions_;
55 TimedRegion *insert_after(
const char *name);
56 TimedRegion *insert_before(
const char *name);
58 TimedRegion(
const char *name);
60 const char *name()
const {
return name_; }
61 TimedRegion *findinsubregion(
const char *);
62 void cpu_enter(
double);
63 void wall_enter(
double);
64 void flops_enter(
double);
65 void cpu_exit(
double);
66 void wall_exit(
double);
67 void flops_exit(
double);
68 void cpu_add(
double t) { cpu_time_ += t; }
69 void wall_add(
double t) { wall_time_ += t; }
70 void flops_add(
double t) { flops_ += t; }
71 TimedRegion *up()
const {
return up_; }
72 TimedRegion *subregions()
const {
return subregions_; }
73 TimedRegion *next()
const {
return next_; }
74 TimedRegion *prev()
const {
return prev_; }
77 void get_region_names(
const char *names[]);
78 void get_wall_times(
double *);
79 void get_cpu_times(
double *);
80 void get_flops(
double *);
81 void get_depth(
int *,
int depth = 0);
89class RegionTimer:
public DescribedClass {
100 RegionTimer(
const char *topname =
"total",
101 int cpu_time = 0,
int wall_time = 1);
104 void enter(
const char * = 0);
105 void change(
const char *newname,
const char * oldname = 0);
106 void exit(
const char * = 0,
bool do_not_throw =
false);
107 void set_default(
const char *);
108 void unset_default();
109 void enter_default();
113 void update_top()
const;
116 void get_region_names(
const char *names[])
const;
117 void get_wall_times(
double *)
const;
118 void get_cpu_times(
double *)
const;
119 void get_flops(
double *)
const;
120 void get_depth(
int *)
const;
122 double get_wall_time()
const;
123 double get_cpu_time()
const;
124 double get_flops()
const;
126 void add_wall_time(
const char *,
double);
127 void add_cpu_time(
const char *,
double);
128 void add_flops(
const char *,
double);
130 static RegionTimer *default_regiontimer();
static std::ostream & out0()
Return an ostream that writes from node 0.
A template class that maintains references counts.
Definition ref.h:332
virtual void print(std::ostream &=ExEnv::out0()) const
Print the object.
~Timer()
Stop timing a region, if active.
void reset(const char *=0)
Stop timing the current region, if active.
Timer(const char *name)
Start timing a region using the default RegionTimer and activate the timer.
Timer(const Ref< RegionTimer > &, const char *name)
Start timing a region using the given RegionTimer.