yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07312
[Branch ~yade-dev/yade/trunk] Rev 2791: 1. Color output for --performance tests is added.
------------------------------------------------------------
revno: 2791
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-03-18 16:21:32 +0100
message:
1. Color output for --performance tests is added.
modified:
scripts/test/performance/checkPerf.py
--
lp:yade
https://code.launchpad.net/~yade-dev/yade/trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'scripts/test/performance/checkPerf.py'
--- scripts/test/performance/checkPerf.py 2011-03-16 16:09:44 +0000
+++ scripts/test/performance/checkPerf.py 2011-03-18 15:21:32 +0000
@@ -3,6 +3,25 @@
from yade import utils,pack,export,geom,timing,bodiesHandling
import time,numpy
+class bcolors:
+ # color output
+ # http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
+ HEADER = '\033[95m'
+ OKBLUE = '\033[94m'
+ OKGREEN = '\033[92m'
+ WARNING = '\033[93m'
+ FAIL = '\033[91m'
+ ENDC = '\033[0m'
+
+ def disable(self):
+ self.HEADER = ''
+ self.OKBLUE = ''
+ self.OKGREEN = ''
+ self.WARNING = ''
+ self.FAIL = ''
+ self.ENDC = ''
+
+
radRAD=[23.658, #5000 elements
40.455, #25000 elements
50.97, #50000 elements
@@ -76,7 +95,7 @@
NewtonIntegrator(damping=0),
]
- print "number of bodies %d"%len(O.bodies)
+ print bcolors.HEADER + "number of bodies %d"%len(O.bodies) + bcolors.ENDC
O.timingEnabled=True
tStart=time.time()
@@ -88,7 +107,7 @@
print 'Elapsed ', tEnd-tStart, ' sec'
print 'Performance ', nbIter/(tEnd-tStart), ' iter/sec'
print 'Extrapolation on 1e5 iters ', (tEnd-tStart)/nbIter*1e5/3600., ' hours'
- print
+ print bcolors.OKGREEN + "=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*" + bcolors.ENDC
timing.stats()
iterVel += [nbIter/(tEnd-tStart)]
testTime += [tEnd-tStart]
@@ -118,7 +137,7 @@
print
print
scoreIterVel = int(scoreIterVel)
-print scoreIterVel
+print bcolors.FAIL + "SCORE: " + scoreIterVel + bcolors.ENDC
print "Number of threads ", os.environ['OMP_NUM_THREADS']
print"___________________________________________________"
print "CPU info", os.system('cat /proc/cpuinfo')