Received: by 10.223.176.5 with SMTP id f5csp1169881wra; Wed, 31 Jan 2018 02:19:50 -0800 (PST) X-Google-Smtp-Source: AH8x226+hP1wQK5TCq8PXP5PKRztcnZdDWzbvi5A7by/bAbeeWp2DymIQWfISSTGYtrGCCpL20oP X-Received: by 10.98.133.193 with SMTP id m62mr33643183pfk.18.1517393990297; Wed, 31 Jan 2018 02:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517393990; cv=none; d=google.com; s=arc-20160816; b=P1Hlwyx61hWweCXCAJmYFXhJvz62CwclWAGrEeIcW8sUQHuomk3OO174z9gRWlbzdn K70BswcQ6OiURxKfXhz6hXya1inZDz5QCgim3DhP3m7H5GwKAGB/KBkZj6VGAEhd9bpj 07QJ5blXuidZ17LZ2V04EmQUxd7dvSdOKGQrg9GmCqpj+eRZPS/LbKRxFgUaE4jfpJW7 xN+4rFoXGaV8cvmslGxEOL+re81qwvsbf2nfz0yyalOvgnykfwbZH3jlsezzkTp6U/O+ 365ydTgBtHyq9wjXvPOjAGHmeU4NiVLFhDX5355V/Dx97MJJLbvGPSv0XycdOA4uG62k nqRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=xivfFQS9Y06KmJ5jIFVrKKZV4neXgskt7SjKo26O+zw=; b=DKej+q1WBpoDbo8jIWmcigfHli7ToxDvjNeI5zdb0+inmPdLXMsW0jB+v0Q/dWuKFw 8j5mRO7HkwKdJ3iB6k1QHbVQrROR9Zd/WmCRn4Q6UFvADcivEhx4Mcz+8CGMmJ62zjFG JiHUkT8V/JV7wbFmiEmuNWZzHlHLBkrXhgALdawfbVkKkNb5RX0wnxbciS6eY8U/4mBX 4T50xg5DyUmvXfb4eK5KLHp7zTC9A9hOR8/3AhSNSFHwt+i9X92Q6VSb959n5OP3lVL3 HYOiAFctzlV5YUu1/3HI+Tkkx8bE2HYqHTdfkCUeT1m8O7gDtB1ig5RjSsGZPv0G9i8R 9iWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si1302194pge.348.2018.01.31.02.19.36; Wed, 31 Jan 2018 02:19:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753266AbeAaJOh (ORCPT + 99 others); Wed, 31 Jan 2018 04:14:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44178 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715AbeAaJOe (ORCPT ); Wed, 31 Jan 2018 04:14:34 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BC4EC0568F9; Wed, 31 Jan 2018 09:14:34 +0000 (UTC) Received: from localhost (ovpn-200-42.brq.redhat.com [10.40.200.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5811C4FA21; Wed, 31 Jan 2018 09:14:28 +0000 (UTC) Date: Wed, 31 Jan 2018 10:14:27 +0100 From: Jesper Dangaard Brouer To: Leo Yan Cc: brouer@redhat.com, Alexei Starovoitov , Daniel Borkmann , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, eas-dev@lists.linaro.org, Daniel Lezcano , Vincent Guittot Subject: Re: [PATCH] samples/bpf: Add program for CPU state statistics Message-ID: <20180131101427.4c55fc21@redhat.com> In-Reply-To: <1517336999-5731-1-git-send-email-leo.yan@linaro.org> References: <1517336999-5731-1-git-send-email-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 31 Jan 2018 09:14:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Jan 2018 02:29:59 +0800 Leo Yan wrote: > CPU 0 > State : Duration(ms) Distribution > cstate 0 : 47555 |********************************* | > cstate 1 : 0 | | > cstate 2 : 0 | | > pstate 0 : 15239 |********* | > pstate 1 : 1521 | | > pstate 2 : 3188 |* | > pstate 3 : 1836 | | > pstate 4 : 94 | | > > CPU 1 > State : Duration(ms) Distribution > cstate 0 : 87 | | > cstate 1 : 16264 |********** | > cstate 2 : 50458 |*********************************** | > pstate 0 : 832 | | > pstate 1 : 131 | | > pstate 2 : 825 | | > pstate 3 : 787 | | > pstate 4 : 4 | | > > CPU 2 > State : Duration(ms) Distribution > cstate 0 : 177 | | > cstate 1 : 9363 |***** | > cstate 2 : 55835 |*************************************** | > pstate 0 : 1468 | | > pstate 1 : 350 | | > pstate 2 : 1062 | | > pstate 3 : 1164 | | > pstate 4 : 7 | | The output gets very long as the number of CPUs grow... What about using the following output: state(ms) cstate-0 cstate-1 cstate-2 pstate-0 pstate-1 pstate-2 pstate-3 pstate-4 CPU-0 47,555 0 0 15,239 1,521 1,836 1,836 94 CPU-1 87 16,264 50,458 832 131 825 787 4 CPU-2 177 9,363 55,835 1,468 350 1,062 1,164 7 Look at the code samples/bpf/xdp_redirect_cpu_user.c for an examples of howto align the columns, and the trick to get printf to pretty print with thousands separators use %' and setlocale(LC_NUMERIC, "en_US"). P.S. net-next and bpf-next is closed at the moment. Next time you submit read[1] and [2], especially howto indicate which tree (bpf vs. bpf-next) the patch is against, as this helps the workflow of the maintainers. [1] https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/Documentation/bpf/bpf_devel_QA.txt [2] Documentation/networking/netdev-FAQ.txt -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer