##// END OF EJS Templates
profiling: allow logging profile to the blackbox...
Durham Goode -
r26191:39a0b111 default
parent child Browse files
Show More
@@ -1023,7 +1023,10 b' def _runcommand(ui, options, cmd, cmdfun'
1023 1023
1024 1024 output = ui.config('profiling', 'output')
1025 1025
1026 if output:
1026 if output == 'blackbox':
1027 import StringIO
1028 fp = StringIO.StringIO()
1029 elif output:
1027 1030 path = ui.expandpath(output)
1028 1031 fp = open(path, 'wb')
1029 1032 else:
@@ -1038,6 +1041,12 b' def _runcommand(ui, options, cmd, cmdfun'
1038 1041 return statprofile(ui, checkargs, fp)
1039 1042 finally:
1040 1043 if output:
1044 if output == 'blackbox':
1045 val = "Profile:\n%s" % fp.getvalue()
1046 # ui.log treats the input as a format string,
1047 # so we need to escape any % signs.
1048 val = val.replace('%', '%%')
1049 ui.log('profile', val)
1041 1050 fp.close()
1042 1051 else:
1043 1052 return checkargs()
@@ -14,6 +14,9 b' test --profile'
14 14 $ hg --profile --config profiling.output=../out st
15 15 $ grep CallCount ../out > /dev/null || cat ../out
16 16
17 $ hg --profile --config profiling.output=blackbox --config extensions.blackbox= st
18 $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log
19
17 20 $ hg --profile --config profiling.format=text st 2>../out
18 21 $ grep CallCount ../out > /dev/null || cat ../out
19 22
General Comments 0
You need to be logged in to leave comments. Login now