Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
f402d41a
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,发现更多精彩内容 >>
提交
f402d41a
编写于
3月 22, 2016
作者:
B
Balaji Soundrarajan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address PR
上级
d98d1280
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
66 addition
and
69 deletion
+66
-69
src/Test/Perf/Sample.csx
src/Test/Perf/Sample.csx
+6
-0
src/Test/Perf/infra/automation.csx
src/Test/Perf/infra/automation.csx
+4
-0
src/Test/Perf/infra/fetch_build.csx
src/Test/Perf/infra/fetch_build.csx
+1
-9
src/Test/Perf/infra/run_and_report.csx
src/Test/Perf/infra/run_and_report.csx
+4
-0
src/Test/Perf/runner.csx
src/Test/Perf/runner.csx
+2
-7
src/Test/Perf/util/Download_util.csx
src/Test/Perf/util/Download_util.csx
+16
-1
src/Test/Perf/util/TraceManager_util.csx
src/Test/Perf/util/TraceManager_util.csx
+12
-1
src/Test/Perf/util/test_util.csx
src/Test/Perf/util/test_util.csx
+6
-50
src/Test/Perf/util/tools_util.csx
src/Test/Perf/util/tools_util.csx
+15
-1
未找到文件。
src/Test/Perf/Sample.csx
0 → 100644
浏览文件 @
f402d41a
#load "util\test_util.csx"
#load "util\Download_util.csx"
InitUtilities();
DownloadTools();
\ No newline at end of file
src/Test/Perf/infra/automation.csx
浏览文件 @
f402d41a
...
...
@@ -2,6 +2,7 @@
#load "..\util\test_util.csx"
#load "..\util\runner_util.csx"
#load "..\util\Download_util.csx"
InitUtilities();
...
...
@@ -13,5 +14,8 @@ ShellOutVital(Path.Combine(RoslynDirectory(), "Restore.cmd"), "", workingDirecto
// Build Roslyn in Release Mode
ShellOutVital("msbuild", "./Roslyn.sln /p:Configuration=Release", workingDirectory: RoslynDirectory());
// Run DownloadTools before using the TraceManager because TraceManager uses the downloaded CPC binaries
DownloadTools();
// Run run_and_report.csx
await RunFile(Path.Combine(MyWorkingDirectory(), "run_and_report.csx"));
src/Test/Perf/infra/fetch_build.csx
浏览文件 @
f402d41a
// 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\tools_util.csx"
using System;
using System.IO;
...
...
@@ -47,12 +48,3 @@ bool SanityTestPassesForBuild(string buildPath)
return logfileNodes.Count == 0;
}
void CopyDirectory(string source, string destination)
{
var result = ShellOut("Robocopy", $"/s {source} {destination}");
if (!result.Succeeded)
{
throw new IOException($"Failed to copy \"{source}\" to \"{destination}\".");
}
}
src/Test/Perf/infra/run_and_report.csx
浏览文件 @
f402d41a
...
...
@@ -23,6 +23,10 @@ if (result)
// Move the json file to a file-share
File.Copy(elapsedTimeViBenchJsonFilePath, $@"\\vcbench-srv4\benchview\uploads\vibench\{jsonFileName}");
}
else
{
Log("Conversion from Consumption to csv failed.");
}
// Move the traces to mlangfs1 share
UploadTraces(GetCPCDirectoryPath(), @"\\mlangfs1\public\basoundr\PerfTraces");
\ No newline at end of file
src/Test/Perf/runner.csx
浏览文件 @
f402d41a
...
...
@@ -3,7 +3,6 @@
#load ".\util\runner_util.csx"
#load ".\util\test_util.csx"
#load ".\util\TraceManager_util.csx"
#load ".\util\DownloadCPC_util.csx"
using System.Collections.Generic;
using System.IO;
...
...
@@ -11,13 +10,11 @@ using System;
InitUtilities();
var testDirectory = P
erfTestDirectory(
);
var testDirectory = P
ath.Combine(MyWorkingDirectory(), "Tests"
);
var allResults = new List<Tuple<string, List<Tuple<int, string, object>>>>();
var failed = false;
// Run DownloadCPC before using the TraceManager because TraceManager uses the CPC downloaded binaries
DownloadCPC();
var traceManager = new TraceManager();
// Print message at startup
...
...
@@ -25,11 +22,9 @@ Log("Starting Performance Test Run");
Log("hash: " + StdoutFrom("git", "show --format=\"%h\" HEAD --").Split(new[] {"\r\n", "\r", "\n"}, StringSplitOptions.None)[0]);
Log("time: " + DateTime.Now.ToString());
// This is an assumption. We can modify it later
var noOfIterations = 3;
traceManager.Setup();
for(int i = 0; i <
noOf
Iterations; ++ i)
for(int i = 0; i <
traceManager.
Iterations; ++ i)
{
traceManager.Start();
...
...
src/Test/Perf/util/Download
CPC
_util.csx
→
src/Test/Perf/util/Download_util.csx
浏览文件 @
f402d41a
#load "test_util.csx"
#load "tools_util.csx"
using System;
using System.IO;
public void DownloadCPC()
void DownloadTools()
{
DownloadCPC();
DownloadViBenchToJson();
}
void DownloadCPC()
{
var cpcDestinationPath = GetCPCDirectoryPath();
var cpcSourceBinaryLocation = GetCPCSourceBinaryLocation();
...
...
@@ -17,4 +24,12 @@ public void DownloadCPC()
// Copy CPC from the share to cpcDestinationPath
CopyDirectory(cpcSourceBinaryLocation, cpcDestinationPath);
}
void DownloadViBenchToJson()
{
var destinationFilePath = GetViBenchToJsonExeFilePath();
var sourceFile = @"\\mlangfs1\public\basoundr\vibenchcsv2json\ViBenchToJson.exe";
File.Copy(sourceFile, destinationFilePath, true);
}
\ No newline at end of file
src/Test/Perf/util/TraceManager_util.csx
浏览文件 @
f402d41a
...
...
@@ -11,15 +11,26 @@ public class TraceManager
private string _cpcFullPath = "CPC.exe";
private int _startEventAbsoluteInstance = 1;
private int _stopEventAbsoluteInstance = 1;
private readonly int _iterations
public TraceManager(
int iterations = 3,
string cpcFolderPath = @"%SYSTEMDRIVE%\CPC",
string scenarioPath = @"%SYSTEMDRIVE%\CPC")
{
_iterations = iterations;
_cpcFullPath = Path.Combine(Environment.ExpandEnvironmentVariables(cpcFolderPath), "CPC.exe");
_scenarioGenerator = new ScenarioGenerator(Environment.ExpandEnvironmentVariables(scenarioPath));
}
public int Iterations
{
get
{
return _iterations;
}
}
public void Setup()
{
var processResult = RunProcess(_cpcFullPath, "/Setup /DisableArchive");
...
...
@@ -95,7 +106,7 @@ public class TraceManager
_stopEventAbsoluteInstance = 1;
}
p
ublic static
ProcessResult RunProcess(string _cpcFullPath, string args)
p
rivate
ProcessResult RunProcess(string _cpcFullPath, string args)
{
var startInfo = new ProcessStartInfo(_cpcFullPath, args);
startInfo.UseShellExecute = true;
...
...
src/Test/Perf/util/test_util.csx
浏览文件 @
f402d41a
...
...
@@ -81,11 +81,6 @@ string BinDirectory()
return Path.Combine(RoslynDirectory(), "Binaries");
}
string PerfTestDirectory()
{
return Path.Combine(RoslynDirectory(), "src", "Test", "Perf", "Tests");
}
string BinDebugDirectory()
{
return Path.Combine(BinDirectory(), "Debug");
...
...
@@ -126,11 +121,16 @@ string GetCPCSourceBinaryLocation()
return $@"\\mlangfs1\public\basoundr\CpcBinaries";
}
string GetViBenchToJsonExeFilePath()
{
return Path.Combine(GetCPCDirectoryPath(), "ViBenchToJson.exe");
}
//
// Process spawning and error handling.
//
public
class ProcessResult
class ProcessResult
{
public string ExecutablePath {get; set;}
public string Args {get; set;}
...
...
@@ -216,50 +216,6 @@ ProcessResult ShellOut(
};
}
ProcessResult ShellOutUsingShellExecute(
string file,
string args,
string workingDirectory = null,
CancellationToken? cancelationToken = null)
{
var tcs = new TaskCompletionSource<ProcessResult>();
var startInfo = new ProcessStartInfo(file, args);
startInfo.UseShellExecute = true;
var process = new Process
{
StartInfo = startInfo
};
if (cancelationToken != null) {
cancelationToken.Value.Register(() => process.Kill());
}
if (IsVerbose()) {
Log($"running \"{file}\" with arguments \"{args}\" from directory {workingDirectory}");
}
process.Start();
process.WaitForExit();
return new ProcessResult {
ExecutablePath = file,
Args = args,
Code = 0,
StdOut = "",
StdErr = "",
};
}
void CopyDirectory(string source, string destination)
{
var result = ShellOutUsingShellExecute("Robocopy", $"/mir {source} {destination}");
if (!result.Succeeded)
{
throw new IOException($"Failed to copy \"{source}\" to \"{destination}\".");
}
}
string StdoutFrom(string program, string args = "") {
var result = ShellOut(program, args);
if (result.Failed) {
...
...
src/Test/Perf/util/tools_util.csx
浏览文件 @
f402d41a
#load "test_util.csx"
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
...
...
@@ -11,6 +13,7 @@ bool ConvertConsumptionToCsv(string source, string destination, string requiredM
Log("Entering ConvertConsumptionToCsv");
if (!File.Exists(source))
{
Log($"File {source} does not exist");
return false;
}
...
...
@@ -110,7 +113,7 @@ string GetViBenchJsonFromCsv(string compilerTimeCsvFilePath, string execTimeCsvF
arguments = arguments.Replace("\r\n", " ").Replace("\n", "");
ShellOutVital(
@"\\mlangfs1\public\basoundr\vibenchcsv2json\ViBenchToJson.exe"
, arguments);
ShellOutVital(
GetViBenchToJsonExeFilePath()
, arguments);
return outJson;
}
...
...
@@ -139,4 +142,15 @@ void UploadTraces(string sourceFolderPath, string destinationFolderPath)
{
Log($"sourceFolderPath: {sourceFolderPath} does not exist");
}
}
void CopyDirectory(string source, string destination, string argument = @"/mir")
{
var result = ShellOut("Robocopy", $"{argument} {source} {destination}");
// Robocopy has a success exit code from 0 - 7
if (result.Code > 7)
{
throw new IOException($"Failed to copy \"{source}\" to \"{destination}\".");
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录