1 /* timing.c - timing bdb2 backend */
12 #include "back-bdb2.h"
16 bdb2i_elapsed( struct timeval firsttime, struct timeval secondtime )
18 long int elapsedmicrosec, elapsedsec;
19 char elapsed_string[BUFSIZ];
21 elapsedsec = secondtime.tv_sec - firsttime.tv_sec;
22 elapsedmicrosec = secondtime.tv_usec - firsttime.tv_usec;
23 if(elapsedmicrosec < 0) {
24 elapsedmicrosec += 1000000;
28 sprintf( elapsed_string, "%ld.%.6ld", elapsedsec, elapsedmicrosec );
29 return( ch_strdup( elapsed_string ));
34 bdb2i_uncond_start_timing(
38 gettimeofday( time1, NULL );
43 bdb2i_uncond_stop_timing(
57 gettimeofday( &time2, NULL);
58 elapsed_time = bdb2i_elapsed( time1, time2 );
60 if ( conn != NULL ) sprintf( buf, "conn=%d ", conn->c_connid );
61 if ( op != NULL ) sprintf( buf, "%sop=%d ", buf, op->o_opid );
63 Debug( level, "%s%s elapsed=%s\n", buf, func, elapsed_time );