Received: by 10.223.176.5 with SMTP id f5csp1274379wra; Wed, 31 Jan 2018 04:05:00 -0800 (PST) X-Google-Smtp-Source: AH8x226S7xwZEjwQu0kFlyYfM7sGgl6eRca6pd515cd6HpQgWrwaD+V+WTRtoE9d3hPXJSE7JjHg X-Received: by 2002:a17:902:6ec5:: with SMTP id l5-v6mr28882093pln.443.1517400300307; Wed, 31 Jan 2018 04:05:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517400300; cv=none; d=google.com; s=arc-20160816; b=cWubYWzncGt7ftS1yvdz0a6Jgn0Fb/Rd3NT6UCJXcRgni3BSBAToiR3o5GdXLpVA/8 A3SITF8EaOaiVA0hCBiQbnTbSsmgXl+uGVWu/zf03KiZjNnHbEBp7PmDPEXSC/G/w9/y 0LMPrRAsgoUOv7XY/yNnkE/6xpa1kgOIdMdJVDAZ/vSvshN6hX1v8FB7XlxxVJuzuP9I rsjCgAchfmv0J3EoC2e7dmuN16yZCwjubyBI/roFcD6Kg6GxCSrwAxgFIgqbxa3sZNJI kGYkfqKOgU8imGWdZDQFsMhbCh7rGGNn9NATGPhKrlUdpPcYKS1RTn9FOGTEzraSj2kZ aNPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=yUfsuFbFUn/N1SUl4fPot3XbdAsPfEOuBHLP49Wlyls=; b=ck4Xr9sks53hM9awqywBmzoFVK94Qif0hJc/JgGXnX7G5cv5V7At414e6s0kLxWw+k 4ffpsJRg+jL8CNq+1sPuUevdvSZzTo+YKZMk1Z9ETR0PDEeWnjKpwK1tjq0NL90pRE9b d7tIKbjmxHddnyywGcsS3NfHpBidKeBtcpZ9EwKCh4olACV753/QMngUI22I2HbVcIC/ Qqu+vtHJYVpZ2o+6swPfOOF/vbvIUzHQmZzGgFqwxtFik5VgTI6Cv2PJHAIJtRpflOKY w6xKQHzs+KisY55bNcOdCxE4uJl2OUiwgPVgxbrXJ77ZRKA7jOcDDppmKqAyaNviyCuW TfUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PjHrdKw5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p85si1389010pfa.20.2018.01.31.04.04.45; Wed, 31 Jan 2018 04:05:00 -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; dkim=pass header.i=@linaro.org header.s=google header.b=PjHrdKw5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753292AbeAaLiU (ORCPT + 99 others); Wed, 31 Jan 2018 06:38:20 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:33739 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752798AbeAaLiT (ORCPT ); Wed, 31 Jan 2018 06:38:19 -0500 Received: by mail-qt0-f195.google.com with SMTP id d8so21391929qtm.0 for ; Wed, 31 Jan 2018 03:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yUfsuFbFUn/N1SUl4fPot3XbdAsPfEOuBHLP49Wlyls=; b=PjHrdKw5tD+CEf7lqk+RuC+d/xL4h28APrdajVJsLiwo5KuyIuIiyagKKp0Z3ZWoiO vcJTpOLTb2siwtLvDEKdJ+mhmgVg9XQ6cquMoEsRiGoEizxFDrttEe9fc93bRwqFwIda 1ncqeAAu9EqPimqDbNz8o1DDsvvHUL1Y0YDD8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yUfsuFbFUn/N1SUl4fPot3XbdAsPfEOuBHLP49Wlyls=; b=rN3ABRv7XMuj1SjZS2LaHY+zOk0hTk+3iXSblsDw8vFitXo6bsqJ8ITJhD3SDRAE5W rkHDvrQdkNXnzLJ1Etq3qdADA+usf8BWT97j461Dxt3IRyLhGMPjEJhcJJ90sVO0Vh8z 1aJOBdKvwpA4mQmXVTwy0EIkMcTiCkCE7CLzppweC8RVrUIuW2hD4Bp8QSF/JPD82ZHc UrbHHIiCga3MnfFfTyXff1Aua+rfx5RilXiD60mzOwWao0is167ky/9HfZHtyIwmuHjp dBtLh7RmoK2pi5WPFhKuUutglNjY4Vw4gV25vD+tvUD/C2FlL7MvOeTdjF9eRKojMTbe eZPA== X-Gm-Message-State: AKwxytdiE1Zt43KLJxSNQKeCWg6yoLNram7cwWIrnHUBJsiws8h+E2Wv klCAY58ffkX58ZdhEGnKYkvdQg== X-Received: by 10.237.53.144 with SMTP id c16mr36408121qte.215.1517398698495; Wed, 31 Jan 2018 03:38:18 -0800 (PST) Received: from leoy-linaro ([45.77.212.61]) by smtp.gmail.com with ESMTPSA id n21sm12946676qtl.38.2018.01.31.03.38.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jan 2018 03:38:17 -0800 (PST) Date: Wed, 31 Jan 2018 19:38:07 +0800 From: Leo Yan To: Jesper Dangaard Brouer Cc: 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: <20180131113807.GB12768@leoy-linaro> References: <1517336999-5731-1-git-send-email-leo.yan@linaro.org> <20180131101427.4c55fc21@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180131101427.4c55fc21@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jesper, On Wed, Jan 31, 2018 at 10:14:27AM +0100, Jesper Dangaard Brouer wrote: > 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"). Thanks a lot for suggestion. Using row/columns looks good for me, will change code for this way. > 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. Yeah, will read the docs and follow up the workflow and send new patch to target next merge window. Thanks, Leo Yan > [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