Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3777042ybb; Tue, 31 Mar 2020 11:46:26 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvuUcQlmzXZm0H4eEJq5HhPDTssWHQPDb6Fpi4r6QQejUEp5nYZSmwhLVvxqZFvxJnMjSB0 X-Received: by 2002:a9d:62c2:: with SMTP id z2mr14975312otk.155.1585680386768; Tue, 31 Mar 2020 11:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585680386; cv=none; d=google.com; s=arc-20160816; b=IxpOgTvM3YxwEjjlgNN2cOEKpUCSzTUZPWG7GmYX6Tuzl/3M5kvSMqoJf4Zu/B9XEC xJpVgW1sYC/mv4jNRxNW1Jzlazr0CY48mkaVFaB5wz2xTUIXshwKjp54Ibhq7OZqKFxC SC63kOw0yXThuePvfcrlfuvcxOLLbcx0Fb8QwkWtNC28yfaitgAd6F3MkflD0HhgbHnC sYn7v+FyoQE2td8nQGAclvxFSh69w+EmtMLxXOZWpV6CMxyx2LRJQApcB4A0UOvcLCw7 NarToUcvstvLuMj3cuZxu0eGX8u/4n04LVGrt+mL768HT/TXsHZkqcHfBfhrvlACMcyj 9vpw== 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=Hgkrm5fgjUfk4DluXlXmbtuuv1KQ2kY4ePGL1E9GJ0U=; b=RWzHQl3JM6KPTKvkSdxrs7x2UIpNvFlSz58n6wT/Wa3xTBoiXcjHFrdGOor75xC9Vd dkgY8gvQPnF9GeUoYM5INQruXUb/c1qGqIzY/uje9l0NnPZbt/iRWoMDMlbjXODfKZEn q1O/HL5HDgQToID84OZk6opGIwWGAfhe8UkJKAJH6oQVzIukEBgn/turQ2HUrpLEdCy1 6A0fnRoinmuyZUwR1UYgjOB3jCUAk2SldU7AHkMrijLcpVnSNJh2SBXXd4C563mFn4A9 5bswRLiwpT2CP47Jwj2PPlUjeUABNjfCS5wNhhGrO0tktUENypg+QWG4E6/f/5+sHajs 669Q== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n82si7212765oih.195.2020.03.31.11.46.12; Tue, 31 Mar 2020 11:46:26 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727841AbgCaSpr (ORCPT + 99 others); Tue, 31 Mar 2020 14:45:47 -0400 Received: from mga09.intel.com ([134.134.136.24]:10382 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726209AbgCaSpq (ORCPT ); Tue, 31 Mar 2020 14:45:46 -0400 IronPort-SDR: mTtNzs03Q8rvYq9ktYTsukjcq5ucyFf/p6v0dEWnzgj95Ospz+s4OzoS6ZE+6MQvrh1Hs1nRIR FeKYaK6NYqng== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 11:45:46 -0700 IronPort-SDR: qvn1zYRdK/XkmHErCv2cpdl+ognbMXi0rz86jQvqC/WmLvJGXFKrSMn2Sop3NAzS1GF6qZPo7R qaIUJwtqq7YA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,328,1580803200"; d="scan'208";a="422396560" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by orsmga005.jf.intel.com with ESMTP; 31 Mar 2020 11:45:44 -0700 From: Chen Yu To: Len Brown Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhang Rui , Chen Yu Subject: [PATCH 1/2][RFC] tools/power turbostat: Make the energy variable to be 64 bit Date: Wed, 1 Apr 2020 02:44:28 +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 records long time duration. 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