From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74585 invoked by alias); 7 Aug 2016 09:16:35 -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 74577 invoked by uid 89); 7 Aug 2016 09:16:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:f841840, H*MI:sk:f841840, Kivity, kivity X-HELO: mail-wm0-f54.google.com Received: from mail-wm0-f54.google.com (HELO mail-wm0-f54.google.com) (74.125.82.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sun, 07 Aug 2016 09:16:24 +0000 Received: by mail-wm0-f54.google.com with SMTP id i5so91299070wmg.0 for ; Sun, 07 Aug 2016 02:16:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=/bBT6444HinBxtfkP3qo0Tc3gTGS7cIS8kDOQiGaGPU=; b=Zruoj0ryAvM6rVuge37cokGKUxXKpmcm4cfBhvYfsVMjL5sMqLjimuo1W7HdDjt3lS wADe+4dnsn0Sv22ThbPw6s7IMYS9aHkFIzT9deIzEvCLcVZ/BL+Pbq1f6Jvk9zFkn17u PzaCCZMu3WNOg9d0wb9+k8jj6WyeIY/vhWI0w5PjSYmepP1FV9+7zgdXf47pzJJM2L77 9jDS5e9iCaknyrv6CM45GQwxksnsoz+JJbIelscibyC+5edXXDdvyDKtuMkcJDwA5YQQ +CSl7ooi0hBwLLgqPdlke6y0KQyCmOOL0f6FdiLtTwxyllqKq7bVvVhGQN8u88uCJMhP NVMQ== X-Gm-Message-State: AEkooutNbDeDBvH1dCZvH7A7ZfiwQbnfdse2hdK70PwFuIM/2PsiedEykd1CsYS5miPnXA== X-Received: by 10.194.35.72 with SMTP id f8mr78032111wjj.45.1470561380888; Sun, 07 Aug 2016 02:16:20 -0700 (PDT) Received: from avi.cloudius-systems.com ([37.142.229.250]) by smtp.gmail.com with ESMTPSA id f10sm26764894wje.14.2016.08.07.02.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Aug 2016 02:16:20 -0700 (PDT) Subject: Re: Some newbie questions To: systemtap@sourceware.org References: From: Avi Kivity Message-ID: Date: Sun, 07 Aug 2016 09:16:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-q3/txt/msg00135.txt.bz2 On 08/07/2016 11:07 AM, Avi Kivity wrote: > Hello, > Hi, n00b, > A few newbie questions. > > 1. Static library support > > I am writing a static library, and would like to ship some scripts > with the library for its consumers. The library is named "seastar" > and one of the consumers is named "scylla". > > What should I write as the process name in the script? As the writer > of the library, I don't know the name of the process that will be > consuming the library. The consumer shouldn't have to write those > scripts. I could play sed games to adjust the scripts, but it's very > sad to have to do this. > You can use "@1" to paste a script parameter into the script. > 2. Inlined functions > > From the manual pages, it seems that inlined functions can be probed > (minus the .return probe), but I just get an error: > > semantic error: while resolving probe point: identifier 'process' at > script/home/avi/seastar/debug/task-latency.stap:3:7 > source: probe > process("scylla").function("reactor::run_tasks()") { > ^ > > semantic error: no match (similar functions: > _ZN7reactor14run_exit_tasksEv, statfs, dup, mkdir, ntohs) > > I will note that "mkdir" does not sound very similar to > "reactor::run_tasks()" (but I am not a native speaker). > > 3. Process CPU timers > > (more of a feature request) > > I'm trying to find causes of latency in my program. To do that, I'm > running a periodic timer and checking whether a function takes more > time than some threshold. > > Ideally, I'd be able to arm the timer on the function entry point and > disarm it on exit, rather than have it run continuously; this would > need to be a per-thread cpu-time timer (e.g. CLOCK_THREAD_CPUTIME_ID)/ > > Here's my current script for reference ("running" and "start_time" > need to become maps for it to be thread-safe): > > #!/usr/bin/stap > > global start_time > global running > > probe begin { > running = 0 > } > > probe > process("/home/avi/urchin/build/release/scylla").mark("reactor_run_tasks_start") > { > start_time = gettimeofday_us() > running = 1 > } > > probe > process("/home/avi/urchin/build/release/scylla").mark("reactor_run_tasks_end") > { > running = 0 > } > > probe timer.ms(10) { You should use timer.profile instead > now = gettimeofday_us() > if (running && (now - start_time) > 30000) { And a second parameter here. > printf("detected tasks running for >30ms\n") > print_usyms(ubacktrace()) > } > } > > I'd appreciate any tips as to whether there's a better way to do this. > >