Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp927341pxk; Thu, 10 Sep 2020 02:17:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOTvk9A1we4bqAEb6ho2PM4LIsovMCyj7TQbFI3Y98vwEx1lkZcUhoa5txR65T48tw0U0N X-Received: by 2002:a17:906:1b55:: with SMTP id p21mr8159689ejg.457.1599729476092; Thu, 10 Sep 2020 02:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599729476; cv=none; d=google.com; s=arc-20160816; b=Ca/jm2TrVE5Oh1hZf2jGqIzsGFoI+TKGT+D84EpCADQBnWIF6UeB4RZuXflrxlbKKJ Tk5YpJXcb39gWiBLB45tKDNF8DBbieg/nrX225OBbyfi094jsxqFrSKlNtb0W883ELuk 6obvSI/TkhFovGv6q7QTB1HbL+BzOxXfu0YDglD21EEOKR2PPAkStg28SthTv5u++jYc lv7Dyshj2B8u0F0T9PWkjULpvKm57SpjC9xGyQ/XH6vQi7cerfEuuwvJIMHc1APqCaNO BIbx+L+A+s1qzItPS80VcXDc1KCDIK20VAUW8yR3vJsMpMO2XuOH2rDilPh+AVTXLn/o oGTA== 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:from:date :dkim-signature; bh=czuBZIOscqzQk5jqJ84r8SXPBiAZdteJChFUgK2pz/I=; b=IjCWr0AEOo1OSf+21wucqEqMKu/uinMMy83XNnzGP5etw/77K+t3u2gW6F4BiYum+T DczIPsBzp47FuRId4IBH1ot9ywOtbzoll7O53NwO0TZw6nT42GfHGx5Jqb9DiePx8Ql8 PBK2CY7IJJ1sb5i2txGOE/oljhfPa0Vuu+g/CLDQJwOnKnqXwR2tcA911ZlcCPWtOfkV g78CYCZ5bX5CrTjD+Qv4KXqhdF8JCYkc5t6RktdVa36FcR7t2t0btY3JFyOsKwsRitiy 9U4jfTsFdCHMY0oT0HEUSndzHYleiJy3F4JgIkUMDParw5Gz99pfMonk5wEx/Xz1OVb4 zK7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=O5xaxV9o; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si3173307ejx.46.2020.09.10.02.17.33; Thu, 10 Sep 2020 02:17:56 -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=@redhat.com header.s=mimecast20190719 header.b=O5xaxV9o; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730330AbgIJJQh (ORCPT + 99 others); Thu, 10 Sep 2020 05:16:37 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:22700 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726600AbgIJJPy (ORCPT ); Thu, 10 Sep 2020 05:15:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599729353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=czuBZIOscqzQk5jqJ84r8SXPBiAZdteJChFUgK2pz/I=; b=O5xaxV9olVMenq2pzjZRTSPnh9pnm+D/94A2KvJxFUBfDt1+/g8VCvLjpjZ/E59WRKrKMk QDgw+zxDV1m0sKG043Ss+XcJfaGpoRoj6lGsqFFDrn0zQYB/SQeHU/a/AdgRmNBB++xs4U zMw4UwGnePPS7FohR2+0DSq4bpI1iwM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-449-pzU5tW4tNKu4eAeCAvzTYA-1; Thu, 10 Sep 2020 05:15:49 -0400 X-MC-Unique: pzU5tW4tNKu4eAeCAvzTYA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4C4D3801FDA; Thu, 10 Sep 2020 09:15:46 +0000 (UTC) Received: from krava (unknown [10.40.192.38]) by smtp.corp.redhat.com (Postfix) with SMTP id 89C3C9CBA; Thu, 10 Sep 2020 09:15:43 +0000 (UTC) Date: Thu, 10 Sep 2020 11:15:42 +0200 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , Mark Rutland , Alexander Shishkin , Stephane Eranian , LKML , Andi Kleen , Ian Rogers Subject: Re: [PATCHSET 0/4] perf stat: Add --multiply-cgroup option Message-ID: <20200910091542.GD1627030@krava> References: <20200908044228.61197-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200908044228.61197-1-namhyung@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 08, 2020 at 01:42:24PM +0900, Namhyung Kim wrote: > Hello, > > When we profile cgroup events with perf stat, it's very annoying to > specify events and cgroups on the command line as it requires the > mapping between events and cgroups. (Note that perf record can use > cgroup sampling but it's not usable for perf stat). > > I guess most cases we just want to use a same set of events (N) for > all cgroups (M), but we need to specify NxM events and NxM cgroups. > This is not good especially when profiling large number of cgroups: > say M=200. > > So I added --multiply-cgroup option to make it easy for that case. It > will create NxM events from N events and M cgroups. One more upside > is that it can handle metrics too. agreed that it's PITA to use -G option ;-) > > For example, the following example measures IPC metric for 3 cgroups > > $ cat perf-multi-cgrp.sh > #!/bin/sh > > METRIC=${1:-IPC} > CGROUP_DIR=/sys/fs/cgroup/perf_event > > sudo mkdir $CGROUP_DIR/A $CGROUP_DIR/B $CGROUP_DIR/C > > # add backgroupd workload for each cgroup > echo $$ | sudo tee $CGROUP_DIR/A/cgroup.procs > /dev/null > yes > /dev/null & > echo $$ | sudo tee $CGROUP_DIR/B/cgroup.procs > /dev/null > yes > /dev/null & > echo $$ | sudo tee $CGROUP_DIR/C/cgroup.procs > /dev/null > yes > /dev/null & > > # run 'perf stat' in the root cgroup > echo $$ | sudo tee $CGROUP_DIR/cgroup.procs > /dev/null > perf stat -a -M $METRIC --multiply-cgroup -G A,B,C sleep 1 would it be easier to have new option for this? like: perf stat -a -M $METRIC --for-cgroup A,B,C perf stat -a -M $METRIC --for-each-cgroup A,B,C perf stat -a -M $METRIC --attach-cgroup A,B,C perf stat -a -M $METRIC --attach-to-cgroup A,B,C I'm still not sure how the --multiply-cgroup deals with empty cgroup A,,C but looks like we don't need this behaviour now? thanks, jirka