Re: How to get time consuming in a macro

From: Dario Berzano <l3g3nd4ryf0x_at_gmail.com>
Date: Sat, 18 Jul 2009 16:01:42 +0200


2009/7/18 Bian JianMing <bianjm_at_ihep.ac.cn>:
> Who would tell me how to get time(consuming time or current time) in a macro?

Hi,

  in order to measure real time and CPU time you can use TStopwatch (http://root.cern.ch/root/html/TStopwatch.html), whose usage is straightforward:

TStopwatch t;
t.Start();
// your code goes here
t.Stop();
t.Print();

Instead, if you want to get current date and time, you can use TTimeStamp (http://root.cern.ch/root/html/TTimeStamp.html):

TTimeStamp ts;
cout << ts.AsString() << endl;

Cheers,

-- 
: Dario Berzano
: Wiki: http://newton.ph.unito.it/~berzano
: GPG: http://newton.ph.unito.it/~berzano/gpg
Received on Sat Jul 18 2009 - 16:02:08 CEST

This archive was generated by hypermail 2.2.0 : Sat Jul 18 2009 - 23:50:02 CEST