File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed
Flow.Launcher.Infrastructure Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
32using System . Threading . Tasks ;
43using Flow . Launcher . Infrastructure . Logger ;
54
65namespace Flow . Launcher . Infrastructure
76{
87 public static class Stopwatch
98 {
10- private static readonly Dictionary < string , long > Count = new Dictionary < string , long > ( ) ;
11- private static readonly object Locker = new object ( ) ;
129 /// <summary>
1310 /// This stopwatch will appear only in Debug mode
1411 /// </summary>
@@ -62,36 +59,5 @@ public static async Task<long> NormalAsync(string message, Func<Task> action)
6259 Log . Info ( info ) ;
6360 return milliseconds ;
6461 }
65-
66-
67-
68- public static void StartCount ( string name , Action action )
69- {
70- var stopWatch = new System . Diagnostics . Stopwatch ( ) ;
71- stopWatch . Start ( ) ;
72- action ( ) ;
73- stopWatch . Stop ( ) ;
74- var milliseconds = stopWatch . ElapsedMilliseconds ;
75- lock ( Locker )
76- {
77- if ( Count . ContainsKey ( name ) )
78- {
79- Count [ name ] += milliseconds ;
80- }
81- else
82- {
83- Count [ name ] = 0 ;
84- }
85- }
86- }
87-
88- public static void EndCount ( )
89- {
90- foreach ( var key in Count . Keys )
91- {
92- string info = $ "{ key } already cost { Count [ key ] } ms";
93- Log . Debug ( info ) ;
94- }
95- }
9662 }
9763}
You can’t perform that action at this time.
0 commit comments