| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#ifndef eslSTOPWATCH_INCLUDED |
| 8 |
#define eslSTOPWATCH_INCLUDED |
| 9 |
#include <esl_config.h> |
| 10 |
|
| 11 |
#include <time.h> |
| 12 |
#ifdef HAVE_TIMES |
| 13 |
#include <sys/times.h> |
| 14 |
#endif |
| 15 |
#ifdef HAVE_UNISTD_H |
| 16 |
#include <unistd.h> |
| 17 |
#endif |
| 18 |
|
| 19 |
typedef struct { |
| 20 |
#ifdef eslSTOPWATCH_HIGHRES |
| 21 |
double t0; |
| 22 |
#elif HAVE_TIMES |
| 23 |
clock_t t0; |
| 24 |
#else |
| 25 |
time_t t0; |
| 26 |
#endif |
| 27 |
|
| 28 |
#ifdef HAVE_TIMES |
| 29 |
struct tms cpu0; |
| 30 |
#else |
| 31 |
clock_t cpu0; |
| 32 |
#endif |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
double elapsed; |
| 38 |
double user; |
| 39 |
double sys; |
| 40 |
} ESL_STOPWATCH; |
| 41 |
|
| 42 |
|
| 43 |
extern ESL_STOPWATCH *esl_stopwatch_Create(void); |
| 44 |
extern void esl_stopwatch_Destroy(ESL_STOPWATCH *w); |
| 45 |
|
| 46 |
extern int esl_stopwatch_Start(ESL_STOPWATCH *w); |
| 47 |
extern int esl_stopwatch_Stop(ESL_STOPWATCH *w); |
| 48 |
extern int esl_stopwatch_Display(FILE *fp, ESL_STOPWATCH *w, char *prefix); |
| 49 |
|
| 50 |
extern double esl_stopwatch_GetElapsed(ESL_STOPWATCH *w); |
| 51 |
|
| 52 |
extern int esl_stopwatch_Include(ESL_STOPWATCH *master, ESL_STOPWATCH *w); |
| 53 |
|
| 54 |
|
| 55 |
#endif |
| 56 |
|
| 57 |
|