About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/toc.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 toc Context: slangrtl

Synopsis

Get elapsed CPU time

Syntax

Double_Type toc ()

Description

The toc function returns the elapsed CPU time in seconds since the last call to tic. The CPU time is the amount of time the CPU spent running the code of the current process.

Example

The tic and toc functions are ideal for timing the execution of the interpreter:

     variable a = "hello", b = "world", c, n = 100000, t;

     tic ();  loop (n) c = a + b; t = toc ();
     vmessage ("a+b took %f seconds\n", t);
     tic ();  loop (n) c = strcat(a,b); t = toc ();
     vmessage ("strcat took %f seconds\n", t);

This function may not be available on all systems.

The implementation of this function is based upon the times system call. The precision of the clock is system dependent.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.