ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Namespaces
benchmarks.py File Reference

Run benchmarks macros. More...

Go to the source code of this file.

Namespaces

 benchmarks
 

Detailed Description

Run benchmarks macros.

pict1_benchmarks.py.png
1 
2 import os, sys
3 import ROOT
4 
5 ROOT.SetSignalPolicy( ROOT.kSignalFast )
6 
7 ### macro files
8 macros = [
9  'framework.py', 'hsimple.py', 'hsum.py', 'formula1.py',
10  'fillrandom.py','fit1.py', 'h1draw.py', 'graph.py',
11  'gerrors.py', 'tornado.py', 'surfaces.py', 'zdemo.py',
12  'geometry.py', 'na49view.py', 'file.py',
13  'ntuple1.py', 'rootmarks.py' ]
14 
15 ### note: this function is defined in tutorials/rootlogon.C
16 def bexec( dir, macro, bench ):
17  if ROOT.gROOT.IsBatch():
18  print 'Processing benchmark: %s\n' % macro
19 
20  summary = bench.GetPrimitive( 'TPave' )
21  tmacro = summary.GetLineWith( macro )
22  if tmacro:
23  tmacro.SetTextColor( 4 )
24  bench.Modified()
25  bench.Update()
26 
27  execfile( os.path.join( macrodir, macro ), sys.modules[ __name__ ].__dict__ )
28 
29  summary2 = bench.GetPrimitive( 'TPave' )
30  tmacro2 = summary2.GetLineWith( macro )
31  if tmacro2:
32  tmacro2.SetTextColor( 2 )
33  bench.Modified()
34  bench.Update()
35 
36 
37 ### --------------------------------------------------------------------------
38 if __name__ == '__main__':
39 
40  try:
41  # convenience, allowing to run this file from a different directory
42  macrodir = os.path.dirname( os.path.join( os.getcwd(), __file__ ) )
43  except NameError:
44  macrodir = '' # in case of p2.2
45 
46  # window for keeping track of bench marks that are run
47  bench = ROOT.TCanvas( 'bench','Benchmarks Summary', -1000, 50, 200, 500 )
48  summary = ROOT.TPaveText( 0, 0, 1, 1 )
49  summary.SetTextAlign( 12 )
50  summary.SetTextSize( 0.1 )
51  summary.Draw()
52 
53  for m in macros:
54  summary.AddText( ' ** %s' % m )
55 
56  # run benchmarks, the last one (rootmarks.py) results in a report
57  for m in macros:
58  bexec( macrodir, m, bench )
Author
Wim Lavrijsen

Definition in file benchmarks.py.