comparison Implab/Diagnostics/TraceContext.cs @ 93:dc4942d09e74 v2

improved tracing added the application components container MTComponentContainer.AppContainer
author cin
date Thu, 23 Oct 2014 01:13:57 +0400
parents 4c0e5ef99986
children a43745f81f10
comparison
equal deleted inserted replaced
92:4c0e5ef99986 93:dc4942d09e74
39 return m_current.CurrentOperation; 39 return m_current.CurrentOperation;
40 } 40 }
41 } 41 }
42 42
43 public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) { 43 public void EnterLogicalOperation(LogicalOperation operation, bool takeOwnership) {
44 // TODO Emit event 44 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Attach, String.Format("{0} -> [{1}]", operation.Name, m_threadId)));
45 m_stack.Push(m_current); 45 m_stack.Push(m_current);
46 m_current = new OperationContext(operation, takeOwnership); 46 m_current = new OperationContext(operation, takeOwnership);
47 } 47 }
48 48
49 public void StartLogicalOperation(string name) { 49 public void StartLogicalOperation(string name) {
50 m_current.BeginLogicalOperation(name); 50 m_current.BeginLogicalOperation(name);
51 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name)));
51 } 52 }
52 53
53 public void StartLogicalOperation() { 54 public void StartLogicalOperation() {
54 // TODO Emit Event 55 StartLogicalOperation(String.Empty);
55 m_current.BeginLogicalOperation(String.Empty);
56 } 56 }
57 57
58 public void EndLogicalOperation() { 58 public void EndLogicalOperation() {
59 // TODO Emit event 59 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationCompleted, String.Format("-{0} : {1}ms",CurrentOperation.Name, CurrentOperation.Duration)));
60 m_current.EndLogicalOperation(); 60 m_current.EndLogicalOperation();
61 } 61 }
62 62
63 public LogicalOperation DetachLogicalOperation() { 63 public LogicalOperation DetachLogicalOperation() {
64 // TODO Emit event 64 var op = m_current.DetachLogicalOperation();
65 return m_current.DetachLogicalOperation(); 65 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("[{0}] -> {1}", m_threadId, op.Name)));
66 return op;
66 } 67 }
67 68
68 public void Leave() { 69 public void Leave() {
69 // TODO Emit event 70 if (m_stack.Count > 0) {
70 if (m_stack.Count > 0) 71 m_current.Leave();
71 m_current = m_stack.Pop(); 72 m_current = m_stack.Pop();
72 else { 73 } else {
73 TraceLog.TraceWarning("Attemtp to leave the last operation context"); 74 TraceLog.TraceWarning("Attemtp to leave the last operation context");
74 m_current = OperationContext.EMPTY; 75 m_current = OperationContext.EMPTY;
75 } 76 }
76 } 77 }
77 } 78 }