[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1298989751.5226.863.camel@laptop>
Date: Tue, 01 Mar 2011 15:29:11 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: David Ahern <daahern@...co.com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
acme@...stprotocols.net, mingo@...e.hu, fweisbec@...il.com,
paulus@...ba.org, tglx@...utronix.de
Subject: Re: [PATCH 3/6] perf record: add time-of-day option
On Sun, 2011-02-27 at 20:52 -0700, David Ahern wrote:
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 51a2f34..404b1ee 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -240,6 +240,7 @@ struct perf_event_attr {
> #define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
> #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
> #define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
> +#define PERF_EVENT_IOC_RECORD_SAMPLE _IO('$', 7)
>
> enum perf_event_ioc_flags {
> PERF_IOC_FLAG_GROUP = 1U << 0,
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index a25a63d..7999f55 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -3250,6 +3250,7 @@ static struct perf_event *perf_fget_light(int fd, int *fput_needed)
> static int perf_event_set_output(struct perf_event *event,
> struct perf_event *output_event);
> static int perf_event_set_filter(struct perf_event *event, void __user *arg);
> +static int perf_event_generate_sample(struct perf_event *event);
>
> static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> {
> @@ -3296,6 +3297,9 @@ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> case PERF_EVENT_IOC_SET_FILTER:
> return perf_event_set_filter(event, (void __user *)arg);
>
> + case PERF_EVENT_IOC_RECORD_SAMPLE:
> + return perf_event_generate_sample(event);
> +
> default:
> return -ENOTTY;
> }
> @@ -4398,6 +4402,21 @@ exit:
> rcu_read_unlock();
> }
>
> +/* add a sample to the event stream based on user request */
> +static int perf_event_generate_sample(struct perf_event *event)
> +{
> + struct perf_sample_data data;
> + struct pt_regs regs;
> +
> + perf_fetch_caller_regs(®s);
> + event->pmu->read(event);
> + perf_sample_data_init(&data, 0);
> + data.period = event->hw.last_period;
> + perf_event_output(event, 0, &data, ®s);
> +
> + return 0;
> +}
I'm not quite sure why you need this..
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists