33 #ifndef MADNESS_WORLD_WORLDPROFILE_H__INCLUDED
34 #define MADNESS_WORLD_WORLDPROFILE_H__INCLUDED
55 ProfileStat() : value(0), max(0), min(0), sum(0), pmax(0), pmin(0) {}
59 max = min = sum =
value;
65 if (other.
max > max) {
69 if (other.
min < min) {
78 value = max = min = sum = 0;
82 template <
class Archive>
84 ar & value & max & min & sum & pmax &
pmin;
113 template <
class Archive>
115 ar & name & depth & count & xcpu &
icpu;
125 volatile static std::vector<WorldProfileEntry> items;
127 static double cpu_start;
128 static double wall_start;
130 static std::vector<WorldProfileEntry>& nvitems();
142 static int register_id(
const char* classname,
const char*
function);
163 const double cpu_base;
170 void pause(
double now);
179 #ifdef WORLD_PROFILE_ENABLE
180 # define PROFILE_STRINGIFY(s) #s
182 # define PROFILE_BLOCK(name) \
183 static const int __name##_id=madness::WorldProfile::register_id(PROFILE_STRINGIFY(name)); \
184 madness::WorldProfileObj name(__name##_id)
186 # define PROFILE_FUNC \
187 static const int __profile_id=madness::WorldProfile::register_id(__FUNCTION__); \
188 madness::WorldProfileObj __profile_obj(__profile_id)
190 # define PROFILE_MEMBER_FUNC(classname) \
191 static const int __profile_id=madness::WorldProfile::register_id(PROFILE_STRINGIFY(classname), __FUNCTION__); \
192 madness::WorldProfileObj __profile_obj(__profile_id)
197 # define PROFILE_BLOCK(name)
198 # define PROFILE_FUNC
199 # define PROFILE_MEMBER_FUNC(classname)
203 #endif // MADNESS_WORLD_WORLDPROFILE_H__INCLUDED
T max
Definition: worldprofile.h:51
Simple container for parallel profile statistic.
Definition: worldprofile.h:50
void resume(double now)
Resume profiling.
Definition: worldprofile.cc:308
#define thread_local
Definition: config.h:418
Definition: worldprofile.h:159
ProfileStat< double > icpu
inclusive cpu call (i.e., including calls)
Definition: worldprofile.h:95
T min
Definition: worldprofile.h:51
::std::string string
Definition: gtest-port.h:872
Used to store profiler info.
Definition: worldprofile.h:89
static void clear()
Clears all profiling information.
Definition: worldprofile.cc:134
~WorldProfileObj()
Definition: worldprofile.cc:312
std::string name
name of the entry
Definition: worldprofile.h:90
void serialize(const Archive &ar)
Definition: worldprofile.h:83
static bool inclusivecmp(const WorldProfileEntry &a, const WorldProfileEntry &b)
Definition: worldprofile.cc:68
WorldProfileObj(int id)
Definition: worldprofile.cc:294
void pause(double now)
Pause profiling while we are not executing ... accumulate time in self.
Definition: worldprofile.cc:302
void init_par_stats(ProcessID me)
Definition: worldprofile.cc:72
static bool exclusivecmp(const WorldProfileEntry &a, const WorldProfileEntry &b)
Definition: worldprofile.cc:64
int depth
depth of recursive calls (0 if no active calls)
Definition: worldprofile.h:91
void clear()
Definition: worldprofile.cc:84
T sum
Definition: worldprofile.h:51
WorldProfileEntry(const char *name="")
Definition: worldprofile.cc:47
static void print(World &world)
Prints global profiling information. Global fence involved. Implemented in worldstuff.cc.
Definition: worldprofile.cc:203
WorldProfileEntry & operator=(const WorldProfileEntry &other)
Definition: worldprofile.cc:55
Singleton-like class for holding profiling data and functionality.
Definition: worldprofile.h:123
const T1 &f1 return GTEST_2_TUPLE_() T(f0, f1)
ProfileStat< double > xcpu
exclusive cpu time (i.e., excluding calls)
Definition: worldprofile.h:94
FLOAT a(int j, FLOAT z)
Definition: y1.cc:86
static WorldProfileEntry & get_entry(int id)
Returns a reference to the specified entry. Throws if id is invalid.
Definition: worldprofile.cc:145
void init_par_stats(ProcessID me)
Copies local stats into parallel stats in prep for global reduction.
Definition: worldprofile.h:58
Implements Mutex, MutexFair, Spinlock, ConditionVariable.
A parallel world with full functionality wrapping an MPI communicator.
Definition: worldfwd.h:416
int ProcessID
Used to clearly identify process number/rank.
Definition: worldtypes.h:37
static int register_id(const char *name)
Returns id for the name, registering if necessary.
Definition: worldprofile.cc:109
ProcessID pmax
Definition: worldprofile.h:52
void par_reduce(const ProfileStat< T > &other)
Reduction of parallel data (max, min, sum)
Definition: worldprofile.h:64
ProfileStat< unsigned long > count
count of times called
Definition: worldprofile.h:93
ProcessID pmin
Definition: worldprofile.h:52
T value
Definition: worldprofile.h:51
Spinlock using pthread spinlock operations.
Definition: worldmutex.h:200
void par_reduce(const WorldProfileEntry &other)
Definition: worldprofile.cc:78
Holds machinery to set up Functions/FuncImpls using various Factories and Interfaces.
Definition: chem/atomutil.cc:45
void clear()
Zeros all data.
Definition: worldprofile.h:77
FLOAT b(int j, FLOAT z)
Definition: y1.cc:79
void serialize(const Archive &ar)
Definition: worldprofile.h:114
ProfileStat()
Constructor initializes all members to zero.
Definition: worldprofile.h:55