From: Peter Zijlstra <peterz@infradead.org>
To: David Ahern <daahern@cisco.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
acme@ghostprotocols.net, mingo@elte.hu, fweisbec@gmail.com,
paulus@samba.org, tglx@linutronix.de
Subject: Re: [PATCH 3/6] perf record: add time-of-day option
Date: Tue, 01 Mar 2011 15:29:11 +0100 [thread overview]
Message-ID: <1298989751.5226.863.camel@laptop> (raw)
In-Reply-To: <1298865151-23656-4-git-send-email-daahern@cisco.com>
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..
next prev parent reply other threads:[~2011-03-01 14:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 3:52 [PATCH 0/6 v3] perf events: Add realtime clock event, time-of-day strings to script output David Ahern
2011-02-28 3:52 ` [PATCH 1/6] perf events: Introduce realtime clock event David Ahern
2011-02-28 3:52 ` [PATCH 2/6] perf events: plumbing for PERF_SAMPLE_READ and read_format David Ahern
2011-02-28 3:52 ` [PATCH 3/6] perf record: add time-of-day option David Ahern
2011-03-01 14:29 ` Peter Zijlstra [this message]
2011-03-01 14:35 ` David Ahern
2011-03-01 15:35 ` Peter Zijlstra
2011-03-01 15:41 ` David Ahern
2011-03-01 16:00 ` Peter Zijlstra
2011-03-01 16:09 ` David Ahern
2011-03-01 16:37 ` Peter Zijlstra
2011-03-01 16:45 ` David Ahern
2011-03-01 17:07 ` Arnaldo Carvalho de Melo
2011-03-01 17:09 ` Arnaldo Carvalho de Melo
2011-03-01 22:28 ` Peter Zijlstra
2011-03-01 22:35 ` David Ahern
2011-03-02 14:16 ` Thomas Gleixner
2011-03-02 14:28 ` David Ahern
2011-03-02 17:28 ` Thomas Gleixner
2011-03-03 14:29 ` David Ahern
2011-03-03 8:51 ` Ingo Molnar
2011-03-03 14:33 ` David Ahern
2011-02-28 3:52 ` [PATCH 4/6] perf script: dump software events too David Ahern
2011-03-01 14:09 ` Frederic Weisbecker
2011-03-01 14:18 ` David Ahern
2011-03-01 15:11 ` Frederic Weisbecker
2011-03-01 16:11 ` David Ahern
2011-03-01 16:24 ` Frederic Weisbecker
2011-03-01 16:49 ` Arnaldo Carvalho de Melo
2011-02-28 3:52 ` [PATCH 5/6] perf script: Prepend lines with time-of-day string David Ahern
2011-02-28 3:52 ` [PATCH 6/6] perf stat: treat realtime-clock as nsec counter David Ahern
2011-02-28 3:55 ` [PATCH 0/6 v3] perf events: Add realtime clock event, time-of-day strings to script output David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1298989751.5226.863.camel@laptop \
--to=peterz@infradead.org \
--cc=acme@ghostprotocols.net \
--cc=daahern@cisco.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.