Skip to content
Snippets Groups Projects
Commit e99f2d2d authored by Moe Jette's avatar Moe Jette
Browse files

Add function to report delta time as part of event timing functions.

parent 33b11c4d
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,20 @@ inline void diff_tv_str(struct timeval *tv1,struct timeval *tv2,
info("Warning: Note very large processing time: %s",tv_str);
}
/*
* diff_tv - return the difference between two times
* IN tv1 - start of event
* IN tv2 - end of event
* RET time in micro-seconds
*/
inline long diff_tv(struct timeval *tv1, struct timeval *tv2)
{
long delta_t;
delta_t = (tv2->tv_sec - tv1->tv_sec) * 1000000;
delta_t += tv2->tv_usec - tv1->tv_usec;
return delta_t;
}
/*
* slurmctld_req - Process an individual RPC request
* IN/OUT msg - the request message, data associated with the message is freed
......
......@@ -38,11 +38,13 @@
# define START_TIMER gettimeofday(&tv1, NULL)
# define END_TIMER gettimeofday(&tv2, NULL); \
diff_tv_str(&tv1, &tv2, tv_str, 20)
# define DELTA_TIMER diff_tv(&tv1, &tv2)
# define TIME_STR tv_str
#else
# define DEF_TIMERS int tv1, tv2, tv_str
# define START_TIMER tv1 = 0
# define END_TIMER tv2 = tv_str = 0
# define DELTA_TIMER 0L
# define TIME_STR ""
#endif
......@@ -56,6 +58,14 @@
extern inline void diff_tv_str(struct timeval *tv1,struct timeval *tv2,
char *tv_str, int len_tv_str);
/*
* diff_tv - return the difference between two times
* IN tv1 - start of event
* IN tv2 - end of event
* RET time in micro-seconds
*/
inline long diff_tv(struct timeval *tv1, struct timeval *tv2);
/*
* slurmctld_req - Process an individual RPC request
* IN/OUT msg - the request message, data associated with the message is freed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment