[acceptance-tests] Don't pass a zero sampling/heapshot frequency in the profiler...
[mono.git] / acceptance-tests / profiler-stress / runner.cs
index 5ef4ab02a2eb198eeb669e3a1fed781af3376828..302e43e639228c097c5a13eb74053c25662646b6 100644 (file)
@@ -44,6 +44,26 @@ namespace Mono.Profiling.Tests.Stress {
 
        static class Program {
 
+               static readonly string[] _options = new [] {
+                       "domain",
+                       "assembly",
+                       "module",
+                       "class",
+                       "jit",
+                       "exception",
+                       "gcalloc",
+                       "gc",
+                       "thread",
+                       // "calls", // Way too heavy.
+                       "monitor",
+                       "gcmove",
+                       "gcroot",
+                       "context",
+                       "finalization",
+                       "counter",
+                       "gchandle",
+               };
+
                static readonly TimeSpan _timeout = TimeSpan.FromHours (6);
 
                static string FilterInvalidXmlChars (string text) {
@@ -75,14 +95,22 @@ namespace Mono.Profiling.Tests.Stress {
                        for (var i = 0; i < benchmarks.Length; i++) {
                                var bench = benchmarks [i];
 
-                               var sampleFreq = rand.Next (0, 1001);
+                               var sampleFreq = rand.Next (-1000, 1001);
                                var sampleMode = rand.Next (0, 2) == 1 ? "real" : "process";
                                var maxSamples = rand.Next (0, cpus * 2000 + 1);
-                               var heapShotFreq = rand.Next (0, 11);
+                               var heapShotFreq = rand.Next (-10, 11);
                                var maxFrames = rand.Next (0, 33);
-                               var allocMode = rand.Next (0, 2) == 1 ? "alloc" : "noalloc";
+                               var options = _options.ToDictionary (x => x, _ => rand.Next (0, 2) == 1)
+                                                     .Select (x => (x.Value ? string.Empty : "no") + x.Key)
+                                                     .ToArray ();
+
+                               var profOptions = $"maxframes={maxFrames},{string.Join (",", options)},output=/dev/null";
+
+                               if (sampleFreq > 0)
+                                       profOptions += $",sample={sampleFreq},sampling-{sampleMode},maxsamples={maxSamples}";
 
-                               var profOptions = $"sample=cycles/{sampleFreq},sampling-{sampleMode},maxsamples={maxSamples},heapshot={heapShotFreq}gc,maxframes={maxFrames},{allocMode},output=/dev/null";
+                               if (heapShotFreq > 0)
+                                       profOptions += $",heapshot={heapShotFreq}gc";
 
                                var info = new ProcessStartInfo {
                                        UseShellExecute = false,