Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4295358pxk; Tue, 22 Sep 2020 16:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg/7GwSpZa12mHLFW+SoWW7tynFKmJsAxsaDMFMXME+Drb5SfhF5WdHtoEqFng1E1T6U2b X-Received: by 2002:a05:6402:21c5:: with SMTP id bi5mr6736505edb.380.1600815679788; Tue, 22 Sep 2020 16:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600815679; cv=none; d=google.com; s=arc-20160816; b=Yo0ANgHEldHB+3+ue4+xBNY4Zrin9M7pvOH8DGJpuzJ6V/icXixfcMYaLg8O6Pp3MV M6FcsuBY92YFX7vnvqZuCq6SyrLXMbELivtLrllq9DvDILNeLZFshqKAH59ben3Tx7eq rnZ4XkHEEe6DIUhb/ZQy/iq801Es7KjP2Fo3ASidBDmEiWUcs8cOcYoLPATldEp5smKh vi6hbRwHpw+vHvDyyESatpyi/2ZE/6fRdHq+XKDLhEdd7ciGclLGkShMC3JhaLWsGeKm 2WnOVoaLE14XCGMhTl5CN4fC/V9s7YzGEfoFLmEFJw+qWdOsvFWi3p09718rLZ2G3iu0 avCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=9yz/dntHJAQmyWx39DxcIDsmJJPCYBH5IoHF45cttlA=; b=RCJiLIAB1Xjg9aJNLekzeZ2xUroWziA1h8HMN4RdFDKqcFA8gvRRfDf7X6uQhSHvQ8 gDXo7e87RzfoPUfB+pGqQEX7ruGlVkvDxcL90Q0S6bert7K7VQcSEH9uHPFtzlSXVWQn 7F3VoCOII7eWlmmF+cUWa0Ejkn1YYB9ntAqNR65m7YBM2v1A1z5+9iTZOOrzZY7O+PTA 4QTBfVzoDuv10hGkBQlGTVjnoFZ1+9KwgLu0OdQd2AC6G5iY9LDngt6q/+K7OarAw8vP 0WVz62r+IVss6oTGUtQefISUsJdXZl0uf4QkcqZ7vm+cqYDHc7qlAy/bJWqqa4j1jSLa tPAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m23si11167946ejo.333.2020.09.22.16.00.54; Tue, 22 Sep 2020 16:01:19 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726819AbgIVW54 (ORCPT + 99 others); Tue, 22 Sep 2020 18:57:56 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46901 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726614AbgIVW54 (ORCPT ); Tue, 22 Sep 2020 18:57:56 -0400 Received: by mail-wr1-f68.google.com with SMTP id o5so18812898wrn.13 for ; Tue, 22 Sep 2020 15:57:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9yz/dntHJAQmyWx39DxcIDsmJJPCYBH5IoHF45cttlA=; b=SSvI+2AR4b+qVlOYWZ72Fupp6LpXbdQqYWpd+U3gtE3dtbfyyZ3WqEjLOYYTf5m8Lv iIX3QHDNiqLXSyDSLjwn7EuDAJqlbMwLoG9PE2/e4rIKK3Ycu7Xb2SJi5dBhj7j+s9Rq 9WQ/Qymnl95x1QVJVYDoYju7pCw+Vf6j6JFlwd+sfKAPn4E+l+t8r2dSUxQdaSpUaIBY GkP1HoIKXvqoYAyEihEGz1roRTPAkS3Jx35TLNKfbms1kkuo/lAgswKZ6n8wldE0cYIY 8T7WgeDmTOe7egIDwA3KgTEYRXSY+uWxiEcH4gQmLxkLa5cY/b37dbW4vf3FGqGz1a+R ukoA== X-Gm-Message-State: AOAM532AsSYyEGaZVgKm2ZNwREjkO779Vb6VhJK20UbrzS2tX40qZenT ZuNQ6E3h12o2hRT+TPrrXMNGjKCC33YsS34Va4Q= X-Received: by 2002:adf:9e41:: with SMTP id v1mr8514600wre.60.1600815474589; Tue, 22 Sep 2020 15:57:54 -0700 (PDT) MIME-Version: 1.0 References: <20200921094610.83736-1-namhyung@kernel.org> <20200921094610.83736-3-namhyung@kernel.org> In-Reply-To: <20200921094610.83736-3-namhyung@kernel.org> From: Namhyung Kim Date: Wed, 23 Sep 2020 07:57:43 +0900 Message-ID: Subject: Re: [PATCH 2/5] perf stat: Add --for-each-cgroup option To: Arnaldo Carvalho de Melo , Jiri Olsa Cc: Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , LKML , Stephane Eranian , Andi Kleen , Ian Rogers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 6:46 PM Namhyung Kim wrote: > > The --for-each-cgroup option is a syntax sugar to monitor large number > of cgroups easily. Current command line requires to list all the > events and cgroups even if users want to monitor same events for each > cgroup. This patch addresses that usage by copying given events for > each cgroup on user's behalf. > > For instance, if they want to monitor 6 events for 200 cgroups each > they should write 1200 event names (with -e) AND 1200 cgroup names > (with -G) on the command line. But with this change, they can just > specify 6 events and 200 cgroups with a new option. > > A simpler example below: It wants to measure 3 events for 2 cgroups > ('A' and 'B'). The result is that total 6 events are counted like > below. > > $ ./perf stat -a -e cpu-clock,cycles,instructions --for-each-cgroup A,B sleep 1 > > Performance counter stats for 'system wide': > > 988.18 msec cpu-clock A # 0.987 CPUs utilized > 3,153,761,702 cycles A # 3.200 GHz (100.00%) > 8,067,769,847 instructions A # 2.57 insn per cycle (100.00%) > 982.71 msec cpu-clock B # 0.982 CPUs utilized > 3,136,093,298 cycles B # 3.182 GHz (99.99%) > 8,109,619,327 instructions B # 2.58 insn per cycle (99.99%) > > 1.001228054 seconds time elapsed > > Signed-off-by: Namhyung Kim > --- > tools/perf/builtin-stat.c | 20 +++++++++- > tools/perf/util/cgroup.c | 84 +++++++++++++++++++++++++++++++++++++++ > tools/perf/util/cgroup.h | 1 + > tools/perf/util/stat.h | 1 + > 4 files changed, 105 insertions(+), 1 deletion(-) Oh, I've realized that I didn't update the man page.. I'll send v4 soon. Thanks Namhyung