Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1471907ybz; Sat, 18 Apr 2020 01:32:49 -0700 (PDT) X-Google-Smtp-Source: APiQypIwuRa3AQqaKAEup3Hgio4cneimbB0wMckFCRXMIqlqAGjanHHv380uPRCh7anzz5JUO2W6 X-Received: by 2002:a17:906:bce4:: with SMTP id op4mr2438017ejb.174.1587198769557; Sat, 18 Apr 2020 01:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587198769; cv=none; d=google.com; s=arc-20160816; b=facxIBzbZclfjRx8lQ631N3EPwTJNK6ndZJ5QoeoL0sQPtfl9RhsYEZ3ddWC4QBuTI vpGZYVcjwFqHT/gQvDwYtTzHKVH6QRE1Q+VCYiSmlUGIPzCtuNBXJ1Vr/1x53HK+OC2L rMXfW6GDJU7LD6u0XETY/3p4g5ixD3UGIkzQIUcfNJajUjX3e7R66Z9mvTVgCucneOJi RbpEYLdOL1ZmvZXDc12ExwN8DuSIPG8JaRvlStolI6g6VC95Y8iTMlur4s2P8FXpPiEq tKRZ7CoXkHZE1Oez+mqa6m5Q/ykYpaypAl/D6prWj8xUixV/n7H+y1pKSCMyDkA3ERaN ooCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=CcGPLMRLDeRS1SqjSMOrz2+O73l95OrShduSSgoMljs=; b=mCFvFrwOWB1+kbRYI/vCbOHzBy9B0Ctt7bVAR8SWltIkd4ViWvRDBU0ZAQlmzFLKkh Q9RQiz6Im97NM7lVbLI9WzEMAw+t16JPwbdaU77Wb6QRX9qXaDcTFTFsqaiqYPggYamj i6MGlNP2MhAoJ+FrY2BkwkNxnkX8If7LDHe3mLoqmKDy5QuVoX7N7dJN+WvLRbFg995Y 9Y+WyA3TvjtJw4D30aVJ4kQAQGsbKqXkkV6vaLBsPtvRWMWAT+wKUJGN6RLaj/8hN71X KT4IPyxOhKdHbnmMz9KEoXlD/CtLEnhQIMJZI823+I7mLSlENNNTfYJ+C4lpbHXAhmr8 S3EA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si17821885edq.249.2020.04.18.01.32.26; Sat, 18 Apr 2020 01:32:49 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725953AbgDRIbU (ORCPT + 99 others); Sat, 18 Apr 2020 04:31:20 -0400 Received: from mga07.intel.com ([134.134.136.100]:56259 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725801AbgDRIbT (ORCPT ); Sat, 18 Apr 2020 04:31:19 -0400 IronPort-SDR: yJC/VfEzD9ICJRtEzX+ctSrlS+Juj9Rrcw7GIq3PlbSvASv7qa4x1GCoVmWcTndPM7BPM/I8SD EsQYz3vgp1CQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2020 01:31:19 -0700 IronPort-SDR: oovcHpNKuJbbLzYVMoeMEr8BKh404zVPWDf+26Ov+YR8ILWkkzYWHA21O3TTD0JQHBxicxVZdJ go2r7T/jq3yQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,398,1580803200"; d="scan'208";a="254442242" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga003.jf.intel.com with ESMTP; 18 Apr 2020 01:31:17 -0700 From: Chen Yu To: linux-pm@vger.kernel.org Cc: Len Brown , "Rafael J. Wysocki" , Doug Smythies , linux-kernel@vger.kernel.org, Chen Yu Subject: [PATCH 1/3][v3] tools/power turbostat: Make the energy variable to be 64 bit Date: Sat, 18 Apr 2020 16:31:47 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Change the energy variable from 32bit to 64bit, so that it can record long time duration. After this conversion, adjust the DELTA_WRAP32() accordingly. Signed-off-by: Chen Yu --- tools/power/x86/turbostat/turbostat.c | 30 ++++++++++++--------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 33b370865d16..95f3047e94ae 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -211,12 +211,12 @@ struct pkg_data { long long gfx_rc6_ms; unsigned int gfx_mhz; unsigned int package_id; - unsigned int energy_pkg; /* MSR_PKG_ENERGY_STATUS */ - unsigned int energy_dram; /* MSR_DRAM_ENERGY_STATUS */ - unsigned int energy_cores; /* MSR_PP0_ENERGY_STATUS */ - unsigned int energy_gfx; /* MSR_PP1_ENERGY_STATUS */ - unsigned int rapl_pkg_perf_status; /* MSR_PKG_PERF_STATUS */ - unsigned int rapl_dram_perf_status; /* MSR_DRAM_PERF_STATUS */ + unsigned long long energy_pkg; /* MSR_PKG_ENERGY_STATUS */ + unsigned long long energy_dram; /* MSR_DRAM_ENERGY_STATUS */ + unsigned long long energy_cores; /* MSR_PP0_ENERGY_STATUS */ + unsigned long long energy_gfx; /* MSR_PP1_ENERGY_STATUS */ + unsigned long long rapl_pkg_perf_status; /* MSR_PKG_PERF_STATUS */ + unsigned long long rapl_dram_perf_status; /* MSR_DRAM_PERF_STATUS */ unsigned int pkg_temp_c; unsigned long long counter[MAX_ADDED_COUNTERS]; } *package_even, *package_odd; @@ -858,13 +858,13 @@ int dump_counters(struct thread_data *t, struct core_data *c, outp += sprintf(outp, "pc10: %016llX\n", p->pc10); outp += sprintf(outp, "cpu_lpi: %016llX\n", p->cpu_lpi); outp += sprintf(outp, "sys_lpi: %016llX\n", p->sys_lpi); - outp += sprintf(outp, "Joules PKG: %0X\n", p->energy_pkg); - outp += sprintf(outp, "Joules COR: %0X\n", p->energy_cores); - outp += sprintf(outp, "Joules GFX: %0X\n", p->energy_gfx); - outp += sprintf(outp, "Joules RAM: %0X\n", p->energy_dram); - outp += sprintf(outp, "Throttle PKG: %0X\n", + outp += sprintf(outp, "Joules PKG: %0llX\n", p->energy_pkg); + outp += sprintf(outp, "Joules COR: %0llX\n", p->energy_cores); + outp += sprintf(outp, "Joules GFX: %0llX\n", p->energy_gfx); + outp += sprintf(outp, "Joules RAM: %0llX\n", p->energy_dram); + outp += sprintf(outp, "Throttle PKG: %0llX\n", p->rapl_pkg_perf_status); - outp += sprintf(outp, "Throttle RAM: %0X\n", + outp += sprintf(outp, "Throttle RAM: %0llX\n", p->rapl_dram_perf_status); outp += sprintf(outp, "PTM: %dC\n", p->pkg_temp_c); @@ -1210,11 +1210,7 @@ void format_all_counters(struct thread_data *t, struct core_data *c, struct pkg_ } #define DELTA_WRAP32(new, old) \ - if (new > old) { \ - old = new - old; \ - } else { \ - old = 0x100000000 + new - old; \ - } + old = ((((unsigned long long)new << 32) - ((unsigned long long)old << 32)) >> 32); int delta_package(struct pkg_data *new, struct pkg_data *old) -- 2.17.1