Message Boards Message Boards

0
|
5399 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Timing[] That Counts All Expired Time

Posted 11 years ago

Hi All, I was exploring some of the new curated data provided by the EntityValue[] function, and wanted to see how much time calls to various domains of data actually take. So I used Timing[].

What Timing[] was reporting was in fact a lot less than reality, and a glance at the documentation showed this is because Timing[] only shows local CPU time used by the application. Outside-kernal calls (which calls to curated data must be part of) aren't included.

After a careful search, I couldn't find a single function that returns total expired time, regardless of whose machine is doing the thinking.

Anyone know of such a function?

POSTED BY: Brad Varey
3 Replies

Something that also may be useful is AccurateTiming from GeneralUtilities`.

Needs["GeneralUtilities`"]

?AccurateTiming

AccurateTiming[body ] evaluates body  enough times to give an accurate time profile, giving the average time taken it takes to execute.

Now, this does not take care of your problem directly, but it can be useful in getting a sense of how long something takes that is of variable clock time. You can do this by having AccurateTiming do a timing of an AbsoluteTime call. Here is a trivial example:

In[45]:= First@Timing[Pause[.1];]

Out[45]= 0.004147

In[46]:= First@AbsoluteTiming[Pause[.1];]

Out[46]= 0.101146

In[47]:= AccurateTiming[First@AbsoluteTiming[Pause[.1];]]

Out[47]= 0.100612

And here is something more like a case where the function that is being called an take a variable amount of time:

In[52]:= Options[AccurateTiming]

Out[52]= {TimeConstraint -> 1., MaxIterations -> 1024}

In[53]:= AccurateTiming[First@AbsoluteTiming[Pause[Random[]];], 
 TimeConstraint -> 20]

Out[53]= 0.51018
POSTED BY: David Reiss

AbsoluteTiming measures the wall time it takes to evaluate an expression. It does not however measure the time needed to convert the result to box form (ToBoxes) and render the result on screen, which may be significant in some rare cases.

Timing indeed measures the CPU time. What's also notable about it is that it adds the time used by separate CPU cores---e.g. if 2 cores each worked for 30 seconds, it will report 60 seconds.

POSTED BY: Szabolcs Horvát

Hi,

AbsoluteTiming[] should do what you need.

I.M.

POSTED BY: Ivan Morozov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract