I used to be a big fan of
GetTickCount
for quick performance tests. Now I find myself using
QueryPerformanceCounter in .NET all of the time after reading
Rico Mariani's blog.
There is a great article about it
here. So if you want to measure a Web Service call, you can do this...
[DllImport("Kernel32.dll")]
private
static extern
bool QueryPerformanceCounter(out
long lpPerformanceCount);
[DllImport("Kernel32.dll")]
private
static extern
bool QueryPerformanceFrequency(out
long lpFrequency);
long
startTime, endTime, freq;
QueryPerformanceFrequency(out freq);
QueryPerformanceCounter(out startTime);
int
confirmationNumber = service.SomeWebServiceMethod(request);
QueryPerformanceCounter(out endTime);
Console.WriteLine("Confirmation Number: " + confirmationNumber);
Console.WriteLine("frequency: {0:n0}", freq);
Console.WriteLine("time: {0:n5}s",
(endTime - startTime)/(double) freq);