Files
IPMonitor/Profiler.cs
2024-03-13 18:23:27 -04:00

48 lines
894 B
C#

using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Text;
// Filename: Profiler.cs
// Author:Sean Kessler
namespace IPMonitor
{
/// <summary>Profiler - Profiler utility class</summary>
public class Profiler
{
[DllImport("kernel32.dll")]
static extern uint GetTickCount();
private uint elapsedTime;
private uint totalTime;
public Profiler()
{
totalTime = GetTickCount();
Start();
}
public void Reset()
{
totalTime = GetTickCount();
Start();
}
public void Start()
{
elapsedTime = GetTickCount();
}
public uint Split()
{
return GetTickCount() - elapsedTime;
}
public uint Stop()
{
return elapsedTime = GetTickCount() - elapsedTime;
}
public uint End()
{
return totalTime = GetTickCount() - totalTime;
}
}
}