Sunday, November 22, 2009

Measuring Process Times with ptime

I'm currently doing a little series of posts for my Windows/.NET DDJ Guru Blog covering the performance of the recls (C++) and recls 100% .NET libraries. The first study involves writing a simple application to search for C# source files (excluding Properties/AssemblyInfo.cs), and reporting how much effort it is to write, and how fast it executes.

The latter point has some interest: how do you meaningfully compare performances of tools that have strong interactions with operating system components that exhibit high and variable latency?

The answer I've been using for many years relies upon (on Windows) the use of the ptime tool. The command-lines are (for the C++ program):

ptime --r3 --ah -- ...\CSharpSourceFinder\cpp\CSharpSourceFinder\vc9\Release\CSharpSourceFinder.cpp.exe

and (for the C# program):

ptime --r3 --ah -- ...\CSharpSourceFinder\dotnet\CSharpSourceFinder\bin\Release\CSharpSourceFinder.exe

I'll leave you to peruse the ptime usage, but will comment that each of these command-lines causes the search to be run three times, and averages the times for all runs, after discarding the largest (which we can reasonably presume would be the first). It's not ultimate precision, but it's pretty useful at discarding unrepresentative measurements in such conditions, and gives figures within (I'm guessing now) 5% of their true figures.

No comments:

Post a Comment