diff options
author | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2000-09-13 13:49:13 +0000 |
---|---|---|
committer | tradke <tradke@21a6bef8-4479-4f54-8f8d-0db94a2919ef> | 2000-09-13 13:49:13 +0000 |
commit | 8fe367ecf2cbda79960a68a052fdb84916427c0e (patch) | |
tree | 45c017765ab7f0eb6caf97540fc76ffd3bffba59 /src/Timer.hh | |
parent | c490022d592551af7c29bc960cbbc09daf45972d (diff) |
Importing latest stuff from development repository
git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@2 21a6bef8-4479-4f54-8f8d-0db94a2919ef
Diffstat (limited to 'src/Timer.hh')
-rw-r--r-- | src/Timer.hh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Timer.hh b/src/Timer.hh new file mode 100644 index 0000000..e801cf3 --- /dev/null +++ b/src/Timer.hh @@ -0,0 +1,39 @@ +#ifndef __TIMER_HH_ +#define __TIMER_HH_ +#include <stdio.h> +#include <sys/types.h> +#include <sys/times.h> +#include <sys/time.h> + +class Timer { + int running; + double treal,tuser,tsystem; + tms tm; + timeval tv; +public: + Timer() { reset(); } + void reset(){ + treal=tuser=tsystem=0; + running=0; + } + int start(); + int stop(); + void elapsedTimeSeconds(double &system,double &user,double &real); + void elapsedTimeSeconds(float &system,float &user,float &real){ + double s,u,r; + elapsedTimeSeconds(s,u,r); + system=s; user=u; real=r; + } + void print(char *preface="",FILE *f=stdout); +}; + +class Counter { + int count; +public: + Counter():count(0){} + void reset() {count = 0;} + int incr(){ return count++;} + int nCount() { return count;} +}; + +#endif |