From: "Jan Beulich" Subject: Re: [V5] x86/cpuidle: get accurate C0 value with xenpm tool Date: Wed, 20 May 2015 11:07:48 +0100 Message-ID: <555C7914020000780007C0EF@mail.emea.novell.com> References: <1431580999-7886-1-git-send-email-huaitong.han@intel.com> <555B1802020000780007B7FC@mail.emea.novell.com> <1432089747.3436.9.camel@huaitong-MOBL.ccr.corp.intel.com> <1432110996.3436.12.camel@huaitong-MOBL.ccr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1432110996.3436.12.camel@huaitong-MOBL.ccr.corp.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Huaitong Han Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >>> On 20.05.15 at 10:36, wrote: > On Wed, 2015-05-20 at 02:42 +0000, Han, Huaitong wrote: >> On Tue, 2015-05-19 at 10:01 +0100, Jan Beulich wrote: >> > >>> On 14.05.15 at 07:23, wrote: >> > > @@ -1172,7 +1196,10 @@ int pmstat_get_cx_stat(uint32_t cpuid, struct pm_cx_stat *stat) >> > > { >> > > struct acpi_processor_power *power = processor_powers[cpuid]; >> > > uint64_t idle_usage = 0, idle_res = 0; >> > > - uint64_t usage[ACPI_PROCESSOR_MAX_POWER], res[ACPI_PROCESSOR_MAX_POWER]; >> > > + uint64_t last_state_update_tick, current_stime, current_tick; >> > > + uint64_t usage[ACPI_PROCESSOR_MAX_POWER] = { 0 }; >> > > + uint64_t res_ticks[ACPI_PROCESSOR_MAX_POWER] = { 0 }; >> > > + uint64_t res[ACPI_PROCESSOR_MAX_POWER] = { 0 }; >> > >> > Not yet another array on the stack please - I can't see why you >> > can't get away with just res[]. >> res_ticks just is a temp array. I can use a temp variable for >> ticks_to_ns transform, like "tmp=res[i];res[i]=ticks_to_ns(tmp);", and >> the array named res[] is better in terms of origin source code. > use "res[i]=ticks_to_ns((uint64_t)res[i])" without tmp varialbe. Exactly. Jan