Can clock() be used as a dependable API to measure time taken by CPU to execute a snippet of code? When verified usng times() / clock(), both do not seem to measure the CPU
you can use clock_t to get the number of CPU ticks since the program started.
clock_t
Or you can use the linux time command. eg: time [program] [arguments]
time