/[projects]/dao/DaoMqPump2/DaoMqPump2/ElapsedTimer.cs
ViewVC logotype

Annotation of /dao/DaoMqPump2/DaoMqPump2/ElapsedTimer.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2070 - (hide annotations) (download)
Wed Nov 13 10:09:10 2013 UTC (10 years, 6 months ago) by torben
File size: 723 byte(s)
Add ElapsedTimer to ease debug timing
1 torben 2070 using System;
2     using System.Collections.Generic;
3     using System.Text;
4    
5     namespace DaoMqPump2
6     {
7     class ElapsedTimer
8     {
9     long start;
10    
11     public ElapsedTimer()
12     {
13     startTimer(); //Constructor also starts the timer
14     }
15    
16    
17     public void startTimer()
18     {
19     start = DateTime.Now.Ticks;
20     }
21    
22     public void stopAndPrint(string msg)
23     {
24     long stop = DateTime.Now.Ticks;
25    
26     long elapsed = (stop - start) / 10000; //omreg tidsforskel til millisekunder
27    
28    
29     Console.WriteLine( msg + " took " + elapsed + " milliseconds ");
30    
31     startTimer(); //when done reset timer
32     }
33     }
34     }

  ViewVC Help
Powered by ViewVC 1.1.20