Browse Source

Output time used in internal/external execution.

Heikki Hokkanen 18 years ago
parent
commit
5e9c722ef5
1 changed files with 11 additions and 2 deletions
  1. 11
    2
      gitstats

+ 11
- 2
gitstats View File

12
 
12
 
13
 GNUPLOT_COMMON = 'set terminal png transparent\nset size 0.5,0.5\n'
13
 GNUPLOT_COMMON = 'set terminal png transparent\nset size 0.5,0.5\n'
14
 
14
 
15
+exectime_internal = 0.0
16
+exectime_external = 0.0
17
+time_start = time.time()
18
+
15
 def getoutput(cmd, quiet = False):
19
 def getoutput(cmd, quiet = False):
20
+	global exectime_external
21
+	start = time.time()
16
 	if not quiet:
22
 	if not quiet:
17
-		start = time.time()
18
 		print '>> %s' % cmd,
23
 		print '>> %s' % cmd,
19
 		sys.stdout.flush()
24
 		sys.stdout.flush()
20
 	output = commands.getoutput(cmd)
25
 	output = commands.getoutput(cmd)
26
+	end = time.time()
21
 	if not quiet:
27
 	if not quiet:
22
-		end = time.time()
23
 		print '\r[%.5f] >> %s' % (end - start, cmd)
28
 		print '\r[%.5f] >> %s' % (end - start, cmd)
29
+	exectime_external += (end - start)
24
 	return output
30
 	return output
25
 
31
 
26
 def getkeyssortedbyvalues(dict):
32
 def getkeyssortedbyvalues(dict):
813
 report = HTMLReportCreator()
819
 report = HTMLReportCreator()
814
 report.create(data, outputpath)
820
 report.create(data, outputpath)
815
 
821
 
822
+time_end = time.time()
823
+exectime_internal = time_end - time_start
824
+print 'Execution time %.5f secs, %.5f secs (%.2f %%) in external commands)' % (exectime_internal, exectime_external, (100.0 * exectime_external) / exectime_internal)