コード例 #1
0
 public void Method(object o)
 {
     Tracer.Tracer tracer = (Tracer.Tracer)o;
     tracer.StartTrace();
     Thread.Sleep(100);
     tracer.StopTrace();
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void InnerMethod()
 {
     _tracer.StartTrace();
     Console.Write("fffff");
     Thread.Sleep(100);
     _tracer.StopTrace();
 }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: Ushiramaru/Tracer
 private void ff(Tracer.Tracer tracer)
 {
     tracer.StartTrace();
     f(tracer);
     f(tracer);
     f(tracer);
     Thread.Sleep(100);
     tracer.StopTrace();
 }
コード例 #5
0
            public void MyMethod()
            {
                _tracer.StartTrace();

                _bar.InnerMethod();
                Thread.Sleep(300);

                _tracer.StopTrace();
            }
コード例 #6
0
        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);
        }
コード例 #7
0
 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);
 }
コード例 #8
0
        public void SingleThreadTest()
        {
            tracer = new Tracer.Tracer();

            tracer.StartTrace();
            Thread.Sleep(waitTime);
            tracer.StopTrace();

            long actual = tracer.GetTraceResult().ThreadTracingResults[0].ExecutionTime;

            TestExecutionTime(actual, waitTime);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 // ќднопоточный метод дл¤ тесировани¤
 private void SingleThreadedMethod()
 {
     tracer.StartTrace();
     Thread.Sleep(waitTime);
     tracer.StopTrace();
 }
コード例 #11
0
ファイル: UnitTest.cs プロジェクト: Den25570/Tracer
 private void Method()
 {
     Tracer.StartTrace();
     Thread.Sleep(MillisecondsTimeout);
     Tracer.StopTrace();
 }
コード例 #12
0
 static void DoIT()
 {
     _tracer.StartTrace();
     m0();
     _tracer.StopTrace();
 }
コード例 #13
0
 private void SimpleTestMethod()
 {
     tracer.StartTrace();
     Thread.Sleep(waitTime);
     tracer.StopTrace();
 }
コード例 #14
0
ファイル: Test.cs プロジェクト: Gurinov/Tracer
 private void Method0()
 {
     _tracer.StartTrace();
     Thread.Sleep(200);
     _tracer.StopTrace();
 }
コード例 #15
0
ファイル: UnitTest1.cs プロジェクト: Ushiramaru/Tracer
 private void f2(Tracer.Tracer tracer)
 {
     tracer.StartTrace();
     tracer.StopTrace();
 }