git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13937 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-08-28 20:00:56 +00:00
parent 962dd0da74
commit ce59e32d1c
189 changed files with 1526 additions and 587 deletions

View File

@ -16,26 +16,60 @@
#include "pointers.h"
enum{TIME_LOOP,TIME_PAIR,TIME_BOND,TIME_KSPACE,TIME_NEIGHBOR,
TIME_COMM,TIME_OUTPUT,TIME_N};
namespace LAMMPS_NS {
class Timer : protected Pointers {
public:
double *array;
enum ttype {RESET=-2,START=-1,TOTAL=0,PAIR,BOND,KSPACE,NEIGH,COMM,
MODIFY,OUTPUT,SYNC,ALL,DEPHASE,DYNAMICS,QUENCH,NEB,REPCOMM,
REPOUT,NUM_TIMER};
enum tlevel {OFF=0,LOOP,NORMAL,FULL};
Timer(class LAMMPS *);
~Timer();
~Timer() {};
void init();
void stamp();
void stamp(int);
void barrier_start(int);
void barrier_stop(int);
double elapsed(int);
// inline function to reduce overhead if we want no detailed timings
void stamp(enum ttype which=START) {
if (_level > LOOP) _stamp(which);
}
void barrier_start();
void barrier_stop();
// accessor methods for supported level of detail
bool has_loop() const { return (_level >= LOOP); }
bool has_normal() const { return (_level >= NORMAL); }
bool has_full() const { return (_level >= FULL); }
bool has_sync() const { return (_sync != OFF); }
double elapsed(enum ttype);
double cpu(enum ttype);
double get_cpu(enum ttype which) const {
return cpu_array[which]; };
double get_wall(enum ttype which) const {
return wall_array[which]; };
void set_wall(enum ttype, double);
void modify_params(int, char **);
private:
double previous_time;
double cpu_array[NUM_TIMER];
double wall_array[NUM_TIMER];
double previous_cpu;
double previous_wall;
int _level; // level of detail: off=0,loop=1,normal=2,full=3
int _sync; // if nonzero, synchronize tasks before setting the timer
// update requested timer array
void _stamp(enum ttype);
};
}