Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2197 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
8 changed files with 148 additions and 98 deletions
@ -0,0 +1,50 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
namespace Debugger.Util |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// HighPrecisionTimer can obtain much more accurate time measurement
|
||||||
|
/// for performace optimization
|
||||||
|
/// </summary>
|
||||||
|
public static class HighPrecisionTimer |
||||||
|
{ |
||||||
|
[DllImport("kernel32.dll")] |
||||||
|
static extern int QueryPerformanceFrequency(out long frequency); |
||||||
|
|
||||||
|
[DllImport("kernel32.dll")] |
||||||
|
static extern int QueryPerformanceCounter(out long count); |
||||||
|
|
||||||
|
static DateTime startTime; |
||||||
|
static long startTicks; |
||||||
|
|
||||||
|
static HighPrecisionTimer() |
||||||
|
{ |
||||||
|
startTime = DateTime.Now; |
||||||
|
startTicks = Ticks; |
||||||
|
} |
||||||
|
|
||||||
|
static long Ticks { |
||||||
|
get { |
||||||
|
long frequency; |
||||||
|
long count; |
||||||
|
QueryPerformanceFrequency(out frequency); |
||||||
|
QueryPerformanceCounter(out count); |
||||||
|
return (count / frequency) * TimeSpan.TicksPerSecond + (count % frequency) * TimeSpan.TicksPerSecond / frequency; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static DateTime Now { |
||||||
|
get { |
||||||
|
return startTime.AddTicks(Ticks - startTicks); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,16 +1,16 @@ |
|||||||
// <file>
|
// <file>
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
// <license see="prj:///doc/license.txt"/>
|
// <license see="prj:///doc/license.txt"/>
|
||||||
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
||||||
// <version>$Revision$</version>
|
// <version>$Revision$</version>
|
||||||
// </file>
|
// </file>
|
||||||
|
|
||||||
using System; |
using System; |
||||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||||
|
|
||||||
namespace Debugger |
namespace Debugger.Util |
||||||
{ |
{ |
||||||
static class Util |
public class Lists |
||||||
{ |
{ |
||||||
public static List<T> MergeLists<T>(T a, IEnumerable<T> b) |
public static List<T> MergeLists<T>(T a, IEnumerable<T> b) |
||||||
{ |
{ |
||||||
Loading…
Reference in new issue