Show More
@@ -103,6 +103,7 b' def statprofile(ui, fp):' | |||||
103 | 'bymethod': statprof.DisplayFormats.ByMethod, |
|
103 | 'bymethod': statprof.DisplayFormats.ByMethod, | |
104 | 'hotpath': statprof.DisplayFormats.Hotpath, |
|
104 | 'hotpath': statprof.DisplayFormats.Hotpath, | |
105 | 'json': statprof.DisplayFormats.Json, |
|
105 | 'json': statprof.DisplayFormats.Json, | |
|
106 | 'chrome': statprof.DisplayFormats.Chrome, | |||
106 | } |
|
107 | } | |
107 |
|
108 | |||
108 | if profformat in formats: |
|
109 | if profformat in formats: | |
@@ -111,7 +112,23 b' def statprofile(ui, fp):' | |||||
111 | ui.warn(_('unknown profiler output format: %s\n') % profformat) |
|
112 | ui.warn(_('unknown profiler output format: %s\n') % profformat) | |
112 | displayformat = statprof.DisplayFormats.Hotpath |
|
113 | displayformat = statprof.DisplayFormats.Hotpath | |
113 |
|
114 | |||
114 | statprof.display(fp, data=data, format=displayformat) |
|
115 | kwargs = {} | |
|
116 | ||||
|
117 | def fraction(s): | |||
|
118 | if s.endswith('%'): | |||
|
119 | v = float(s[:-1]) / 100 | |||
|
120 | else: | |||
|
121 | v = float(s) | |||
|
122 | if 0 <= v <= 1: | |||
|
123 | return v | |||
|
124 | raise ValueError(s) | |||
|
125 | ||||
|
126 | if profformat == 'chrome': | |||
|
127 | showmin = ui.configwith(fraction, 'profiling', 'showmin', 0.005) | |||
|
128 | showmax = ui.configwith(fraction, 'profiling', 'showmax', 0.999) | |||
|
129 | kwargs.update(minthreshold=showmin, maxthreshold=showmax) | |||
|
130 | ||||
|
131 | statprof.display(fp, data=data, format=displayformat, **kwargs) | |||
115 |
|
132 | |||
116 | @contextlib.contextmanager |
|
133 | @contextlib.contextmanager | |
117 | def profile(ui): |
|
134 | def profile(ui): |
General Comments 0
You need to be logged in to leave comments.
Login now