提交 742e4e47 编写于 作者: B Balaji Soundrarajan

Cpc change required

This code to work we need the patched CPC with the changes from
basoundr/CPCChangeToWorkWithPerf_3_21

Some code cleanup
上级 8f069d91
......@@ -22,4 +22,4 @@ var elapsedTimeViBenchJsonFilePath = GetViBenchJsonFromCsv(elapsedTimeCsvFilePat
string jsonFileName = Path.GetFileName(elapsedTimeViBenchJsonFilePath);
// Move the json file to a file-share
// File.Copy(elapsedTimeViBenchJsonFilePath, $@"\\vcbench-srv4\benchview\uploads\vibench\{jsonFileName}");
File.Copy(elapsedTimeViBenchJsonFilePath, $@"\\vcbench-srv4\benchview\uploads\vibench\{jsonFileName}");
......@@ -15,9 +15,7 @@ var testDirectory = PerfTestDirectory();
var allResults = new List<Tuple<string, List<Tuple<int, string, object>>>>();
var failed = false;
// Sample Message
var traceManager = new TraceManager();
traceManager.PrintTest();
// Print message at startup
Log("Starting Performance Test Run");
......
using System.Diagnostics.Tracing;
[EventSource(Name = "PerformanceEventSource")]
public class PerformanceEventSource : EventSource
{
public static readonly PerformanceEventSource Log = new PerformanceEventSource();
private PerformanceEventSource()
{
}
[Event(1, Level = EventLevel.Verbose)]
public void EventStart()
{
WriteEvent(1, nameof(EventStart));
}
[Event(2, Level = EventLevel.Verbose)]
public void EventEnd()
{
WriteEvent(2, nameof(EventEnd));
}
}
\ No newline at end of file
......@@ -50,15 +50,13 @@ public class ScenarioGenerator
Log(@"</scenario>");
}
public void AddStartEvent(string providerGuid, int eventId, int absoluteInstance)
public void AddStartEvent(int absoluteInstance)
{
//Log($@"<from providerGuid=""{providerGuid}"" eventId=""{eventId}"" eventName = ""PerformanceEventSource/Event/Start""/>");
Log($@"<from providerGuid=""{KernelProviderGuid}"" absoluteInstance=""{absoluteInstance}"" process=""csc"" eventName = ""Process/Start""/>");
}
public void AddEndEvent(string providerGuid, int eventId, int absoluteInstance)
public void AddEndEvent()
{
//Log($@"<to providerGuid=""{providerGuid}"" eventId=""{eventId}"" eventName = ""PerformanceEventSource/Eventend""/>");
Log($@"<to providerGuid=""{KernelProviderGuid}"" absoluteInstance=""1"" process=""csc"" eventName=""Process/Stop""/>");
}
......
#load "ScenarioGenerator_util.csx"
#load "PerformanceEventSource_util.csx"
using System;
using System.Diagnostics;
......@@ -73,16 +72,14 @@ public class TraceManager
public void StartEvent()
{
_scenarioGenerator.AddStartEvent(PerformanceEventSource.Log.Guid.ToString(), 1, _startEventAbsoluteInstance);
_scenarioGenerator.AddStartEvent(_startEventAbsoluteInstance);
_startEventAbsoluteInstance++;
PerformanceEventSource.Log.EventStart();
}
public void EndEvent()
{
_scenarioGenerator.AddEndEvent(PerformanceEventSource.Log.Guid.ToString(), 2, _stopEventAbsoluteInstance);
_scenarioGenerator.AddEndEvent();
_stopEventAbsoluteInstance++;
PerformanceEventSource.Log.EventEnd();
}
public void EndScenario()
......@@ -115,36 +112,14 @@ public class TraceManager
public static ProcessResult RunProcess(string _cpcFullPath, string args)
{
var startInfo = new ProcessStartInfo(_cpcFullPath, args);
//startInfo.RedirectStandardOutput = true;
//startInfo.RedirectStandardError = true;
startInfo.UseShellExecute = true;
var process = new Process
{
StartInfo = startInfo,
//EnableRaisingEvents = true,
};
process.Start();
//var output = new StringWriter();
//var error = new StringWriter();
//process.OutputDataReceived += (s, e) => {
// if (!String.IsNullOrEmpty(e.Data))
// {
// output.WriteLine(e.Data);
// }
//};
//process.ErrorDataReceived += (s, e) => {
// if (!String.IsNullOrEmpty(e.Data))
// {
// error.WriteLine(e.Data);
// }
//};
//process.BeginOutputReadLine();
//process.BeginErrorReadLine();
process.WaitForExit();
return new ProcessResult
......@@ -152,8 +127,8 @@ public class TraceManager
ExecutablePath = _cpcFullPath,
Args = args,
Code = process.ExitCode,
StdOut = "",//output.ToString(),
StdErr = "",//error.ToString(),
StdOut = "",
StdErr = "",
};
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册