diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-11-20 17:22:12 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2018-11-20 17:22:12 +0100 |
| commit | a1dca1431f685020df843162b805edee11e1929c (patch) | |
| tree | 4a741ae6351edf837aec7d16fbf28c5dadc007a0 /src/LayoutingQueueItem.cs | |
| parent | e6541b353e7a0ecfd2e514e5c9c6f6c9c1ba96b1 (diff) | |
DebugLog
Diffstat (limited to 'src/LayoutingQueueItem.cs')
| -rw-r--r-- | src/LayoutingQueueItem.cs | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/src/LayoutingQueueItem.cs b/src/LayoutingQueueItem.cs index 7efdf1bc..a9049eb9 100644 --- a/src/LayoutingQueueItem.cs +++ b/src/LayoutingQueueItem.cs @@ -57,8 +57,16 @@ namespace Crow /// <summary> Unsuccessfull UpdateLayout and requeueing count </summary> public int LayoutingTries, DiscardCount; - #if DEBUG_LAYOUTING - public Stopwatch LQITime; + #if DEBUG_LOG + public enum Result : byte { + Unknown, + Register, + Success, + Requeued, + Discarded, + Deleted, + } + public Result result; public GraphicObject graphicObject { get { return Layoutable as GraphicObject; } } @@ -85,11 +93,11 @@ namespace Crow Layoutable.RegisteredLayoutings |= LayoutType; LayoutingTries = 0; DiscardCount = 0; - #if DEBUG_LAYOUTING - LQITime = new Stopwatch(); + #if DEBUG_LOG Slot = Rectangle.Empty; NewSlot = Rectangle.Empty; - Debug.WriteLine ("\tRegister => " + this.ToString ()); + result = Result.Register; + DebugLog.AddEvent (DbgEvtType.GORegisterLayouting, this); #endif } #endregion @@ -108,44 +116,42 @@ namespace Crow if (go.Parent == null) {//TODO:improve this //cancel layouting for object without parent, maybe some were in queue when //removed from a listbox - #if DEBUG_UPDATE || DEBUG_LAYOUTING - Debug.WriteLine ("ERROR: processLayouting, no parent for: " + this.ToString ()); + #if DEBUG_LOG + DebugLog.AddEvent (DbgEvtType.GOProcessLayoutingWithNoParent, this); #endif go.parentRWLock.ExitReadLock (); return; } - #if DEBUG_LAYOUTING - LQITime.Start(); - Debug.WriteLine ("=> " + this.ToString ()); + #if DEBUG_LOG + DbgEvent dbgEvt = DebugLog.AddEvent (DbgEvtType.GOProcessLayouting, this); #endif LayoutingTries++; if (!Layoutable.UpdateLayout (LayoutType)) { - #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tRequeued"); + #if DEBUG_LOG + dbgEvt.end = DebugLog.chrono.ElapsedTicks; #endif if (LayoutingTries < Interface.MaxLayoutingTries) { Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.LayoutingQueue.Enqueue (this); + result = Result.Requeued; } else if (DiscardCount < Interface.MaxDiscardCount) { - #if DEBUG_LAYOUTING - Debug.WriteLine ("\t\tDiscarded"); - #endif + result = Result.Discarded; LayoutingTries = 0; DiscardCount++; Layoutable.RegisteredLayoutings |= LayoutType; (Layoutable as GraphicObject).IFace.DiscardQueue.Enqueue (this); } -// #if DEBUG_LAYOUTING - else - Debug.WriteLine ("\tDELETED => " + this.ToString ()); -// #endif + #if DEBUG_LOG + else { + result = Result.Deleted; + } + #endif } + #if DEBUG_LOG else{ - if (LayoutingTries > 2 || DiscardCount > 0) - Debug.WriteLine (this.ToString ()); + result = Result.Success; } - #if DEBUG_LAYOUTING - LQITime.Stop(); + dbgEvt.data = this; #endif go.parentRWLock.ExitReadLock (); } @@ -161,8 +167,8 @@ namespace Crow public override string ToString () { #if DEBUG_LAYOUTING - return string.Format ("{2};{3};{4} {1}->{0}", LayoutType,Layoutable.ToString(), - LayoutingTries,DiscardCount,LQITime.ElapsedTicks); + return string.Format ("{2};{3} {1}->{0}", LayoutType,Layoutable.ToString(), + LayoutingTries,DiscardCount); #else return string.Format ("{2};{3} {1}->{0}", LayoutType,Layoutable.ToString(), LayoutingTries, DiscardCount); |