[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave compared to Matlab

From: John W. Eaton
Subject: Re: Octave compared to Matlab
Date: Tue, 18 Aug 1998 10:01:00 -0500 (CDT)

On 18-Aug-1998, Mario Storti <address@hidden> wrote:

| Question: Is the time spent in checking a time stamp counted as CPU
| time?

 - Built-in Function: [TOTAL, USER, SYSTEM] = cputime ();
     Return the CPU time used by your Octave session.  The first output
     is the total time spent executing your process and is equal to the
     sum of second and third outputs, which are the number of CPU
     seconds spent executing in user mode and the number of CPU seconds
     spent executing in system mode, respectively.  If your system does
     not have a way to report CPU time usage, `cputime' returns 0 for
     each of its output values.  Note that because Octave used some CPU
     time to start, it is reasonable to check to see if `cputime' works
     by checking to see if the total CPU time used is nonzero.

Octave calls stat(2) to get the time stamp information.  The time
spent executing stat should be counted as `system' time.  So yes, if
you just get the total CPU time, you will also see the time spent
checking time stamps, opening, reading, and writing files, etc.

I usually use something like

  t = cputime ();
  ... code ...
  elapsed = cputime () - t;

to get elapsed CPU time info for a section of code.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]