blob: c12893d38a1ca566d2ee8dd4ff22cf18d9dfde21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
using System;
using System.Threading.Tasks;
using System.IO;
using Tracing.Tests.Common;
namespace Tracing.Tests
{
class EventPipeSmoke
{
private static int allocIterations = 10000;
private static int trivialSize = 0x100000;
static int Main(string[] args)
{
bool keepOutput = false;
// Use the first arg as an output filename if there is one
string outputFilename = null;
if (args.Length >= 1) {
outputFilename = args[0];
keepOutput = true;
}
else {
outputFilename = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".netperf";
}
Console.WriteLine("\tStart: Enable tracing.");
TraceControl.EnableDefault(outputFilename);
Console.WriteLine("\tEnd: Enable tracing.\n");
Console.WriteLine("\tStart: Allocation.");
// Allocate for allocIterations iterations.
for(int i=0; i<allocIterations; i++)
{
GC.KeepAlive(new object());
}
Console.WriteLine("\tEnd: Allocation.\n");
Console.WriteLine("\tStart: Disable tracing.");
TraceControl.Disable();
Console.WriteLine("\tEnd: Disable tracing.\n");
FileInfo outputMeta = new FileInfo(outputFilename);
Console.WriteLine("\tCreated {0} bytes of data", outputMeta.Length);
bool pass = false;
if (outputMeta.Length > trivialSize){
pass = true;
}
if (keepOutput)
{
Console.WriteLine(String.Format("\tOutput file: {0}", outputFilename));
}
else
{
System.IO.File.Delete(outputFilename);
}
return pass ? 100 : 0;
}
}
}
|