Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d98d1280
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d98d1280
编写于
3月 22, 2016
作者:
B
Balaji Soundrarajan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Addressing PP Part 1
上级
d9df68b8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
145 addition
and
156 deletion
+145
-156
src/Test/Perf/.gitignore
src/Test/Perf/.gitignore
+0
-2
src/Test/Perf/infra/run_and_report.csx
src/Test/Perf/infra/run_and_report.csx
+1
-0
src/Test/Perf/util/TraceManager_util.csx
src/Test/Perf/util/TraceManager_util.csx
+1
-15
src/Test/Perf/util/runner_util.csx
src/Test/Perf/util/runner_util.csx
+1
-139
src/Test/Perf/util/tools_util.csx
src/Test/Perf/util/tools_util.csx
+142
-0
未找到文件。
src/Test/Perf/.gitignore
浏览文件 @
d98d1280
...
...
@@ -2,7 +2,5 @@ artifacts/
infra/bin/
results/
temp/
DataBackup*/
consumptionTempResults.xml
*.json
*.csv
src/Test/Perf/infra/run_and_report.csx
浏览文件 @
d98d1280
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
#load "..\util\test_util.csx"
#load "..\util\runner_util.csx"
#load "..\util\tools_util.csx"
using System.IO;
...
...
src/Test/Perf/util/TraceManager_util.csx
浏览文件 @
d98d1280
...
...
@@ -19,16 +19,7 @@ public class TraceManager
_cpcFullPath = Path.Combine(Environment.ExpandEnvironmentVariables(cpcFolderPath), "CPC.exe");
_scenarioGenerator = new ScenarioGenerator(Environment.ExpandEnvironmentVariables(scenarioPath));
}
public static void Run(string testExecutable, string argument)
{
var processResult = RunProcess(testExecutable, argument);
if (processResult.Failed)
{
throw new SystemException($@"The process {testExecutable} failed. {processResult.StdErr}");
}
}
public void Setup()
{
var processResult = RunProcess(_cpcFullPath, "/Setup /DisableArchive");
...
...
@@ -103,11 +94,6 @@ public class TraceManager
_startEventAbsoluteInstance = 1;
_stopEventAbsoluteInstance = 1;
}
public void PrintTest()
{
Console.WriteLine("Test Printing by TraceManager");
}
public static ProcessResult RunProcess(string _cpcFullPath, string args)
{
...
...
src/Test/Perf/util/runner_util.csx
浏览文件 @
d98d1280
...
...
@@ -56,142 +56,4 @@ IEnumerable<string> GetAllCsxRecursive(string directoryName)
yield return fileName;
}
}
}
/// Takes a consumptionTempResults file and converts to csv file
/// Each info contains the <ScenarioName, Metric Key, Metric value>
bool ConvertConsumptionToCsv(string source, string destination, string requiredMetricKey)
{
Log("Entering ConvertConsumptionToCsv");
if (!File.Exists(source))
{
return false;
}
try
{
var result = new List<string>();
string currentScenarioName = null;
using (XmlReader xmlReader = XmlReader.Create(source))
{
while (xmlReader.Read())
{
if ((xmlReader.NodeType == XmlNodeType.Element))
{
if (xmlReader.Name.Equals("ScenarioResult"))
{
currentScenarioName = xmlReader.GetAttribute("Name");
// These are not test results
if (string.Equals(currentScenarioName, "..TestDiagnostics.."))
{
currentScenarioName = null;
}
}
else if (currentScenarioName != null && xmlReader.Name.Equals("CounterResult"))
{
var metricKey = xmlReader.GetAttribute("Name");
if (string.Equals(metricKey, requiredMetricKey))
{
var metricScale = xmlReader.GetAttribute("Units");
xmlReader.Read();
var metricvalue = xmlReader.Value;
result.Add($"{currentScenarioName}, {metricKey} ({metricScale}), {metricvalue}");
}
}
}
}
}
File.WriteAllLines(destination, result);
}
catch(System.Exception e)
{
System.Console.WriteLine(e.Message);
System.Console.WriteLine(e.StackTrace);
return false;
}
return true;
}
/// Gets a csv file with metrics and converts them to ViBench supported JSON file
string GetViBenchJsonFromCsv(string compilerTimeCsvFilePath, string execTimeCsvFilePath, string fileSizeCsvFilePath)
{
Log("Convert the csv to JSON using ViBench tool");
string branch = StdoutFrom("git", "rev-parse --abbrev-ref HEAD");
string date = FirstLine(StdoutFrom("git", $"show --format=\"%aI\" {branch} --"));
string hash = FirstLine(StdoutFrom("git", $"show --format=\"%h\" {branch} --"));
string longHash = FirstLine(StdoutFrom("git", $"show --format=\"%H\" {branch} --"));
string username = StdoutFrom("whoami");
string machineName = StdoutFrom("hostname");
string architecture = System.Environment.Is64BitOperatingSystem ? "x86-64" : "x86";
// File locations
string outJson = Path.Combine(GetCPCDirectoryPath(), $"Roslyn-{longHash}.json");
// ViBenchToJson does not like empty csv files.
string files = "";
if (compilerTimeCsvFilePath != null && new FileInfo(compilerTimeCsvFilePath).Length != 0) {
files += $@"compilertime:""{compilerTimeCsvFilePath}""";
}
if (execTimeCsvFilePath != null && new FileInfo(execTimeCsvFilePath).Length != 0) {
files += $@"exectime:""{execTimeCsvFilePath}""";
}
if (fileSizeCsvFilePath != null && new FileInfo(fileSizeCsvFilePath).Length != 0) {
files += $@"filesize:""{fileSizeCsvFilePath}""";
}
string arguments = $@"
{files}
jobName:""RoslynPerf-{hash}-{date}""
jobGroupName:""Roslyn-{branch}""
jobTypeName:""official""
buildInfoName:""{date}-{branch}-{hash}""
configName:""Default Configuration""
machinePoolName:""4-core-windows""
architectureName:""{architecture}""
manufacturerName:""unknown-manufacturer""
microarchName:""unknown-microarch""
userName:""{username}""
userAlias:""{username}""
osInfoName:""Windows""
machineName:""{machineName}""
buildNumber:""{date}-{hash}""
/json:""{outJson}""
";
arguments = arguments.Replace("\r\n", " ").Replace("\n", "");
ShellOutVital(@"\\mlangfs1\public\basoundr\vibenchcsv2json\ViBenchToJson.exe", arguments);
return outJson;
}
string FirstLine(string input) {
return input.Split(new[] {"\r\n", "\r", "\n"}, System.StringSplitOptions.None)[0];
}
void UploadTraces(string sourceFolderPath, string destinationFolderPath)
{
Log("Uploading traces");
if (Directory.Exists(sourceFolderPath))
{
// Get the latest written databackup
var directoryToUpload = new DirectoryInfo(sourceFolderPath).GetDirectories("DataBackup*").OrderByDescending(d=>d.LastWriteTimeUtc).FirstOrDefault();
if (directoryToUpload == null)
{
Log($"There are no trace directory starting with DataBackup in {sourceFolderPath}");
return;
}
var destination = Path.Combine(destinationFolderPath, directoryToUpload.Name);
CopyDirectory(directoryToUpload.FullName, destination);
}
else
{
Log($"sourceFolderPath: {sourceFolderPath} does not exist");
}
}
}
\ No newline at end of file
src/Test/Perf/util/tools_util.csx
0 → 100644
浏览文件 @
d98d1280
#load "test_util.csx"
using System.IO;
using System.Linq;
using System.Xml;
/// Takes a consumptionTempResults file and converts to csv file
/// Each info contains the <ScenarioName, Metric Key, Metric value>
bool ConvertConsumptionToCsv(string source, string destination, string requiredMetricKey)
{
Log("Entering ConvertConsumptionToCsv");
if (!File.Exists(source))
{
return false;
}
try
{
var result = new List<string>();
string currentScenarioName = null;
using (XmlReader xmlReader = XmlReader.Create(source))
{
while (xmlReader.Read())
{
if ((xmlReader.NodeType == XmlNodeType.Element))
{
if (xmlReader.Name.Equals("ScenarioResult"))
{
currentScenarioName = xmlReader.GetAttribute("Name");
// These are not test results
if (string.Equals(currentScenarioName, "..TestDiagnostics.."))
{
currentScenarioName = null;
}
}
else if (currentScenarioName != null && xmlReader.Name.Equals("CounterResult"))
{
var metricKey = xmlReader.GetAttribute("Name");
if (string.Equals(metricKey, requiredMetricKey))
{
var metricScale = xmlReader.GetAttribute("Units");
xmlReader.Read();
var metricvalue = xmlReader.Value;
result.Add($"{currentScenarioName}, {metricKey} ({metricScale}), {metricvalue}");
}
}
}
}
}
File.WriteAllLines(destination, result);
}
catch(System.Exception e)
{
System.Console.WriteLine(e.Message);
System.Console.WriteLine(e.StackTrace);
return false;
}
return true;
}
/// Gets a csv file with metrics and converts them to ViBench supported JSON file
string GetViBenchJsonFromCsv(string compilerTimeCsvFilePath, string execTimeCsvFilePath, string fileSizeCsvFilePath)
{
Log("Convert the csv to JSON using ViBench tool");
string branch = StdoutFrom("git", "rev-parse --abbrev-ref HEAD");
string date = FirstLine(StdoutFrom("git", $"show --format=\"%aI\" {branch} --"));
string hash = FirstLine(StdoutFrom("git", $"show --format=\"%h\" {branch} --"));
string longHash = FirstLine(StdoutFrom("git", $"show --format=\"%H\" {branch} --"));
string username = StdoutFrom("whoami");
string machineName = StdoutFrom("hostname");
string architecture = System.Environment.Is64BitOperatingSystem ? "x86-64" : "x86";
// File locations
string outJson = Path.Combine(GetCPCDirectoryPath(), $"Roslyn-{longHash}.json");
// ViBenchToJson does not like empty csv files.
string files = "";
if (compilerTimeCsvFilePath != null && new FileInfo(compilerTimeCsvFilePath).Length != 0) {
files += $@"compilertime:""{compilerTimeCsvFilePath}""";
}
if (execTimeCsvFilePath != null && new FileInfo(execTimeCsvFilePath).Length != 0) {
files += $@"exectime:""{execTimeCsvFilePath}""";
}
if (fileSizeCsvFilePath != null && new FileInfo(fileSizeCsvFilePath).Length != 0) {
files += $@"filesize:""{fileSizeCsvFilePath}""";
}
string arguments = $@"
{files}
jobName:""RoslynPerf-{hash}-{date}""
jobGroupName:""Roslyn-{branch}""
jobTypeName:""official""
buildInfoName:""{date}-{branch}-{hash}""
configName:""Default Configuration""
machinePoolName:""4-core-windows""
architectureName:""{architecture}""
manufacturerName:""unknown-manufacturer""
microarchName:""unknown-microarch""
userName:""{username}""
userAlias:""{username}""
osInfoName:""Windows""
machineName:""{machineName}""
buildNumber:""{date}-{hash}""
/json:""{outJson}""
";
arguments = arguments.Replace("\r\n", " ").Replace("\n", "");
ShellOutVital(@"\\mlangfs1\public\basoundr\vibenchcsv2json\ViBenchToJson.exe", arguments);
return outJson;
}
string FirstLine(string input) {
return input.Split(new[] {"\r\n", "\r", "\n"}, System.StringSplitOptions.None)[0];
}
void UploadTraces(string sourceFolderPath, string destinationFolderPath)
{
Log("Uploading traces");
if (Directory.Exists(sourceFolderPath))
{
// Get the latest written databackup
var directoryToUpload = new DirectoryInfo(sourceFolderPath).GetDirectories("DataBackup*").OrderByDescending(d=>d.LastWriteTimeUtc).FirstOrDefault();
if (directoryToUpload == null)
{
Log($"There are no trace directory starting with DataBackup in {sourceFolderPath}");
return;
}
var destination = Path.Combine(destinationFolderPath, directoryToUpload.Name);
CopyDirectory(directoryToUpload.FullName, destination);
}
else
{
Log($"sourceFolderPath: {sourceFolderPath} does not exist");
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录