From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16685 invoked by alias); 15 Mar 2006 22:34:25 -0000 Received: (qmail 16678 invoked by uid 22791); 15 Mar 2006 22:34:24 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 15 Mar 2006 22:34:23 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k2FMYMkp015679 for ; Wed, 15 Mar 2006 17:34:22 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k2FMYL105737; Wed, 15 Mar 2006 17:34:21 -0500 Received: from touchme.toronto.redhat.com (IDENT:postfix@touchme.toronto.redhat.com [172.16.14.9]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id k2FMYLxX025837; Wed, 15 Mar 2006 17:34:21 -0500 Received: from ton.toronto.redhat.com (ton.toronto.redhat.com [172.16.14.15]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 6F0F68001FF; Wed, 15 Mar 2006 17:34:21 -0500 (EST) Received: from ton.toronto.redhat.com (localhost.localdomain [127.0.0.1]) by ton.toronto.redhat.com (8.13.1/8.13.1) with ESMTP id k2FMYLFZ011003; Wed, 15 Mar 2006 17:34:21 -0500 Received: (from fche@localhost) by ton.toronto.redhat.com (8.13.1/8.13.1/Submit) id k2FMYL9o011000; Wed, 15 Mar 2006 17:34:21 -0500 X-Authentication-Warning: ton.toronto.redhat.com: fche set sender to fche@redhat.com using -f To: William Cohen Cc: systemtap@sources.redhat.com Subject: Re: Proposed systemtap access to perfmon hardware References: <44183FCF.6010809@redhat.com> From: fche@redhat.com (Frank Ch. Eigler) Date: Wed, 15 Mar 2006 22:34:00 -0000 In-Reply-To: <44183FCF.6010809@redhat.com> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2006-q1/txt/msg00802.txt.bz2 wcohen wrote: > [...] I have written up material describing how I would think that > systemtap could use the performance monitoring hardware. [...] It would be helpful to see a hypothetical script that would use the proposed API. Anyway, beyond such script language design issues, the hard part has been the provision of *some* kernel-side API in terms of which this stuff can be implemented. How is that going? > [...] > perfmon_allocate_counter:long (event_spec:string) > perfmon_free_counter:long (event_handle:long) > perfmon_create_context:long () > probe kernel.perfmon.sample(event_handle:long) {/*body*/} These sound rather like suitable lower level functions that the translator could use under the covers, and not functions that are wisely exposed at the script level. Specifically, I would rather expose each particular event_spec source as a first-class probe point construct: # probe perfmon.sample("event_spec") { /* body */ } This would entail calls to such alloc/free/create functions being emitted in the probe (un)registration boilerplate. "event_spec" could perhaps be expanded into several probe point components, and result in a periodic run of the handler much like timer.ms(N): # probe perfmon.counter("tlbmiss").cpu(0).sample(1000) { /* ... */ } That seems to leave just free-running counter operations: > perfmon_get_counter:long (event_handle:long) > perfmon_start_counter:long (event_handle:long) > perfmon_stop_counter:long (event_handle:long) One possible way to cast these into the language, and yet retain automatic initialization/cleanup, might be this: # probe perfmon.counter("tlbmiss").cpu(0).run { h = $handle } # probe ANY { perfmon_{get,start,stop}_counter (h) } # global h What this would do is to have that perfmon.* probe handler run just once (during initialization), supplying the script with the system-assigned handle for this counter. Then another probe (though probably not a "begin" one) can use that handle value to manipulate the counter. - FChE