public TimeSpan run(StressSystemDelegate stress) { using (Native.CommandProcessor proc = new Native.CommandProcessor( Console.Write, Native.JPFSV_KERNEL)) { if (this.routineMasks != null) { Console.WriteLine("Attaching..."); proc.ProcessCommand( String.Format( ".attach 0n{0} 0n{1} {2}", this.bufferCount, this.bufferSize, this.traceFile)); } Console.WriteLine("Starting perfmon..."); Helpers.RunShellCommand("logman start KFBT"); if (this.routineMasks != null) { foreach (string mask in this.routineMasks) { Console.WriteLine("Adding instrumentation for {0}...", mask); proc.ProcessCommand( String.Format("tp {0}", mask)); } } Stopwatch watch = new Stopwatch(); watch.Start(); stress(); watch.Stop(); if (this.routineMasks != null) { foreach (string mask in this.routineMasks) { Console.WriteLine("Revoking instrumentation for {0}...", mask); proc.ProcessCommand(String.Format("tc {0}", mask)); } } Console.WriteLine("Stopping perfmon..."); Helpers.RunShellCommand("logman stop KFBT"); return(watch.Elapsed); } }
public TimeSpan run(StressSystemDelegate stress) { using (Native.CommandProcessor proc = new Native.CommandProcessor( Console.Write, Native.JPFSV_KERNEL)) { if (this.routineMasks != null) { Console.WriteLine("Attaching..."); proc.ProcessCommand( String.Format( ".attach 0n{0} 0n{1} {2}", this.bufferCount, this.bufferSize, this.traceFile)); } Console.WriteLine("Starting perfmon..."); Helpers.RunShellCommand("logman start KFBT"); if (this.routineMasks != null) { foreach (string mask in this.routineMasks) { Console.WriteLine("Adding instrumentation for {0}...", mask); proc.ProcessCommand( String.Format("tp {0}", mask)); } } Stopwatch watch = new Stopwatch(); watch.Start(); stress(); watch.Stop(); if (this.routineMasks != null) { foreach (string mask in this.routineMasks) { Console.WriteLine("Revoking instrumentation for {0}...", mask); proc.ProcessCommand(String.Format("tc {0}", mask)); } } Console.WriteLine("Stopping perfmon..."); Helpers.RunShellCommand("logman stop KFBT"); return watch.Elapsed; } }