Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-21 Thread Adrian Hunter
On 20/08/15 22:31, Thomas Gleixner wrote: > On Wed, 29 Jul 2015, Adrian Hunter wrote: >> @@ -239,6 +239,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int >> cpu) >> unsigned long long tsc_now, ns_now; >> struct cyc2ns_data *data; >> unsigned long flags; >> +u64 mult;

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-21 Thread Adrian Hunter
On 20/08/15 22:31, Thomas Gleixner wrote: On Wed, 29 Jul 2015, Adrian Hunter wrote: @@ -239,6 +239,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) unsigned long long tsc_now, ns_now; struct cyc2ns_data *data; unsigned long flags; +u64 mult; +u32

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-20 Thread Thomas Gleixner
On Wed, 29 Jul 2015, Adrian Hunter wrote: > @@ -239,6 +239,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int > cpu) > unsigned long long tsc_now, ns_now; > struct cyc2ns_data *data; > unsigned long flags; > + u64 mult; > + u32 shft = 32; > >

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-20 Thread Thomas Gleixner
On Wed, 29 Jul 2015, Adrian Hunter wrote: @@ -239,6 +239,8 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) unsigned long long tsc_now, ns_now; struct cyc2ns_data *data; unsigned long flags; + u64 mult; + u32 shft = 32;

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-17 Thread Peter Zijlstra
On Mon, Aug 17, 2015 at 10:34:03AM +0300, Adrian Hunter wrote: > On 29/07/15 00:14, Adrian Hunter wrote: > > When TSC is stable perf/sched clock is based on it. > > However the conversion from cycles to nanoseconds > > is not as accurate as it could be. Because > > CYC2NS_SCALE_FACTOR is 10, the

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-17 Thread Adrian Hunter
On 29/07/15 00:14, Adrian Hunter wrote: > When TSC is stable perf/sched clock is based on it. > However the conversion from cycles to nanoseconds > is not as accurate as it could be. Because > CYC2NS_SCALE_FACTOR is 10, the accuracy is +/- 1/2048 > > The change is to calculate the maximum shift

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-17 Thread Peter Zijlstra
On Mon, Aug 17, 2015 at 10:34:03AM +0300, Adrian Hunter wrote: On 29/07/15 00:14, Adrian Hunter wrote: When TSC is stable perf/sched clock is based on it. However the conversion from cycles to nanoseconds is not as accurate as it could be. Because CYC2NS_SCALE_FACTOR is 10, the accuracy

Re: [PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-08-17 Thread Adrian Hunter
On 29/07/15 00:14, Adrian Hunter wrote: When TSC is stable perf/sched clock is based on it. However the conversion from cycles to nanoseconds is not as accurate as it could be. Because CYC2NS_SCALE_FACTOR is 10, the accuracy is +/- 1/2048 The change is to calculate the maximum shift that

[PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-07-28 Thread Adrian Hunter
When TSC is stable perf/sched clock is based on it. However the conversion from cycles to nanoseconds is not as accurate as it could be. Because CYC2NS_SCALE_FACTOR is 10, the accuracy is +/- 1/2048 The change is to calculate the maximum shift that results in a multiplier that is still a 32-bit

[PATCH V2] perf: x86: Improve accuracy of perf/sched clock

2015-07-28 Thread Adrian Hunter
When TSC is stable perf/sched clock is based on it. However the conversion from cycles to nanoseconds is not as accurate as it could be. Because CYC2NS_SCALE_FACTOR is 10, the accuracy is +/- 1/2048 The change is to calculate the maximum shift that results in a multiplier that is still a 32-bit