PerfCtr - Ruby Performace Counters Interface

Version:          0.1.0
Release date:     2002-01-29
Home page:        http://aspectr.sf.net/perfctr
Tarball:          http://prdownloads.sf.net/aspectr/perfctr-0-1-0.tar.gz
Author:           Robert Feldt
Email:            feldt@ce.chalmers.se

What is it?

Simple wrappers for accessing CPU and OS performance counters. Includes both a "convenience" API for simple but accurate measurements and a low-level API for increased effeciency and maximum functionality.

Currently this is very limited and can simply be used for high-resolution timing.

In the long run we will probably build this on top of PAPI the standard, portable PerformanceAPI available from http://icl.cs.utk.edu/papi. PAPI will give a common interface to performance counting on multiple processors and operating systems. However, it does not yet support the windows platform.

Does it work on my machine?

Currently only if you have a Pentium machine running Windows 2000 and cygwin. Should work on NT but this haven't been tested. Since at least the pentium has a special machine instruction for acessing the counter we need it should be simple to do it also on linux. If you do it please send me the code and I'll extend this to work on Linux.

Installation?

  1. unpack tarball (if you haven't already)
  2. ruby extconf.rb
  3. make
  4. make install

Example of use?

        require 'perfctr'
        t = PerformanceCounters.time do
          # lengthy calculation here...
        end
        # t contains the number of wallclock seconds the computation took

Requirements?

ANSI C compiler, Ruby and cygwin.

Documentation?

None yet but there are very few methods. See the file in the tests dir.

License and legal issues?

Copyright (c) 2001, 2002 Robert Feldt, feldt@ce.chalmers.se. All rights reserved.

and they are distributed under GPL. See LICENSE.

Special things to note?

The timer measures real (wallclock) time. NOT user time in your Ruby process. Thus you should not use for timing your process over long periods.

Plans for the future?

When PAPI works on Windows use it instead to get multi-platform conformance.

Do you have comments or questions?

I'd appreciate if you drop me a note if you're successfully using PerfCount. If there are some known users I'll be more motivated to packing up additions / new versions and post them to RAA.

Happy coding!

Robert Feldt, feldt@ce.chalmers.se