simple benchmarking timer

R

Roedy Green

I took a look in the usual places and did not see anything like this:
I was about to write a little utility for timing benchmarks.

This is for multistep jobs or where you don't have access to the
source.

You would type something like this:

///////////////////////////////

timer start

prog.exe

timer elapsed "some identification string" > bench1.txt
rem in millis since start followed by id string.

prog2.exe

timer elapsed "prog2" > bench2.txt
rem in millis since previous call to timer

////////////////////////////////

Is there such a beast? It would be best written in C or MASM to avoid
skewing the results with a long Java load.

Do you have such a thing in your toolbox? there used to be something
like this part of the Norton Utilities.
 
R

Roger Lindsjö

Roedy said:
I took a look in the usual places and did not see anything like this:
I was about to write a little utility for timing benchmarks.

This is for multistep jobs or where you don't have access to the
source.

You would type something like this:

///////////////////////////////

timer start

prog.exe

timer elapsed "some identification string" > bench1.txt
rem in millis since start followed by id string.

prog2.exe

timer elapsed "prog2" > bench2.txt
rem in millis since previous call to timer

Is that delta since previous call to timer (any argument) or to timer
start?

Would the time command be useful? In bash:

time (prog.exe) 2> bench1.txt
 
R

Roedy Green

Would the time command be useful? In bash:

time (prog.exe) 2> bench1.txt


the time command in Windows has two problems:

1. resolution only to the second.

2. it won't compute elapsed times. you have to do that manually or
with a separate program to analyse some log.
 
R

Roedy Green

Is that delta since previous call to timer (any argument) or to timer
start?

I intended elapsed to be since the previous call, not since start. If
you start squirting out too much info, it becomes more difficult to
collect and extract what you need to prepare benchmark tables etc.

This strikes me as such an obvious and simple utility that I expected
to find dozens of them.

A complication is you want this multiplatform so you can hand Java
code out to other people to test on various platforms. Yet Java is so
slow-starting it would disrupt what you are trying to measure if I
wrote this in Java.

Perhaps I can write some vanilla-as-possible C, and ask people to
compile it on various platforms, and distribute them all as a bundle.

Perhaps another approach is to write a multiplatform timer in Java
that spawns stages with exec rather than using a script. Then you
could do things like benchmark ant scripts or Javac compiles. You
would also call code directly.

It might then be more clever and squirt out HTML tables, CSV and etc
to summarize the results in various ways. That might make it even
easier for people to run benchmarks on other platforms.
 
A

Arne Vajhøj

Roedy said:
I took a look in the usual places and did not see anything like this:
I was about to write a little utility for timing benchmarks.
Is there such a beast? It would be best written in C or MASM to avoid
skewing the results with a long Java load.

Do you have such a thing in your toolbox? there used to be something
like this part of the Norton Utilities.

Cygwin has a port of the *nix time utility - this seems OK
for most usage.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top