This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add the stopwatch.stp tapset


On 01/26/2012 07:58 PM, Frank Ch. Eigler wrote:
> William Cohen <wcohen@redhat.com> writes:
> 
>> The stopwatch.stp tapset provides multiple, independent timers to user
>> scripts.  Stopwatches can be created by the user script at
>> anytime. [...]
> 
> Might you consider a somewhat simpler API?
> 
> function start_stopwatch (name:string) { }
> function stop_stopwatch (name:string) { }
> function read_stopwatch_ns:long (name:string) { }
> function read_stopwatch_us:long (name:string) { }
> function read_stopwatch_ms:long (name:string) { }
> function read_stopwatch_s:long (name:string) { }
> 
> i.e., no explicit create (the tapset can create it on first encounter
> of a new name), no enums (encode start/stop as distinct functions),
> and explicit reader functions.
> 
> - FChE


Hi Frank,

One thing missing from the simpler API is a way to clean things up.  If a script has many stopwatches of limited lifetime, it would be possible for the stopwatch tapset to cause the associative arrays to fill up.  There needs to be a:

function delete_stopwatch (name:string) {}

probably should have matching optional that can be explicitly called if desired:

function create_stopwatch (name:string) {}

Going through and trying to code up this API this afternoon.

-Will


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]