diff tests/test-contrib-perf.t @ 42360:3293086ff663

perf: add an option to profile the benchmark section Running a perf command with --profile gather data for the whole command execution, including setup and cleanup. This can significantly alter the data. To work around this we introduce a new option, it trigger the profiling of only one iteration of the benchmarked section.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 21 May 2019 15:26:48 +0200
parents 563cd9a72682
children f5f0a9490c05
line wrap: on
line diff
--- a/tests/test-contrib-perf.t	Tue May 21 15:08:06 2019 +0200
+++ b/tests/test-contrib-perf.t	Tue May 21 15:26:48 2019 +0200
@@ -58,6 +58,10 @@
   "pre-run"
     number of run to perform before starting measurement.
   
+  "profile-benchmark"
+    Enable profiling for the benchmarked section. (The first iteration is
+    benchmarked)
+  
   "run-limits"
     Control the number of runs each benchmark will perform. The option value
     should be a list of '<time>-<numberofrun>' pairs. After each run the
@@ -349,6 +353,15 @@
   searching for changes
   searching for changes
 
+test  profile-benchmark option
+------------------------------
+
+Function to check that statprof ran
+  $ statprofran () {
+  >   egrep 'Sample count:|No samples recorded' > /dev/null
+  > }
+  $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.profile-benchmark=yes 2>&1 | statprofran
+
 Check perf.py for historical portability
 ----------------------------------------