aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-06-08 12:56:34 -0500
committerrogerk <devnull@localhost>2011-06-08 12:56:34 -0500
commit0e2d144eb6e08f841ed4476cfff23ad462bbbcd9 (patch)
tree0e4fa5b00b03513f2f859954f0af8f2b06eb5530 /src
parentc671a4b317fbc77dab57a18d64a67a11d0558378 (diff)
downloadprotobuf-0e2d144eb6e08f841ed4476cfff23ad462bbbcd9.tar.gz
protobuf-0e2d144eb6e08f841ed4476cfff23ad462bbbcd9.tar.bz2
protobuf-0e2d144eb6e08f841ed4476cfff23ad462bbbcd9.zip
Added process priority and affinity for v2 benchmarks
Diffstat (limited to 'src')
-rw-r--r--src/ProtoBench/Program.cs21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/ProtoBench/Program.cs b/src/ProtoBench/Program.cs
index 14294a45..7d91bbed 100644
--- a/src/ProtoBench/Program.cs
+++ b/src/ProtoBench/Program.cs
@@ -64,15 +64,21 @@ namespace Google.ProtocolBuffers.ProtoBench
FastTest = temp.Remove("/fast") || temp.Remove("-fast");
Verbose = temp.Remove("/verbose") || temp.Remove("-verbose");
-
+
RunBenchmark = BenchmarkV1;
if (temp.Remove("/v2") || temp.Remove("-v2"))
- RunBenchmark = BenchmarkV2;
+ {
+ string cpu = temp.Find(x => x.StartsWith("-cpu:"));
+ int cpuIx = 1;
+ if (cpu != null) cpuIx = 1 << Math.Max(0, int.Parse(cpu.Substring(5)));
+ //pin the entire process to a single CPU
+ Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(cpuIx);
+ Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime;
+ RunBenchmark = BenchmarkV2;
+ }
args = temp.ToArray();
-
-
if (args.Length < 2 || (args.Length%2) != 0)
{
Console.Error.WriteLine("Usage: ProtoBench [/fast] <descriptor type name> <input data>");
@@ -188,13 +194,6 @@ namespace Google.ProtocolBuffers.ProtoBench
double bps = (iterations * dataSize) / (cycle.TotalSeconds * 1024 * 1024);
if (Verbose) Console.WriteLine("Round {0,3}: Count = {1,6}, Bps = {2,8:f3}", runs, iterations, bps);
- if (runs == 0 && bps > first * 1.1)
- {
- if (Verbose) Console.WriteLine("Warming up...");
- iterations = (int)((target.Ticks * iterations) / (double)cycle.Ticks);
- first = bps;
- continue;//still warming up...
- }
best = Math.Max(best, bps);
worst = Math.Min(worst, bps);