From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25636 invoked by alias); 20 Jul 2016 16:23:21 -0000 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 Received: (qmail 25622 invoked by uid 89); 20 Jul 2016 16:23:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:1664305, H*f:sk:1664305, H*MI:sk:1664305, H*M:JavaMail X-HELO: mx5-phx2.redhat.com Received: from mx5-phx2.redhat.com (HELO mx5-phx2.redhat.com) (209.132.183.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 20 Jul 2016 16:23:18 +0000 Received: from zmail26.collab.prod.int.phx2.redhat.com (zmail26.collab.prod.int.phx2.redhat.com [10.5.83.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6KGNHBI026713; Wed, 20 Jul 2016 12:23:17 -0400 Date: Wed, 20 Jul 2016 16:23:00 -0000 From: Felix Lu To: David Smith Cc: systemtap@sourceware.org Message-ID: <618954375.23238013.1469031797599.JavaMail.zimbra@redhat.com> In-Reply-To: <1664305233.23200444.1469028311973.JavaMail.zimbra@redhat.com> References: <540973478.22718523.1468962366224.JavaMail.zimbra@redhat.com> <70bd0aff-e6bb-3131-e270-598363dfb188@redhat.com> <28211526.23172955.1469026042792.JavaMail.zimbra@redhat.com> <2000cfc0-9b01-e61d-23a8-bcded4c78be4@redhat.com> <1664305233.23200444.1469028311973.JavaMail.zimbra@redhat.com> Subject: Re: Writing tapset functions for multiple versions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-q3/txt/msg00073.txt.bz2 > > > A global integer instead of the string comparison could be set if you > > > are worried about the overhead. In the example above, tid() could be > > > saved in the probe alias body as a private global which would be > > > sufficient > > > for identifying the desired function. > > > > I'm not quite sure how saving tid() in a private global would work if > > you are probing more than one thread at a time. Or did I misunderstand > > your idea and your global is an array? If the private global is an > > array, now we've got 2 private global arrays (1 for version1.stp and 1 > > for version2.stp). > > A global scalar should suffice in this case. All we want is for the function > f in version1.stp to be called when version1/process is executed and likewise > for version2. The probe alias body in the above example would update the > saved > tid() every time it's hit. Using a saved global may not be more efficient than the pp() regex comparison. Systemtap global variables are locked upon probe handler entry. By updating the saved tid(), an exclusive lock must be obtained. The overhead from this may be greater than the string matching.