From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7365 invoked by alias); 30 Jan 2012 17:53:30 -0000 Received: (qmail 7358 invoked by uid 22791); 30 Jan 2012 17:53:28 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 Jan 2012 17:53:07 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0UHr7jH024175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 30 Jan 2012 12:53:07 -0500 Received: from [10.11.231.236] (deploy7.rdu.redhat.com [10.11.231.236]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0UHr5KX003102; Mon, 30 Jan 2012 12:53:06 -0500 Message-ID: <4F26D901.6060403@redhat.com> Date: Mon, 30 Jan 2012 17:53:00 -0000 From: William Cohen User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111104 Red Hat/3.1.16-2.el6_1 Thunderbird/3.1.16 MIME-Version: 1.0 To: "Frank Ch. Eigler" CC: systemtap@sourceware.org Subject: Re: [PATCH] Add the stopwatch.stp tapset References: <1327610194-13346-1-git-send-email-wcohen@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2012-q1/txt/msg00063.txt.bz2 On 01/26/2012 07:58 PM, Frank Ch. Eigler wrote: > William Cohen 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