I have the next easy function in order to measure the computational time by process:
double get_cpu_time()
{
//LINUX
const static int64_t NANOS_PER_SEC = 1000000000L;
struct timespec time;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time);
return (((int64_t) time.tv_sec) * NANOS_PER_SEC) + ((int64_t) time.tv_nsec);
}
ini_time = get_cepu_time();
//intesive computation code
end_time = get_cepu_time();
end_time = end_time - ini_time
;
This function return the computational time of each process, in a simple equation could be suach as:
Tcomp = Tcpu + Taccmen => inst * ILP + #miss cache * Latency time
In interesting in obtain only the Tcpu time (time executing instruction without consider time for looking for the data), do you know any function in order to obtain this time, or a function that return the memory access time, then I could sustract( tcomp - Taccmem)
best regards,
Jen