profiling: revert the default mode back to 'cpu' on Windows stable
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 24 Oct 2018 22:24:10 -0400
branchstable
changeset 40418 89703e6151e7
parent 40417 49c7b701fdc2
child 40419 5e917b224c20
profiling: revert the default mode back to 'cpu' on Windows On Windows, os.times() only returns user and system times. Real elapsed time is 0. That results in no actual times reported, an end wall time of 0.000000, and seemingly randomly sorted stack frames. This at least provides test stability in test-profile.t. I kind of think that `default=pycompat.iswindows and 'cpu' or 'real'` would be a better way to set the default in configitems, but I didn't see any other examples of this, and thought maybe there's a reason for that. That might allow plugging the value into the help text automatically- the documented default wasn't updated in db0dba2d157d.
mercurial/configitems.py
mercurial/profiling.py
--- a/mercurial/configitems.py	Wed Oct 17 14:47:01 2018 +0200
+++ b/mercurial/configitems.py	Wed Oct 24 22:24:10 2018 -0400
@@ -923,7 +923,7 @@
     default='hotpath',
 )
 coreconfigitem('profiling', 'time-track',
-    default='real',
+    default=dynamicdefault,
 )
 coreconfigitem('profiling', 'type',
     default='stat',
--- a/mercurial/profiling.py	Wed Oct 17 14:47:01 2018 +0200
+++ b/mercurial/profiling.py	Wed Oct 24 22:24:10 2018 -0400
@@ -101,7 +101,8 @@
     else:
         ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
 
-    track = ui.config('profiling', 'time-track')
+    track = ui.config('profiling', 'time-track',
+                      pycompat.iswindows and 'cpu' or 'real')
     statprof.start(mechanism='thread', track=track)
 
     try: