[Tutor] I can't believe this needs to be this complex

Alan Gauld alan.gauld at btinternet.com
Sat Aug 2 19:08:44 CEST 2008


"Dick Moores" <rdm at rcblue.com> wrote

> BTW Kent, I'm going to take this opportunity to ask you about 
> "System" in the IPython timing results. It's always zero for the 
> code I time. What's an example of code that would have System be 
> greater than zero? And what's the distinction between User and 
> System? (I'm using Win XP, if that's relevant.)

In timing user time is time that the CPU spends executing user
code - your program. System time is time the CPU spends doing
OS things.

If your code had a blocking call that waited for input on a port say,
then the OS might be doing other stuff in the background while
your code waited. This would show as system time.
In some OR even time spent reading files from disk is
counted as system time because your code is executing
low level OS functions.

Try timing a function that does nothing but read a large file.
See if there is any system time showing up. Or time a GUI
app that waits for user input...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list