Hello
I have problem with function 'time' to test my program for file copying .
How to run the function in my source code ?
I try something like that:
system("time"); < -- but this don't working
Hello
I have problem with function 'time' to test my program for file copying .
How to run the function in my source code ?
I try something like that:
system("time"); < -- but this don't working
You should try with API "times".
%man 2 times
Best regards,
Iliyan Varshilov
From the command line:
time mycopyprog arg1 arg2
real 0m0.03s
user 0m0.01s
sys 0m0.03s
reports the wall clock time, and time in kernel and user mode.
Use a profiler
cc -p -g mycopyprog.c -o mycopyprog
mycopyprog arg1 arg2
prof mycopyprog
... lines of output
-- with gcc use the same options, but use grpof instead of prof
Or: call gettimeofday before the copy function is called, and then call it again after.
Subtract the two timeval structs to get the time.
man gettimeofday