cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

yy1990cn
Journeyman III

How to measure the total elapsed time?

I've written a OpenCL program, when I measure this program with time in bash, it gives me the following output:

real0m1.141s
user0m0.167s
sys0m0.097s
user+sys0m0.264s

and then I measure the same program in CodeXL, it shows that the total elapsed time is 0.077s. which one is more accurate? what is the best way to measure the total elapsed time of OpenCL programs? thx.

0 Likes
2 Replies
benc
Staff

Hello yy1990cn

What do you use in codeXL to measure your execution time?

CodeXL can profile in 2 different mode :

     1) HW counter, which will give you the time spent in the GPU and only the GPU

     2) API trace which will also give you the time spent in the driver/OS. In API trace you can see when you issue a specific command on host and when it was actually flushed to the GPU but also when it finished.

Here I bet you measured only the GPU execution time using codeXL, while in bash you measurethe CPU time so actually you see the overhead of the driver/OS

Ben

0 Likes
yy1990cn
Journeyman III

thanks for your reply. I use Application Timeline Trace to measure the program. the total elapsed time is 77ms, and the kernel's duration is 0.097ms

0 Likes