Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp137783ybj; Wed, 6 May 2020 13:29:12 -0700 (PDT) X-Google-Smtp-Source: APiQypILJsrLPj4Gyq3FfQCi2p8ZaOI6EKJ0/fL+QjCsbvFzRBcDji6yjh+lbgtC/aFyeY7PKXgP X-Received: by 2002:aa7:ce0f:: with SMTP id d15mr8788267edv.327.1588796952430; Wed, 06 May 2020 13:29:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588796952; cv=none; d=google.com; s=arc-20160816; b=sbgEZf9zc3ufAhzdUW0xJlkn7n8tEpSb14NDyO8X375xY6RJiNRAp8iqbO8WheFYsr q5TpKqu5rmCcOgYjaRitEIn8/NERxSG2gGnGOdO8P6NAw+zOd0sEgpV4/fmLThFelMLW 0b8AstJtW7Dok+IFEZufeQrLsFUv0ws9zUGZY3VOqjrXHo4BvyNn/h2w6z7hhW3hp0fs Y012C2Sa2uiD+48PgiluC/TICeq5W5cdNaEaO28DFzQbC6B5F5tyob+LicBJDOR19aR3 4LGmpKtzjk6lKTo81c28ghBoNmklSz/aySWZ7MC/g0QVbOb5QpfQEfYlRYlYqVd4nOEg Fc5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=Q9s4I1o5IX8Wg3SHujx9lxLs/R1td5fuwj/H84wrEJI=; b=GilbiD6xRDn2KT60hau9vU389mTOpXPbOIhQO0Ro3NLw/31VGZ/vPWb2JQsG2m7FtF BNOk7q8hux0x0mxaFMqclNWhDbtVmnGv0dmBM2NZwmYAmaPtDCMjbmiWG+CMNKIPylL0 h06730EnBnaWZbKVHgbcnqQF+ayHrMib0VCW0kGvkiYx8uldWxXb3eGp/RuztrXYxu3r 0ZfgCDr4B5UQZfUDaQHe/A2xIMsyYc58v21XtbwiskIwcrEtmhPOObnUH9IluSiYLhWA 2ynLzRLef6HxtYM3eoJusSEPRblNJu6JoknlIlFR8GHA/686sG//0HmuDbG6VMYRiROq 48fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=beHTKUlq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q13si1831640edn.307.2020.05.06.13.28.48; Wed, 06 May 2020 13:29:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=beHTKUlq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728784AbgEFUWj (ORCPT + 99 others); Wed, 6 May 2020 16:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726495AbgEFUWi (ORCPT ); Wed, 6 May 2020 16:22:38 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9DDC061A0F for ; Wed, 6 May 2020 13:22:38 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id f13so3608282qkh.2 for ; Wed, 06 May 2020 13:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Q9s4I1o5IX8Wg3SHujx9lxLs/R1td5fuwj/H84wrEJI=; b=beHTKUlqp5XjjG6AK5zSrrUylmowierhhUXhyTI2hrMVKM0luwyjMnPSOAI95wvBkM 5y18/CVUT+oGu6IaFS6Oo3mhyPn3qs8k7cdY5oG6LLIO426dzmQY/xsrzQ+brYaAkmw8 6rzliHX0qw8pyqO9LnCHIC3B3UZKrX4bglm1JyCek43GP62kivJb2S5aX0VKm4syTBkW ioR3GzhyReaRTv8okeVIMdLOKoikpTTZZLsPZQ+tScYAJXUYo27bZ7JON2iEdN8slKPQ kbifUpyM2OdLglm+M13PxG3/uUgsK4LqTnPOcLyE/ZVVdHhNjvBZ50Y4hHA4yH30fHAU B2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q9s4I1o5IX8Wg3SHujx9lxLs/R1td5fuwj/H84wrEJI=; b=cx7kdzrfhli7RYpt2PpeZ0CNRVOq6ZM8QrlxXagO7fx6tjDm3w5yanvQNEkwEAYW50 cPw6Xwp+cNAh55Nwtz0qL6cN8e3V5G22vRdXR0C/gUAhlTyMuS5PSOY1CXI1a+E2MA4+ hMVod9a/BGAAPi6LIvhlpkvetiNCX1BsyyUpnVTFqobkvyz+kNCnDl8CrxnpKH7iInsj F/piyMkCZ3iXBGxvXXzMSTJCjrib95B5MXJqptF7Og5BgABRK1aC0F44F2GahTFr9DYL NbeFiR4KB6jzCQOtcF9FbjYieBhJUUhb1FHs2gCKPbk91C86G5vrw8g5dHJdVbYJdVwJ mUnw== X-Gm-Message-State: AGi0PuZ0WLKQY9MxDRXN8i4I+gG05hERA0TZ2SOfL5n/gKkrh9w08FPZ ZdRgwp97jCWaiejdxGibamI= X-Received: by 2002:a37:a749:: with SMTP id q70mr10715738qke.68.1588796557931; Wed, 06 May 2020 13:22:37 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.37.151]) by smtp.gmail.com with ESMTPSA id z90sm2501612qtd.75.2020.05.06.13.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 13:22:37 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 1B947409A3; Wed, 6 May 2020 17:22:35 -0300 (-03) Date: Wed, 6 May 2020 17:22:35 -0300 To: Alexey Budankov Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , Andi Kleen , linux-kernel Subject: Re: [PATCH v2 07/11] perf docs: extend stat mode docs with info on --ctl-fd[-ack] options Message-ID: <20200506202235.GG9893@kernel.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, May 06, 2020 at 09:22:55PM +0300, Alexey Budankov escreveu: > > Extend perf-stat.txt file with --ctl-fd[-ack] options description. > Document possible usage model introduced by --ctl-fd[-ack] options > by providing example bash shell script. Please update the docs in the same patch that introduces the options being documented. - Arnaldo > Signed-off-by: Alexey Budankov > --- > tools/perf/Documentation/perf-stat.txt | 40 ++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt > index 3fb5028aef08..19ed53e08294 100644 > --- a/tools/perf/Documentation/perf-stat.txt > +++ b/tools/perf/Documentation/perf-stat.txt > @@ -164,6 +164,46 @@ with it. --append may be used here. Examples: > 3>results perf stat --log-fd 3 -- $cmd > 3>>results perf stat --log-fd 3 --append -- $cmd > > +--ctl-fd:: > +--ctl-fd-ack:: > + > +Listen on ctl-fd descriptor for command to control measurement ('e': enable events, > +'d': disable events). Optionally send control command completion ('a') to fd-ack > +descriptor to synchronize with the controlling process. Example of bash shell script > +to enable and disable events during measurements: > + > +#!/bin/bash > + > +ctl_dir=/tmp/ > + > +ctl_fifo=${ctl_dir}perf_ctl.fifo > +test -p ${ctl_fifo} && unlink ${ctl_fifo} > +mkfifo ${ctl_fifo} > +exec {ctl_fd}<>${ctl_fifo} > + > +ctl_ack_fifo=${ctl_dir}perf_ctl_ack.fifo > +test -p ${ctl_ack_fifo} && unlink ${ctl_ack_fifo} > +mkfifo ${ctl_ack_fifo} > +exec {ctl_fd_ack}<>${ctl_ack_fifo} > + > +perf stat -D -1 -e cpu-cycles -a -I 1000 \ > + --ctl-fd ${ctl_fd} --ctl-fd-ack ${ctl_fd_ack} \ > + -- sleep 30 & > +perf_pid=$! > + > +sleep 5 && echo 'e' >&${ctl_fd} && read -u ${ctl_fd_ack} e1 && echo "enabled(${e1})" > +sleep 10 && echo 'd' >&${ctl_fd} && read -u ${ctl_fd_ack} d1 && echo "disabled(${d1})" > + > +exec {ctl_fd_ack}>&- > +unlink ${ctl_ack_fifo} > + > +exec {ctl_fd}>&- > +unlink ${ctl_fifo} > + > +wait -n ${perf_pid} > +exit $? > + > + > --pre:: > --post:: > Pre and post measurement hooks, e.g.: > -- > 2.24.1 > > -- - Arnaldo