public void Method(object o) { Tracer.Tracer tracer = (Tracer.Tracer)o; tracer.StartTrace(); Thread.Sleep(100); tracer.StopTrace(); }
public void InnerMethodTest() { tracer = new Tracer.Tracer(); tracer.StartTrace(); Thread.Sleep(waitTime); SingleThreadedMethod(); tracer.StopTrace(); TraceResult traceResult = tracer.GetTraceResult(); Assert.AreEqual(1, traceResult.ThreadTracingResults.Count); TestExecutionTime(tracer.GetTraceResult().ThreadTracingResults[0].ExecutionTime, waitTime * 2); Assert.AreEqual(1, traceResult.ThreadTracingResults[0].ThreadMethods.Count); MethodTracingResult methodResult = traceResult.ThreadTracingResults[0].ThreadMethods[0]; Assert.AreEqual(nameof(UnitTests), methodResult.ClassName); Assert.AreEqual(nameof(InnerMethodTest), methodResult.MethodName); TestExecutionTime(methodResult.ExecutionTime, waitTime * 2); Assert.AreEqual(1, methodResult.InnerMethods.Count); MethodTracingResult innerMethodResult = methodResult.InnerMethods[0]; Assert.AreEqual(nameof(UnitTests), innerMethodResult.ClassName); Assert.AreEqual(nameof(SingleThreadedMethod), innerMethodResult.MethodName); TestExecutionTime(innerMethodResult.ExecutionTime, waitTime); }
public void InnerMethod() { _tracer.StartTrace(); Console.Write("fffff"); Thread.Sleep(100); _tracer.StopTrace(); }
private void ff(Tracer.Tracer tracer) { tracer.StartTrace(); f(tracer); f(tracer); f(tracer); Thread.Sleep(100); tracer.StopTrace(); }
public void MyMethod() { _tracer.StartTrace(); _bar.InnerMethod(); Thread.Sleep(300); _tracer.StopTrace(); }
public void SingleThreadTest() { tracer = new Tracer.Tracer(); tracer.StartTrace(); Thread.Sleep(waitTime); tracer.StopTrace(); long actual = tracer.GetTraceResult().ThreadsList[0].Time; Assert.AreEqual(TimeTest(actual, waitTime), true, timeTestFailMessage); }
public void CommonTest1() { Tracer.Tracer tracer = new Tracer.Tracer(); tracer.StartTrace(); Thread.Sleep(100); tracer.StopTrace(); string[] actual = tracer.GetTraceResult(); string[] expected = { "[\r\n {\r\n \"time\": 0,\r\n \"methodName\": \"1\",\r\n \"className\": \"Thread\",\r\n \"traceResultList\": [\r\n {\r\n \"time\": 116,\r\n \"methodName\": \"Main\",\r\n \"className\": \"Program\",\r\n \"traceResultList\": []\r\n }\r\n ]\r\n }\r\n]", "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<ArrayOfTraceResult xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <TraceResult>\r\n <stopwatch />\r\n <time>0</time>\r\n <methodName>1</methodName>\r\n <className>Thread</className>\r\n <traceResultList>\r\n <TraceResult>\r\n <stopwatch />\r\n <time>106</time>\r\n <methodName>Main</methodName>\r\n <className>Program</className>\r\n <traceResultList />\r\n </TraceResult>\r\n </traceResultList>\r\n </TraceResult>\r\n</ArrayOfTraceResult>" }; Assert.AreEqual(expected, actual); }
public void SingleThreadTest() { tracer = new Tracer.Tracer(); tracer.StartTrace(); Thread.Sleep(waitTime); tracer.StopTrace(); long actual = tracer.GetTraceResult().ThreadTracingResults[0].ExecutionTime; TestExecutionTime(actual, waitTime); }
public void MethodInMethodTest() { tracer = new Tracer.Tracer(); tracer.StartTrace(); Thread.Sleep(waitTime); SimpleTestMethod(); tracer.StopTrace(); TraceResult traceResult = tracer.GetTraceResult(); Assert.AreEqual(1, traceResult.ThreadsList.Count, countTestFailMessage); Assert.AreEqual(TimeTest(traceResult.ThreadsList[0].Time, waitTime * 2), true, timeTestFailMessage); Assert.AreEqual(1, traceResult.ThreadsList[0].InnerMethods.Count, countTestFailMessage); MethodTracer methodResult = traceResult.ThreadsList[0].InnerMethods[0]; Assert.AreEqual(nameof(TracerUnitTest), methodResult.ClassName, classNameTestFailMessage); Assert.AreEqual(nameof(MethodInMethodTest), methodResult.Name, methodNameTestFailMessage); Assert.AreEqual(TimeTest(methodResult.Time, waitTime), true, timeTestFailMessage); Assert.AreEqual(1, methodResult.InnerMethods.Count, countTestFailMessage); MethodTracer innerMethodResult = methodResult.InnerMethods[0]; Assert.AreEqual(nameof(TracerUnitTest), innerMethodResult.ClassName, classNameTestFailMessage); Assert.AreEqual(nameof(SimpleTestMethod), innerMethodResult.Name, methodNameTestFailMessage); Assert.AreEqual(TimeTest(innerMethodResult.Time, waitTime), true, timeTestFailMessage); }
// ќднопоточный метод дл¤ тесировани¤ private void SingleThreadedMethod() { tracer.StartTrace(); Thread.Sleep(waitTime); tracer.StopTrace(); }
private void Method() { Tracer.StartTrace(); Thread.Sleep(MillisecondsTimeout); Tracer.StopTrace(); }
static void DoIT() { _tracer.StartTrace(); m0(); _tracer.StopTrace(); }
private void SimpleTestMethod() { tracer.StartTrace(); Thread.Sleep(waitTime); tracer.StopTrace(); }
private void Method0() { _tracer.StartTrace(); Thread.Sleep(200); _tracer.StopTrace(); }
private void f2(Tracer.Tracer tracer) { tracer.StartTrace(); tracer.StopTrace(); }