Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1209345 > unrolled thread
| Started by | kan.liang@intel.com |
|---|---|
| First post | 2015-08-18 18:50 +0200 |
| Last post | 2015-08-20 12:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH RFC 06/10] perf,tools: New RECORD type PERF_RECORD_STAT_READ kan.liang@intel.com - 2015-08-18 18:50 +0200
Re: [PATCH RFC 06/10] perf,tools: New RECORD type PERF_RECORD_STAT_READ Jiri Olsa <jolsa@redhat.com> - 2015-08-20 12:00 +0200
| From | kan.liang@intel.com |
|---|---|
| Date | 2015-08-18 18:50 +0200 |
| Subject | [PATCH RFC 06/10] perf,tools: New RECORD type PERF_RECORD_STAT_READ |
| Message-ID | <pYSfg-3x6-5@gated-at.bofh.it> |
From: Kan Liang <kan.liang@intel.com>
Introduce a new user RECORD type PERF_RECORD_STAT_READ to store the
stat event read result.
Signed-off-by: Kan Liang <kan.liang@intel.com>
---
tools/perf/util/event.c | 1 +
tools/perf/util/event.h | 10 ++++++++++
tools/perf/util/session.c | 15 +++++++++++++++
tools/perf/util/tool.h | 1 +
4 files changed, 27 insertions(+)
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 7ff6127..601f4be 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -37,6 +37,7 @@ static const char *perf_event__names[] = {
[PERF_RECORD_AUXTRACE_INFO] = "AUXTRACE_INFO",
[PERF_RECORD_AUXTRACE] = "AUXTRACE",
[PERF_RECORD_AUXTRACE_ERROR] = "AUXTRACE_ERROR",
+ [PERF_RECORD_STAT_READ] = "STAT_READ",
};
const char *perf_event__name(unsigned int id)
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index f729df5..f6932cf 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -226,6 +226,7 @@ enum perf_user_event_type { /* above any possible kernel type */
PERF_RECORD_AUXTRACE_INFO = 70,
PERF_RECORD_AUXTRACE = 71,
PERF_RECORD_AUXTRACE_ERROR = 72,
+ PERF_RECORD_STAT_READ = 73,
PERF_RECORD_HEADER_MAX
};
@@ -355,6 +356,14 @@ struct context_switch_event {
u32 next_prev_tid;
};
+struct stat_read_event {
+ struct perf_event_header header;
+ u64 value; /* counter value delta */
+ u32 cpu;
+ u32 pos_id; /* event position in evlist */
+ u64 time; /* time stamp */
+};
+
union perf_event {
struct perf_event_header header;
struct mmap_event mmap;
@@ -377,6 +386,7 @@ union perf_event {
struct aux_event aux;
struct itrace_start_event itrace_start;
struct context_switch_event context_switch;
+ struct stat_read_event stat_read;
};
void perf_event__print_totals(void);
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 18722e7..1547970 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -337,6 +337,8 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
tool->context_switch = perf_event__process_switch;
if (tool->read == NULL)
tool->read = process_event_sample_stub;
+ if (tool->stat_read == NULL)
+ tool->stat_read = process_build_id_stub;
if (tool->throttle == NULL)
tool->throttle = process_event_stub;
if (tool->unthrottle == NULL)
@@ -440,6 +442,16 @@ static void perf_event__task_swap(union perf_event *event, bool sample_id_all)
swap_sample_id_all(event, &event->fork + 1);
}
+static void perf_event__stat_read_swap(union perf_event *event,
+ bool sample_id_all __maybe_unused)
+{
+
+ event->stat_read.value = bswap_64(event->stat_read.value);
+ event->stat_read.cpu = bswap_32(event->stat_read.cpu);
+ event->stat_read.pos_id = bswap_32(event->stat_read.pos_id);
+ event->stat_read.time = bswap_64(event->stat_read.time);
+}
+
static void perf_event__read_swap(union perf_event *event, bool sample_id_all)
{
event->read.pid = bswap_32(event->read.pid);
@@ -642,6 +654,7 @@ static perf_event__swap_op perf_event__swap_ops[] = {
[PERF_RECORD_EXIT] = perf_event__task_swap,
[PERF_RECORD_LOST] = perf_event__all64_swap,
[PERF_RECORD_READ] = perf_event__read_swap,
+ [PERF_RECORD_STAT_READ] = perf_event__stat_read_swap,
[PERF_RECORD_THROTTLE] = perf_event__throttle_swap,
[PERF_RECORD_UNTHROTTLE] = perf_event__throttle_swap,
[PERF_RECORD_SAMPLE] = perf_event__all64_swap,
@@ -1191,6 +1204,8 @@ static s64 perf_session__process_user_event(struct perf_session *session,
case PERF_RECORD_AUXTRACE_ERROR:
perf_session__auxtrace_error_inc(session, event);
return tool->auxtrace_error(tool, event, session);
+ case PERF_RECORD_STAT_READ:
+ return tool->stat_read(tool, event, session);
default:
return -EINVAL;
}
diff --git a/tools/perf/util/tool.h b/tools/perf/util/tool.h
index cab8cc2..3a002a2 100644
--- a/tools/perf/util/tool.h
+++ b/tools/perf/util/tool.h
@@ -57,6 +57,7 @@ struct perf_tool {
auxtrace_info,
auxtrace_error;
event_op3 auxtrace;
+ event_op2 stat_read;
bool ordered_events;
bool ordering_requires_timestamps;
};
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jiri Olsa <jolsa@redhat.com> |
|---|---|
| Date | 2015-08-20 12:00 +0200 |
| Subject | Re: [PATCH RFC 06/10] perf,tools: New RECORD type PERF_RECORD_STAT_READ |
| Message-ID | <pZuND-1gR-61@gated-at.bofh.it> |
| In reply to | #1209345 |
On Tue, Aug 18, 2015 at 05:25:42AM -0400, kan.liang@intel.com wrote:
> From: Kan Liang <kan.liang@intel.com>
>
> Introduce a new user RECORD type PERF_RECORD_STAT_READ to store the
> stat event read result.
>
> Signed-off-by: Kan Liang <kan.liang@intel.com>
> ---
> tools/perf/util/event.c | 1 +
> tools/perf/util/event.h | 10 ++++++++++
> tools/perf/util/session.c | 15 +++++++++++++++
> tools/perf/util/tool.h | 1 +
> 4 files changed, 27 insertions(+)
>
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index 7ff6127..601f4be 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -37,6 +37,7 @@ static const char *perf_event__names[] = {
> [PERF_RECORD_AUXTRACE_INFO] = "AUXTRACE_INFO",
> [PERF_RECORD_AUXTRACE] = "AUXTRACE",
> [PERF_RECORD_AUXTRACE_ERROR] = "AUXTRACE_ERROR",
> + [PERF_RECORD_STAT_READ] = "STAT_READ",
> };
>
> const char *perf_event__name(unsigned int id)
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index f729df5..f6932cf 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -226,6 +226,7 @@ enum perf_user_event_type { /* above any possible kernel type */
> PERF_RECORD_AUXTRACE_INFO = 70,
> PERF_RECORD_AUXTRACE = 71,
> PERF_RECORD_AUXTRACE_ERROR = 72,
> + PERF_RECORD_STAT_READ = 73,
> PERF_RECORD_HEADER_MAX
> };
>
> @@ -355,6 +356,14 @@ struct context_switch_event {
> u32 next_prev_tid;
> };
>
> +struct stat_read_event {
> + struct perf_event_header header;
> + u64 value; /* counter value delta */
> + u32 cpu;
> + u32 pos_id; /* event position in evlist */
> + u64 time; /* time stamp */
> +};
could we make this more generic like:
struct stat_event {
struct perf_event_header header;
u64 id;
u32 cpu;
u32 thread;
union {
struct {
u64 val;
u64 ena;
u64 run;
};
u64 values[3];
};
};
I'd agreed with the time to be added, but I think it should
contains raw values, not deltas (and all 3 them: val, ena, run)
also I haven't got the value of the pos_id, so far seems
like this could be obtained in report time and does not
need to be part of the event
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web