From patchwork Mon Jul 16 13:39:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 10526817 X-Patchwork-Delegate: lenb@kernel.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B0F3E600D0 for ; Mon, 16 Jul 2018 13:39:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A19A028ABB for ; Mon, 16 Jul 2018 13:39:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95E5728AC1; Mon, 16 Jul 2018 13:39:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E24628ABB for ; Mon, 16 Jul 2018 13:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbeGPOHU (ORCPT ); Mon, 16 Jul 2018 10:07:20 -0400 Received: from mga09.intel.com ([134.134.136.24]:18150 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeGPOHU (ORCPT ); Mon, 16 Jul 2018 10:07:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 06:39:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,361,1526367600"; d="scan'208";a="72729844" Received: from powerlab.fi.intel.com (HELO powerlab.backendnet) ([10.237.71.25]) by fmsmga001.fm.intel.com with ESMTP; 16 Jul 2018 06:39:26 -0700 From: Artem Bityutskiy To: "Rafael J. Wysocki" , Len Brown , Linux PM Mailing List Subject: [PATCH v2] turbostat: fix -S on UP systems Date: Mon, 16 Jul 2018 16:39:25 +0300 Message-Id: <20180716133925.186248-1-dedekind1@gmail.com> X-Mailer: git-send-email 2.14.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Artem Bityutskiy Turbostat -S option makes the tool print only the summary line and no per-CPU lines, and this is a useful feature. It does not, however, work as expected on a single core system and this patch fixes the problem. The patch is a trivial one-liner and I'll skip explaining how it works. Here is what a non-patched turbostat prints on a UP system (a 2S IvyBridge Xeon with all but one CPUs offline): $ turbostat -S -n2 ...snip... cpu0: MSR_PKGC7_IRTL: 0x00000000 (NOTvalid, 0 ns) CPU Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ SMI POLL C1 ...snip... CPU Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ SMI POLL C1 ...snip... With this patch: $turbostat -S -n2 ...snip... cpu0: MSR_PKGC7_IRTL: 0x00000000 (NOTvalid, 0 ns) Avg_MHz Busy% Bzy_MHz TSC_MHz IRQ SMI POLL C1 C1E ...snip... 2 0.07 3000 2700 153 0 0 19 2 ...snip... 3 0.10 3000 2700 239 0 0 16 0 ...snip... Signed-off-by: Artem Bityutskiy --- turbostat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Changelog: v2: removed Change-ID. diff --git a/turbostat.c b/turbostat.c index 4d14bbb..9013051 100644 --- a/turbostat.c +++ b/turbostat.c @@ -1169,7 +1169,7 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_ printed = 1; - if (summary_only) + if (summary_only && topo.num_cpus > 1) return; for_all_cpus(format_counters, t, c, p);