[m-dev.] Advice needed on benchmarking library

Ralph Becket rbeck at microsoft.com
Fri Oct 27 22:52:40 AEDT 2000


I need to knock up a benchmarking library to count various events and
I don't want to have to thread some extra bit of state throughout my
program.

The interface I'm planning will look something like this:

:- module bmctr.
:- interface.
:- impure pred init(string::in) is det.
:- impure pred reset(string::in) is det.
:- impure pred inc(string::in) is det.
:- semipure func value(string) = int.

Each event of interest is given a string identifier by the programmer
who then augments the program with appropriate calls to bmctr.

It would be simplest if I could implement this in Mercury as, say, a
map(string, int) and just keep a persistent pointer to the counter
map using the C interface.  However, I don't know what the implications
are re: garbage collection with this approach - I suspect bad things
might happen.

The alternative is to implement everything in C which is mildly
upsetting, but not too taxing.

Any advice on the matter would be much appreciated.

Cheers,

Ralph

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list