question on timing results
Matthew Saltzman
mjs at ces.clemson.edu
Thu Jun 9 13:57:34 UTC 2005
On Thu, 9 Jun 2005, Globe Trotter wrote:
>
>>> clock() returns an approximation of the CPU time used by the actual
>> process,
>>> so while load from other programs is a factor (particularly since it'll
>> make
>>> your program wait for IO, etc.) it should do basically what you want.
>>
>> Also check out the times(2) facility. It's not ISO C, but it is POSIX and
>> it has some advantages over clock(3).
>>
>> --
>>
>
> Thanks, what exactly are the advantages? These are sometimes long
> calculations so the processor will be running for long. Also, is there
clock() will wrap after about 75 CPU minutes. I believe times() will not.
Also times() tracks user and system time separately, and it tracks parent
and child process times separately.
> an example on using times(2) somewhere? A Google search on times(2)
> example C did not reveal much, but the choice of keywords may not have
> been apt. (One problem with the name of the language called C is that is
> just a letter, as opposed to fortran/C++/pascal et al, which is more
> distinctive.
Don't know of a handy URL, sorry. The man page ("man 2 times") and a
little experimentation should be enough.
>
> Sorry and thanks for all the help!
>
> Best wishes!
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs
More information about the users
mailing list