Changeset View
Changeset View
Standalone View
Standalone View
agent/protect.c
Context not available. | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <time.h> | |||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
Context not available. | |||||
&data->creation_time, &data->exit_time, | &data->creation_time, &data->exit_time, | ||||
&data->kernel_time, &data->user_time); | &data->kernel_time, &data->user_time); | ||||
# endif | # endif | ||||
#else | #elif defined (CLOCK_THREAD_CPUTIME_ID) | ||||
struct tms tmp; | struct timespec tmp; | ||||
times (&tmp); | clock_gettime (CLOCK_THREAD_CPUTIME_ID, &tmp); | ||||
data->ticks = tmp.tms_utime; | data->ticks = (clock_t)(((unsigned long long)tmp.tv_sec * 1000000000 + | ||||
tmp.tv_nsec) * CLOCKS_PER_SEC / 1000000000); | |||||
#else | |||||
data->ticks = clock (); | |||||
#endif | #endif | ||||
} | } | ||||
Context not available. | |||||
} | } | ||||
#else | #else | ||||
return (unsigned long)((((double) (stoptime.ticks - starttime->ticks)) | return (unsigned long)((((double) (stoptime.ticks - starttime->ticks)) | ||||
/CLOCKS_PER_SEC)*10000000); | /CLOCKS_PER_SEC)*1000); | ||||
#endif | #endif | ||||
} | } | ||||
Context not available. |