From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755257AbbBTRGs (ORCPT ); Fri, 20 Feb 2015 12:06:48 -0500 Received: from mail-ig0-f174.google.com ([209.85.213.174]:62158 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbbBTRGr (ORCPT ); Fri, 20 Feb 2015 12:06:47 -0500 Message-ID: <54E769A4.2090502@gmail.com> Date: Fri, 20 Feb 2015 10:06:44 -0700 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Adrian Hunter , Peter Zijlstra , Ingo Molnar CC: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Frederic Weisbecker , Jiri Olsa , Namhyung Kim , Paul Mackerras , Stephane Eranian , John Stultz , Thomas Gleixner , Pawel Moll , Steven Rostedt , Andi Kleen , Mathieu Poirier Subject: Re: [PATCH V2 1/2] perf: Sample additional clock value References: <1424436249-3572-1-git-send-email-adrian.hunter@intel.com> <1424436249-3572-2-git-send-email-adrian.hunter@intel.com> In-Reply-To: <1424436249-3572-2-git-send-email-adrian.hunter@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/20/15 5:44 AM, Adrian Hunter wrote: > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index efe2d2d..9385140 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -655,7 +655,7 @@ extern void perf_pmu_migrate_context(struct pmu *pmu, > int src_cpu, int dst_cpu); > extern u64 perf_event_read_value(struct perf_event *event, > u64 *enabled, u64 *running); > - > +u64 perf_sample_clock_pt(void); Core functions should not be arch specific. PT == x86. > @@ -4915,6 +4918,11 @@ perf_output_sample_ustack(struct perf_output_handle *handle, u64 dump_size, > } > } > > +u64 __weak perf_sample_clock_pt(void) > +{ > + return 0; > +} > + > static void __perf_event_header__init_id(struct perf_event_header *header, > struct perf_sample_data *data, > struct perf_event *event) > @@ -4943,6 +4951,16 @@ static void __perf_event_header__init_id(struct perf_event_header *header, > data->cpu_entry.cpu = raw_smp_processor_id(); > data->cpu_entry.reserved = 0; > } > + > + if (sample_type & PERF_SAMPLE_CLOCK) { > + switch (event->attr.clock) { > + case PERF_SAMPLE_CLOCK_PT: > + data->clock = perf_sample_clock_pt(); > + break; > + default: > + data->clock = 0; > + } > + } > } > Ditto here. This should be transparent for arch specific clocks. David