Beispiel #1
0
        static void Main(string[] args)
        {
            Program program = new Program();
            Thread  thread  = new Thread(new ParameterizedThreadStart(program.Method));

            Tracer tracer = new Tracer();
            Foo    foo    = new Foo(tracer);

            Tracer tracer1 = new Tracer();

            foo.MyMethod();
            thread.Start(tracer);
            foo.MyMethod();
            thread.Join();

            Thread thread1 = new Thread(new ParameterizedThreadStart(program.Method));

            foo.MyMethod();
            thread1.Start(tracer);
            thread1.Join();

            XmlTracerSerializer  xmlTracerSerializer  = new XmlTracerSerializer();
            JsonTracerSerializer jsonTracerSerializer = new JsonTracerSerializer();
            TraceResult          traceResult          = tracer.GetTraceResult();
            string xml  = xmlTracerSerializer.Serealize(traceResult);
            string json = jsonTracerSerializer.Serealize(traceResult);

            Console.WriteLine(xml);
            Console.WriteLine(json);
            File.WriteAllText("trace.json", json);
            File.WriteAllText("trace.xml", xml);
            Console.ReadKey();
        }