static void Main(string[] args) { Program program = new Program(); Thread thread = new Thread(new ParameterizedThreadStart(program.Method)); ITracer tracer = new Tracer.Tracer(); Foo foo = new Foo(tracer); foo.MyMethod(); foo.MyMethod2(); thread.Start(tracer); thread.Join(); XmlSerializer xmlTracerSerializer = new XmlSerializer(); JsonTracerSerializer jsonTracerSerializer = new JsonTracerSerializer(); TraceResult traceResult = tracer.GetTraceResult(); string xml = xmlTracerSerializer.Serialize(traceResult); string json = jsonTracerSerializer.Serialize(traceResult); FileSaver fs = new FileSaver("trace.json"); fs.Print(xml); fs.Print(json); ConsolePrinter cp = new ConsolePrinter(); cp.Print(xml); cp.Print(json); Console.ReadKey(); }
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(); }