23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Athena</strong> Chapter 13 Framework services Version/Issue: 2.0.0<br />

13.6 The Chrono & Stat service<br />

The Chrono & Stat service provides a facility to do time profiling of code (Chrono part) and to do some<br />

statistical monitoring of simple quantities (Stat part). The service is created by default by the<br />

Application Manager, with the name “ChronoStatSvc” and service ID extern const CLID&<br />

IID_IChronoStatSvc To access the service from inside an algorithm, the member function<br />

chronoSvc() is provided. The job options to configure this service are described in Appendix B,<br />

Table B.19.<br />

13.6.1 Code profiling<br />

Profiling is performed by using the chronoStart() and chronoStop() methods inside the codes<br />

to be profiled, e.g:<br />

/// ...<br />

IChronoStatSvc* svc = chronoSvc();<br />

/// start<br />

svc->chronoStart( "Some Tag" );<br />

/// here some user code are placed:<br />

...<br />

/// stop<br />

svc->chronoStop( "SomeTag" );<br />

The profiling information accumulates under the tag name given as argument to these methods. The<br />

service measures the time elapsed between subsequent calls of chronoStart() and<br />

chronoStop() with the same tag. The latter is important, since in the sequence of calls below, only<br />

the elapsed time between lines 3 and 5 lines and between lines 7 and 9 lines would be accumulated.:<br />

1: svc->chronoStop("Tag");<br />

2: svc->chronoStop("Tag");<br />

3: svc->chronoStart("Tag");<br />

4: svc->chronoStart("Tag");<br />

5: svc->chronoStop("Tag");<br />

6: svc->chronoStop("Tag");<br />

7: svc->chronoStart("Tag");<br />

8: svc->chronoStart("Tag");<br />

9: svc->chronoStop("Tag");<br />

The profiling information could be printed either directly using the chronoPrint() method of the<br />

service, or in the summary table of profiling information at the end of the job.<br />

page 110<br />

Note that this method of code profiling should be used only for fine grained monitoring inside<br />

algorithms. To profile a complete algorithm you should use the Auditor service, as described in section<br />

13.7.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!