comparison Implab/Diagnostics/TraceContext.cs @ 133:6c49d02a9a05 v2

sync
author cin
date Mon, 09 Feb 2015 00:28:13 +0300
parents 2573b562e328
children 04d4c92d0f28
comparison
equal deleted inserted replaced
132:5fb2bbffdece 133:6c49d02a9a05
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 var prev = CurrentOperation; 44 //var prev = CurrentOperation;
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 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name))); 47 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(takeOwnership ? TraceEventType.Attach : TraceEventType.Enter, String.Format("{0} -> {1}",prev.Name, operation.Name)));
48 } 48 }
49 49
50 public void StartLogicalOperation(string name) { 50 public void StartLogicalOperation(string name) {
51 m_current.BeginLogicalOperation(name); 51 m_current.BeginLogicalOperation(name);
52 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name))); 52 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.OperationStarted, String.Format("+{0}",CurrentOperation.Name)));
61 m_current.EndLogicalOperation(); 61 m_current.EndLogicalOperation();
62 } 62 }
63 63
64 public LogicalOperation DetachLogicalOperation() { 64 public LogicalOperation DetachLogicalOperation() {
65 var prev = m_current.DetachLogicalOperation(); 65 var prev = m_current.DetachLogicalOperation();
66 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("{0} -> {1}",prev.Name, CurrentOperation.Name))); 66 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Detach, String.Format("{0} -> {1}",prev.Name, CurrentOperation.Name)));
67 return prev; 67 return prev;
68 } 68 }
69 69
70 public void Leave() { 70 public void Leave() {
71 if (m_stack.Count > 0) { 71 if (m_stack.Count > 0) {
72 m_current.Leave(); 72 m_current.Leave();
73 var prev = CurrentOperation; 73 //var prev = CurrentOperation;
74 m_current = m_stack.Pop(); 74 m_current = m_stack.Pop();
75 LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Leave, String.Format("{0} -> {1}", prev.Name, CurrentOperation.Name))); 75 //LogChannel<TraceEvent>.Default.LogEvent(new TraceEvent(TraceEventType.Leave, String.Format("{0} -> {1}", prev.Name, CurrentOperation.Name)));
76 } else { 76 } else {
77 TraceLog.TraceWarning("Attempt to leave the last operation context"); 77 TraceLog.TraceWarning("Attempt to leave the last operation context");
78 m_current = OperationContext.EMPTY; 78 m_current = OperationContext.EMPTY;
79 } 79 }
80 } 80 }