mellanox-hpc / libibprof

verbs profiling library
BSD 3-Clause "New" or "Revised" License
20 stars 9 forks source link

Timer issues on ppc #16

Open janjust opened 7 years ago

janjust commented 7 years ago

It seems on ppc systems the following is not compatible.

 73 double ibprof_timestamp(void)
 74 {
 75 #if defined(CONF_TIMESTAMP) && (CONF_TIMESTAMP == 1)
 76     return ((double)sys_rdtsc() / __get_cpu_clocks_per_sec());
 77 #else
 78     struct timeval tv;
 79
 80     sys_time(&tv);
 81
 82     return ((tv.tv_sec) + (tv.tv_usec) * 1.0e-6);
 83 #endif
 84 }

I had to disable the CONF_TIMESTAMP define and rely solely on sys_time to get correct timing data.

igor-ivanov commented 7 years ago

@janjust thank you for sharing your observation. Do you see issue with sys_rdtsc() or __get_cpu_clocks_per_sec()?

janjust commented 7 years ago

@igor-ivanov I think sys_rdtsc, that's intel specific.

shssf commented 7 years ago

@janjust @igor-ivanov I'm not completely sure how it stable or not on PPC but I would propose following:

    timespec time;
    int result = clock_gettime(CLOCK_MONOTONIC, &time);
    return time.tv_sec * 1E9 + time.tv_nsec;

It shows good, stable results at least on modern Intel architectures.