Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1416759pxk; Thu, 10 Sep 2020 15:02:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBKX3gSXBsmVN604VJHHCJqsajeefRNOSBtL25fr513x1pZOgRLdzivUVJFANk4hf4i54c X-Received: by 2002:a05:6402:b68:: with SMTP id cb8mr11823009edb.350.1599775348161; Thu, 10 Sep 2020 15:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599775348; cv=none; d=google.com; s=arc-20160816; b=GTvh0t7cCnbJQa9gLZjB/oblbnjcbGgq/qP27TxyowYWeo971ItJHLGbm+d/wLmzRD YyH3zUIHQHer+ma28I96Zr9YJDJZJVVBWvcVB/73UbJ0II4VTJIX0p8RTWUaV9Q5aR0d KF6lyni+/5qYv8Gn5xUjxk6Zwhqs1KJfM+iBhCqzu7pobrRCEwY6hjdWDVQhr7YaHl31 UgWTdlbO40I4tKsHN1UhTe/3fiDfVL8BI2rvGoXBJXHb2FejwahCHsoLtgSdDuGiK3Ef b/8JH/XKYI+UgKuB58ZcVxVvxYVSzba50ex4NQ9qzTx+U2jVGOl7JV9yhLlmX4cG4jol C8aQ== 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=9YxBdYgk6HvU+X0J7rjyGXLhYXUO1lRcU0Wuxg+GyDE=; b=bTBDb/ND0uNyl+/lQxe/NqUOMoBpfV2aqlzh3bTMfxbwq4DEEARbONR1+jqbV4nFva 7b84JjwlfjI1dRUZyoLeMldPhhjhqwYKAbxy+5hsUpECgAxBsOaj0hp096fK3BP9VvCB n3EBZvad8g+o2IFwZ1/8DJCa1rxlT27gK0yFX2WJCSV7AYrVvveXVQAXDBPuin1knPSU e5Y8dlRokuBzsBg0k2WU9LM/pm8Ydhshxqu8UF1SwOZjUGMdU52SQ0L/5NYDPOKH4+XK +H2CRl8LQN3aKPcmQAQ8UciJarMVPbz9G3ziUe/IQODbz920dslT3baoiosDfVbJmB5K IrJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Jbc6qqCi; 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 a16si4318141ejk.665.2020.09.10.15.02.05; Thu, 10 Sep 2020 15:02:28 -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=@kernel.org header.s=default header.b=Jbc6qqCi; 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 S1725875AbgIJV7d (ORCPT + 99 others); Thu, 10 Sep 2020 17:59:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730518AbgIJLKf (ORCPT ); Thu, 10 Sep 2020 07:10:35 -0400 Received: from quaco.ghostprotocols.net (unknown [179.97.37.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB4B621556; Thu, 10 Sep 2020 11:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599736223; bh=n7fko+K24EPbXR431Tv5ZgLjx98hbWABFxYSBLUpKws=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Jbc6qqCieYpi405/MUUIN69qEpUHLQ9tvNwfAcZHqz1p0Qa7gTdQeldC50pB+Sruy zGXbzZDsMsIvYrX9Cka1lOYuNk1YecakhwfgEVpZJQSN5D+7qaSl22txo6jxtWedR7 SnfcYWMTV1s2CoKH6zv6DEyb7hHPkwvZb0Z+Ie58= Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id D1C8540D3D; Thu, 10 Sep 2020 08:10:20 -0300 (-03) Date: Thu, 10 Sep 2020 08:10:20 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Namhyung Kim , 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: <20200910111020.GA4018363@kernel.org> References: <20200908044228.61197-1-namhyung@kernel.org> <20200910091542.GD1627030@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910091542.GD1627030@krava> 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 Thu, Sep 10, 2020 at 11:15:42AM +0200, Jiri Olsa escreveu: > On Tue, Sep 08, 2020 at 01:42:24PM +0900, Namhyung Kim wrote: > > 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 ;-) yeah, its great that someone is looking at cgroups improvements, thanks Namyung, its great to have you working on this! More below. > > 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? Yeah, I also didn't like the --multiply-cgroup thing, perhaps we can use a per-event term? or per group, for example: perf stat -a -M $METRIC/cgroups=A,B,C/ perf stat -a -e '{cycles,instructions,cache-misses}/cgroups=A,B,C/' Allowing wildcards or regexps would help with some use cases. We already have several terms that allows us to control per event knobs, this would be one more. - Arnaldo