* [PATCH i-g-t 1/2] scripts/trace.pl: Support class:instance engine tracepoints
@ 2018-06-05 16:50 Tvrtko Ursulin
2018-06-05 16:50 ` [PATCH i-g-t 2/2] intel_gpu_overlay: Update for " Tvrtko Ursulin
2018-06-05 17:15 ` [igt-dev] [PATCH i-g-t 1/2] scripts/trace.pl: Support " Lionel Landwerlin
0 siblings, 2 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-06-05 16:50 UTC (permalink / raw)
To: igt-dev; +Cc: intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
New way of describing engines needs the tool to be adapted to understand it.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
scripts/trace.pl | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/trace.pl b/scripts/trace.pl
index 068eee68b30c..ea6c667696f4 100755
--- a/scripts/trace.pl
+++ b/scripts/trace.pl
@@ -378,6 +378,8 @@ while (<>) {
$k = 'global' if $k eq 'global_seqno';
chop $v if substr($v, -1, 1) eq ',';
$tp{$k} = $v;
+
+ $tp{'ring'} = $tp{'engine'} if $k eq 'engine';
}
next if exists $tp{'ring'} and exists $ignore_ring{$tp{'ring'}};
@@ -631,7 +633,7 @@ foreach my $gid (sort keys %rings) {
# Extract all GPU busy intervals and sort them.
foreach my $key (@sorted_keys) {
- next unless $db{$key}->{'ring'} == $ring;
+ next unless $db{$key}->{'ring'} eq $ring;
push @s_, $db{$key}->{'start'};
push @e_, $db{$key}->{'end'};
die if $db{$key}->{'start'} > $db{$key}->{'end'};
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH i-g-t 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-05 16:50 [PATCH i-g-t 1/2] scripts/trace.pl: Support class:instance engine tracepoints Tvrtko Ursulin
@ 2018-06-05 16:50 ` Tvrtko Ursulin
2018-06-05 17:14 ` Lionel Landwerlin
2018-06-05 17:15 ` [igt-dev] [PATCH i-g-t 1/2] scripts/trace.pl: Support " Lionel Landwerlin
1 sibling, 1 reply; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-06-05 16:50 UTC (permalink / raw)
To: igt-dev; +Cc: intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
A miminal hack to parse the new tracepoint format and invent new "ring
id's" based on engine class and instance.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
overlay/gpu-perf.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
index ea3480050ab9..e77125672088 100644
--- a/overlay/gpu-perf.c
+++ b/overlay/gpu-perf.c
@@ -85,7 +85,8 @@ struct tracepoint {
int device_field;
int ctx_field;
- int ring_field;
+ int class_field;
+ int instance_field;
int seqno_field;
int global_seqno_field;
int plane_field;
@@ -151,8 +152,10 @@ tracepoint_id(int tp_id)
tp->device_field = f;
} else if (!strcmp(tp->fields[f].name, "ctx")) {
tp->ctx_field = f;
- } else if (!strcmp(tp->fields[f].name, "ring")) {
- tp->ring_field = f;
+ } else if (!strcmp(tp->fields[f].name, "class")) {
+ tp->class_field = f;
+ } else if (!strcmp(tp->fields[f].name, "instance")) {
+ tp->instance_field = f;
} else if (!strcmp(tp->fields[f].name, "seqno")) {
tp->seqno_field = f;
} else if (!strcmp(tp->fields[f].name, "global_seqno")) {
@@ -175,6 +178,23 @@ tracepoint_id(int tp_id)
tracepoints[tp_id].fields[ \
tracepoints[tp_id].field_name##_field].offset))
+#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
+ (*(const uint16_t *)((sample)->tracepoint_data + \
+ tracepoints[tp_id].fields[ \
+ tracepoints[tp_id].field_name##_field].offset))
+
+#define GET_RING_ID(sample, tp_id) \
+({ \
+ unsigned char class, instance, ring; \
+\
+ class = READ_TP_FIELD_U16(sample, tp_id, class); \
+ instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
+\
+ ring = class * 2 + instance; \
+\
+ ring; \
+})
+
static int perf_tracepoint_open(struct gpu_perf *gp, int tp_id,
int (*func)(struct gpu_perf *, const void *))
{
@@ -313,7 +333,7 @@ static int request_add(struct gpu_perf *gp, const void *event)
if (comm == NULL)
return 0;
- comm->nr_requests[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_ADD, ring)]++;
+ comm->nr_requests[GET_RING_ID(sample, TP_GEM_REQUEST_ADD)]++;
return 1;
}
@@ -329,7 +349,7 @@ static int ctx_switch(struct gpu_perf *gp, const void *event)
{
const struct sample_event *sample = event;
- gp->ctx_switch[READ_TP_FIELD_U32(sample, TP_GEM_RING_SWITCH_CONTEXT, ring)]++;
+ gp->ctx_switch[GET_RING_ID(sample, TP_GEM_RING_SWITCH_CONTEXT)]++;
return 1;
}
@@ -367,8 +387,8 @@ static int wait_begin(struct gpu_perf *gp, const void *event)
wait->context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ctx);
wait->seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, seqno);
wait->time = sample->time;
- wait->next = gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)];
- gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)] = wait;
+ wait->next = gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)];
+ gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)] = wait;
return 0;
}
@@ -377,7 +397,7 @@ static int wait_end(struct gpu_perf *gp, const void *event)
{
const struct sample_event *sample = event;
struct gpu_perf_time *wait, **prev;
- uint32_t engine = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ring);
+ uint32_t engine = GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_END);
uint32_t context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ctx);
uint32_t seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, seqno);
--
2.17.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH i-g-t 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-05 16:50 ` [PATCH i-g-t 2/2] intel_gpu_overlay: Update for " Tvrtko Ursulin
@ 2018-06-05 17:14 ` Lionel Landwerlin
2018-06-05 19:40 ` [igt-dev] " Chris Wilson
0 siblings, 1 reply; 8+ messages in thread
From: Lionel Landwerlin @ 2018-06-05 17:14 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx
On 05/06/18 17:50, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> A miminal hack to parse the new tracepoint format and invent new "ring
> id's" based on engine class and instance.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
> overlay/gpu-perf.c | 36 ++++++++++++++++++++++++++++--------
> 1 file changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
> index ea3480050ab9..e77125672088 100644
> --- a/overlay/gpu-perf.c
> +++ b/overlay/gpu-perf.c
> @@ -85,7 +85,8 @@ struct tracepoint {
>
> int device_field;
> int ctx_field;
> - int ring_field;
> + int class_field;
> + int instance_field;
> int seqno_field;
> int global_seqno_field;
> int plane_field;
> @@ -151,8 +152,10 @@ tracepoint_id(int tp_id)
> tp->device_field = f;
> } else if (!strcmp(tp->fields[f].name, "ctx")) {
> tp->ctx_field = f;
> - } else if (!strcmp(tp->fields[f].name, "ring")) {
> - tp->ring_field = f;
> + } else if (!strcmp(tp->fields[f].name, "class")) {
> + tp->class_field = f;
> + } else if (!strcmp(tp->fields[f].name, "instance")) {
> + tp->instance_field = f;
That looks good to me. We only support the most recent kernel?
> } else if (!strcmp(tp->fields[f].name, "seqno")) {
> tp->seqno_field = f;
> } else if (!strcmp(tp->fields[f].name, "global_seqno")) {
> @@ -175,6 +178,23 @@ tracepoint_id(int tp_id)
> tracepoints[tp_id].fields[ \
> tracepoints[tp_id].field_name##_field].offset))
>
> +#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
> + (*(const uint16_t *)((sample)->tracepoint_data + \
> + tracepoints[tp_id].fields[ \
> + tracepoints[tp_id].field_name##_field].offset))
> +
> +#define GET_RING_ID(sample, tp_id) \
> +({ \
> + unsigned char class, instance, ring; \
> +\
> + class = READ_TP_FIELD_U16(sample, tp_id, class); \
> + instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
> +\
> + ring = class * 2 + instance; \
Do you want to make it clear that we cannot have more than 2 instances
per class?
> +\
> + ring; \
> +})
> +
> static int perf_tracepoint_open(struct gpu_perf *gp, int tp_id,
> int (*func)(struct gpu_perf *, const void *))
> {
> @@ -313,7 +333,7 @@ static int request_add(struct gpu_perf *gp, const void *event)
> if (comm == NULL)
> return 0;
>
> - comm->nr_requests[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_ADD, ring)]++;
> + comm->nr_requests[GET_RING_ID(sample, TP_GEM_REQUEST_ADD)]++;
> return 1;
> }
>
> @@ -329,7 +349,7 @@ static int ctx_switch(struct gpu_perf *gp, const void *event)
> {
> const struct sample_event *sample = event;
>
> - gp->ctx_switch[READ_TP_FIELD_U32(sample, TP_GEM_RING_SWITCH_CONTEXT, ring)]++;
> + gp->ctx_switch[GET_RING_ID(sample, TP_GEM_RING_SWITCH_CONTEXT)]++;
> return 1;
> }
>
> @@ -367,8 +387,8 @@ static int wait_begin(struct gpu_perf *gp, const void *event)
> wait->context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ctx);
> wait->seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, seqno);
> wait->time = sample->time;
> - wait->next = gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)];
> - gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)] = wait;
> + wait->next = gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)];
> + gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)] = wait;
>
> return 0;
> }
> @@ -377,7 +397,7 @@ static int wait_end(struct gpu_perf *gp, const void *event)
> {
> const struct sample_event *sample = event;
> struct gpu_perf_time *wait, **prev;
> - uint32_t engine = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ring);
> + uint32_t engine = GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_END);
> uint32_t context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ctx);
> uint32_t seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, seqno);
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] scripts/trace.pl: Support class:instance engine tracepoints
2018-06-05 16:50 [PATCH i-g-t 1/2] scripts/trace.pl: Support class:instance engine tracepoints Tvrtko Ursulin
2018-06-05 16:50 ` [PATCH i-g-t 2/2] intel_gpu_overlay: Update for " Tvrtko Ursulin
@ 2018-06-05 17:15 ` Lionel Landwerlin
1 sibling, 0 replies; 8+ messages in thread
From: Lionel Landwerlin @ 2018-06-05 17:15 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
On 05/06/18 17:50, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> New way of describing engines needs the tool to be adapted to understand it.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> scripts/trace.pl | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/trace.pl b/scripts/trace.pl
> index 068eee68b30c..ea6c667696f4 100755
> --- a/scripts/trace.pl
> +++ b/scripts/trace.pl
> @@ -378,6 +378,8 @@ while (<>) {
> $k = 'global' if $k eq 'global_seqno';
> chop $v if substr($v, -1, 1) eq ',';
> $tp{$k} = $v;
> +
> + $tp{'ring'} = $tp{'engine'} if $k eq 'engine';
> }
>
> next if exists $tp{'ring'} and exists $ignore_ring{$tp{'ring'}};
> @@ -631,7 +633,7 @@ foreach my $gid (sort keys %rings) {
>
> # Extract all GPU busy intervals and sort them.
> foreach my $key (@sorted_keys) {
> - next unless $db{$key}->{'ring'} == $ring;
> + next unless $db{$key}->{'ring'} eq $ring;
> push @s_, $db{$key}->{'start'};
> push @e_, $db{$key}->{'end'};
> die if $db{$key}->{'start'} > $db{$key}->{'end'};
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-05 17:14 ` Lionel Landwerlin
@ 2018-06-05 19:40 ` Chris Wilson
2018-06-06 9:02 ` [PATCH i-g-t v2 " Tvrtko Ursulin
0 siblings, 1 reply; 8+ messages in thread
From: Chris Wilson @ 2018-06-05 19:40 UTC (permalink / raw)
To: Lionel Landwerlin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx
Quoting Lionel Landwerlin (2018-06-05 18:14:58)
> On 05/06/18 17:50, Tvrtko Ursulin wrote:
> > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >
> > A miminal hack to parse the new tracepoint format and invent new "ring
> > id's" based on engine class and instance.
> >
> > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> > ---
> > overlay/gpu-perf.c | 36 ++++++++++++++++++++++++++++--------
> > 1 file changed, 28 insertions(+), 8 deletions(-)
> >
> > diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
> > index ea3480050ab9..e77125672088 100644
> > --- a/overlay/gpu-perf.c
> > +++ b/overlay/gpu-perf.c
> > @@ -85,7 +85,8 @@ struct tracepoint {
> >
> > int device_field;
> > int ctx_field;
> > - int ring_field;
> > + int class_field;
> > + int instance_field;
> > int seqno_field;
> > int global_seqno_field;
> > int plane_field;
> > @@ -151,8 +152,10 @@ tracepoint_id(int tp_id)
> > tp->device_field = f;
> > } else if (!strcmp(tp->fields[f].name, "ctx")) {
> > tp->ctx_field = f;
> > - } else if (!strcmp(tp->fields[f].name, "ring")) {
> > - tp->ring_field = f;
> > + } else if (!strcmp(tp->fields[f].name, "class")) {
> > + tp->class_field = f;
> > + } else if (!strcmp(tp->fields[f].name, "instance")) {
> > + tp->instance_field = f;
>
> That looks good to me. We only support the most recent kernel?
Yes. It's a devtool using a dev interface. It's sole purpose is for
debugging the current kernel, or userspace in conjunction with drm-tip.
It's a temporary hack...
> > } else if (!strcmp(tp->fields[f].name, "seqno")) {
> > tp->seqno_field = f;
> > } else if (!strcmp(tp->fields[f].name, "global_seqno")) {
> > @@ -175,6 +178,23 @@ tracepoint_id(int tp_id)
> > tracepoints[tp_id].fields[ \
> > tracepoints[tp_id].field_name##_field].offset))
> >
> > +#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
> > + (*(const uint16_t *)((sample)->tracepoint_data + \
> > + tracepoints[tp_id].fields[ \
> > + tracepoints[tp_id].field_name##_field].offset))
> > +
> > +#define GET_RING_ID(sample, tp_id) \
> > +({ \
> > + unsigned char class, instance, ring; \
> > +\
> > + class = READ_TP_FIELD_U16(sample, tp_id, class); \
> > + instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
> > +\
> > + ring = class * 2 + instance; \
>
> Do you want to make it clear that we cannot have more than 2 instances
> per class?
Or make it easier to spot and expand in future.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH i-g-t v2 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-05 19:40 ` [igt-dev] " Chris Wilson
@ 2018-06-06 9:02 ` Tvrtko Ursulin
2018-06-06 10:29 ` Lionel Landwerlin
0 siblings, 1 reply; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-06-06 9:02 UTC (permalink / raw)
To: igt-dev; +Cc: intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
A miminal hack to parse the new tracepoint format and invent new "ring
id's" based on engine class and instance.
v2:
* Make it a bit more future proof. (Lionel, Chris)
* Some assorted fixups to show forgotten engines.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
overlay/gpu-perf.c | 40 ++++++++++++++++++++++++++++++++--------
overlay/overlay.c | 17 +++++++++--------
2 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
index ea3480050ab9..5629f826765e 100644
--- a/overlay/gpu-perf.c
+++ b/overlay/gpu-perf.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <fcntl.h>
#include <errno.h>
+#include <assert.h>
#include "igt_perf.h"
@@ -85,7 +86,8 @@ struct tracepoint {
int device_field;
int ctx_field;
- int ring_field;
+ int class_field;
+ int instance_field;
int seqno_field;
int global_seqno_field;
int plane_field;
@@ -151,8 +153,10 @@ tracepoint_id(int tp_id)
tp->device_field = f;
} else if (!strcmp(tp->fields[f].name, "ctx")) {
tp->ctx_field = f;
- } else if (!strcmp(tp->fields[f].name, "ring")) {
- tp->ring_field = f;
+ } else if (!strcmp(tp->fields[f].name, "class")) {
+ tp->class_field = f;
+ } else if (!strcmp(tp->fields[f].name, "instance")) {
+ tp->instance_field = f;
} else if (!strcmp(tp->fields[f].name, "seqno")) {
tp->seqno_field = f;
} else if (!strcmp(tp->fields[f].name, "global_seqno")) {
@@ -175,6 +179,26 @@ tracepoint_id(int tp_id)
tracepoints[tp_id].fields[ \
tracepoints[tp_id].field_name##_field].offset))
+#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
+ (*(const uint16_t *)((sample)->tracepoint_data + \
+ tracepoints[tp_id].fields[ \
+ tracepoints[tp_id].field_name##_field].offset))
+
+#define GET_RING_ID(sample, tp_id) \
+({ \
+ unsigned char class, instance, ring; \
+\
+ class = READ_TP_FIELD_U16(sample, tp_id, class); \
+ instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
+\
+ assert(class <= I915_ENGINE_CLASS_VIDEO_ENHANCE); \
+ assert(instance <= 4); \
+\
+ ring = class * 4 + instance; \
+\
+ ring; \
+})
+
static int perf_tracepoint_open(struct gpu_perf *gp, int tp_id,
int (*func)(struct gpu_perf *, const void *))
{
@@ -313,7 +337,7 @@ static int request_add(struct gpu_perf *gp, const void *event)
if (comm == NULL)
return 0;
- comm->nr_requests[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_ADD, ring)]++;
+ comm->nr_requests[GET_RING_ID(sample, TP_GEM_REQUEST_ADD)]++;
return 1;
}
@@ -329,7 +353,7 @@ static int ctx_switch(struct gpu_perf *gp, const void *event)
{
const struct sample_event *sample = event;
- gp->ctx_switch[READ_TP_FIELD_U32(sample, TP_GEM_RING_SWITCH_CONTEXT, ring)]++;
+ gp->ctx_switch[GET_RING_ID(sample, TP_GEM_RING_SWITCH_CONTEXT)]++;
return 1;
}
@@ -367,8 +391,8 @@ static int wait_begin(struct gpu_perf *gp, const void *event)
wait->context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ctx);
wait->seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, seqno);
wait->time = sample->time;
- wait->next = gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)];
- gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)] = wait;
+ wait->next = gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)];
+ gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)] = wait;
return 0;
}
@@ -377,7 +401,7 @@ static int wait_end(struct gpu_perf *gp, const void *event)
{
const struct sample_event *sample = event;
struct gpu_perf_time *wait, **prev;
- uint32_t engine = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ring);
+ uint32_t engine = GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_END);
uint32_t context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ctx);
uint32_t seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, seqno);
diff --git a/overlay/overlay.c b/overlay/overlay.c
index 545af7bcb2f5..eae5ddfa8823 100644
--- a/overlay/overlay.c
+++ b/overlay/overlay.c
@@ -148,6 +148,7 @@ static void init_gpu_top(struct overlay_context *ctx,
{ 0.25, 1, 0.25, 1 },
{ 0.25, 0.25, 1, 1 },
{ 1, 1, 1, 1 },
+ { 1, 1, 0.25, 1 },
};
int n;
@@ -311,11 +312,11 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
{ 1, 1, 1, 1 },
};
struct gpu_perf_comm *comm, **prev;
- const char *ring_name[] = {
- "R",
- "B",
- "V0",
- "V1",
+ const char *ring_name[MAX_RINGS] = {
+ "R", "?", "?", "?",
+ "B", "?", "?", "?",
+ "V0", "V1", "?", "?",
+ "VE0", "?", "?", "?",
};
double range[2];
char buf[1024];
@@ -326,7 +327,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
gpu_perf_update(&gp->gpu_perf);
- for (n = 0; n < 4; n++) {
+ for (n = 0; n < MAX_RINGS; n++) {
if (gp->gpu_perf.ctx_switch[n])
has_ctx = n + 1;
if (gp->gpu_perf.flip_complete[n])
@@ -389,7 +390,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
}
total = 0;
- for (n = 0; n < 3; n++)
+ for (n = 0; n < MAX_RINGS; n++)
total += comm->nr_requests[n];
chart_add_sample(comm->user_data, total);
}
@@ -433,7 +434,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
goto skip_comm;
len = sprintf(buf, "%s:", comm->name);
- for (n = 0; n < sizeof(ring_name)/sizeof(ring_name[0]); n++) {
+ for (n = 0; n < MAX_RINGS; n++) {
if (comm->nr_requests[n] == 0)
continue;
len += sprintf(buf + len, "%s %d%s", need_comma ? "," : "", comm->nr_requests[n], ring_name[n]);
--
2.17.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH i-g-t v2 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-06 9:02 ` [PATCH i-g-t v2 " Tvrtko Ursulin
@ 2018-06-06 10:29 ` Lionel Landwerlin
2018-06-06 11:01 ` Tvrtko Ursulin
0 siblings, 1 reply; 8+ messages in thread
From: Lionel Landwerlin @ 2018-06-06 10:29 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: intel-gfx
On 06/06/18 10:02, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> A miminal hack to parse the new tracepoint format and invent new "ring
> id's" based on engine class and instance.
>
> v2:
> * Make it a bit more future proof. (Lionel, Chris)
> * Some assorted fixups to show forgotten engines.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
> overlay/gpu-perf.c | 40 ++++++++++++++++++++++++++++++++--------
> overlay/overlay.c | 17 +++++++++--------
> 2 files changed, 41 insertions(+), 16 deletions(-)
>
> diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
> index ea3480050ab9..5629f826765e 100644
> --- a/overlay/gpu-perf.c
> +++ b/overlay/gpu-perf.c
> @@ -33,6 +33,7 @@
> #include <string.h>
> #include <fcntl.h>
> #include <errno.h>
> +#include <assert.h>
>
> #include "igt_perf.h"
>
> @@ -85,7 +86,8 @@ struct tracepoint {
>
> int device_field;
> int ctx_field;
> - int ring_field;
> + int class_field;
> + int instance_field;
> int seqno_field;
> int global_seqno_field;
> int plane_field;
> @@ -151,8 +153,10 @@ tracepoint_id(int tp_id)
> tp->device_field = f;
> } else if (!strcmp(tp->fields[f].name, "ctx")) {
> tp->ctx_field = f;
> - } else if (!strcmp(tp->fields[f].name, "ring")) {
> - tp->ring_field = f;
> + } else if (!strcmp(tp->fields[f].name, "class")) {
> + tp->class_field = f;
> + } else if (!strcmp(tp->fields[f].name, "instance")) {
> + tp->instance_field = f;
> } else if (!strcmp(tp->fields[f].name, "seqno")) {
> tp->seqno_field = f;
> } else if (!strcmp(tp->fields[f].name, "global_seqno")) {
> @@ -175,6 +179,26 @@ tracepoint_id(int tp_id)
> tracepoints[tp_id].fields[ \
> tracepoints[tp_id].field_name##_field].offset))
>
> +#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
> + (*(const uint16_t *)((sample)->tracepoint_data + \
> + tracepoints[tp_id].fields[ \
> + tracepoints[tp_id].field_name##_field].offset))
> +
> +#define GET_RING_ID(sample, tp_id) \
> +({ \
> + unsigned char class, instance, ring; \
> +\
> + class = READ_TP_FIELD_U16(sample, tp_id, class); \
> + instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
> +\
> + assert(class <= I915_ENGINE_CLASS_VIDEO_ENHANCE); \
> + assert(instance <= 4); \
> +\
> + ring = class * 4 + instance; \
> +\
> + ring; \
> +})
> +
> static int perf_tracepoint_open(struct gpu_perf *gp, int tp_id,
> int (*func)(struct gpu_perf *, const void *))
> {
> @@ -313,7 +337,7 @@ static int request_add(struct gpu_perf *gp, const void *event)
> if (comm == NULL)
> return 0;
>
> - comm->nr_requests[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_ADD, ring)]++;
> + comm->nr_requests[GET_RING_ID(sample, TP_GEM_REQUEST_ADD)]++;
> return 1;
> }
>
> @@ -329,7 +353,7 @@ static int ctx_switch(struct gpu_perf *gp, const void *event)
> {
> const struct sample_event *sample = event;
>
> - gp->ctx_switch[READ_TP_FIELD_U32(sample, TP_GEM_RING_SWITCH_CONTEXT, ring)]++;
> + gp->ctx_switch[GET_RING_ID(sample, TP_GEM_RING_SWITCH_CONTEXT)]++;
> return 1;
> }
>
> @@ -367,8 +391,8 @@ static int wait_begin(struct gpu_perf *gp, const void *event)
> wait->context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ctx);
> wait->seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, seqno);
> wait->time = sample->time;
> - wait->next = gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)];
> - gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN, ring)] = wait;
> + wait->next = gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)];
> + gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)] = wait;
>
> return 0;
> }
> @@ -377,7 +401,7 @@ static int wait_end(struct gpu_perf *gp, const void *event)
> {
> const struct sample_event *sample = event;
> struct gpu_perf_time *wait, **prev;
> - uint32_t engine = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ring);
> + uint32_t engine = GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_END);
> uint32_t context = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, ctx);
> uint32_t seqno = READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_END, seqno);
>
> diff --git a/overlay/overlay.c b/overlay/overlay.c
> index 545af7bcb2f5..eae5ddfa8823 100644
> --- a/overlay/overlay.c
> +++ b/overlay/overlay.c
> @@ -148,6 +148,7 @@ static void init_gpu_top(struct overlay_context *ctx,
> { 0.25, 1, 0.25, 1 },
> { 0.25, 0.25, 1, 1 },
> { 1, 1, 1, 1 },
> + { 1, 1, 0.25, 1 },
> };
> int n;
>
> @@ -311,11 +312,11 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
> { 1, 1, 1, 1 },
> };
> struct gpu_perf_comm *comm, **prev;
> - const char *ring_name[] = {
> - "R",
> - "B",
> - "V0",
> - "V1",
> + const char *ring_name[MAX_RINGS] = {
> + "R", "?", "?", "?",
> + "B", "?", "?", "?",
> + "V0", "V1", "?", "?",
> + "VE0", "?", "?", "?",
> };
I guess if you defined a MAX_ENGINE_INSTANCES somewhere, you could just
have an array of class names and then generate ring_name off the n
variable further below.
class = n / MAX_ENGINE_INSTANCES
instance = n % MAX_ENGINE_INSTANCES
snprintf(ring_name, sizeof(ring_name), "%s%i", class_names[class],
instance);
Just a suggestion, regardless :
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> double range[2];
> char buf[1024];
> @@ -326,7 +327,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
>
> gpu_perf_update(&gp->gpu_perf);
>
> - for (n = 0; n < 4; n++) {
> + for (n = 0; n < MAX_RINGS; n++) {
> if (gp->gpu_perf.ctx_switch[n])
> has_ctx = n + 1;
> if (gp->gpu_perf.flip_complete[n])
> @@ -389,7 +390,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
> }
>
> total = 0;
> - for (n = 0; n < 3; n++)
> + for (n = 0; n < MAX_RINGS; n++)
> total += comm->nr_requests[n];
> chart_add_sample(comm->user_data, total);
> }
> @@ -433,7 +434,7 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
> goto skip_comm;
>
> len = sprintf(buf, "%s:", comm->name);
> - for (n = 0; n < sizeof(ring_name)/sizeof(ring_name[0]); n++) {
> + for (n = 0; n < MAX_RINGS; n++) {
> if (comm->nr_requests[n] == 0)
> continue;
> len += sprintf(buf + len, "%s %d%s", need_comma ? "," : "", comm->nr_requests[n], ring_name[n]);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH i-g-t v2 2/2] intel_gpu_overlay: Update for class:instance engine tracepoints
2018-06-06 10:29 ` Lionel Landwerlin
@ 2018-06-06 11:01 ` Tvrtko Ursulin
0 siblings, 0 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-06-06 11:01 UTC (permalink / raw)
To: Lionel Landwerlin, Tvrtko Ursulin, igt-dev; +Cc: intel-gfx
On 06/06/2018 11:29, Lionel Landwerlin wrote:
> On 06/06/18 10:02, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> A miminal hack to parse the new tracepoint format and invent new "ring
>> id's" based on engine class and instance.
>>
>> v2:
>> * Make it a bit more future proof. (Lionel, Chris)
>> * Some assorted fixups to show forgotten engines.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
>> ---
>> overlay/gpu-perf.c | 40 ++++++++++++++++++++++++++++++++--------
>> overlay/overlay.c | 17 +++++++++--------
>> 2 files changed, 41 insertions(+), 16 deletions(-)
>>
>> diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
>> index ea3480050ab9..5629f826765e 100644
>> --- a/overlay/gpu-perf.c
>> +++ b/overlay/gpu-perf.c
>> @@ -33,6 +33,7 @@
>> #include <string.h>
>> #include <fcntl.h>
>> #include <errno.h>
>> +#include <assert.h>
>> #include "igt_perf.h"
>> @@ -85,7 +86,8 @@ struct tracepoint {
>> int device_field;
>> int ctx_field;
>> - int ring_field;
>> + int class_field;
>> + int instance_field;
>> int seqno_field;
>> int global_seqno_field;
>> int plane_field;
>> @@ -151,8 +153,10 @@ tracepoint_id(int tp_id)
>> tp->device_field = f;
>> } else if (!strcmp(tp->fields[f].name, "ctx")) {
>> tp->ctx_field = f;
>> - } else if (!strcmp(tp->fields[f].name, "ring")) {
>> - tp->ring_field = f;
>> + } else if (!strcmp(tp->fields[f].name, "class")) {
>> + tp->class_field = f;
>> + } else if (!strcmp(tp->fields[f].name, "instance")) {
>> + tp->instance_field = f;
>> } else if (!strcmp(tp->fields[f].name, "seqno")) {
>> tp->seqno_field = f;
>> } else if (!strcmp(tp->fields[f].name, "global_seqno")) {
>> @@ -175,6 +179,26 @@ tracepoint_id(int tp_id)
>> tracepoints[tp_id].fields[ \
>> tracepoints[tp_id].field_name##_field].offset))
>> +#define READ_TP_FIELD_U16(sample, tp_id, field_name) \
>> + (*(const uint16_t *)((sample)->tracepoint_data + \
>> + tracepoints[tp_id].fields[ \
>> + tracepoints[tp_id].field_name##_field].offset))
>> +
>> +#define GET_RING_ID(sample, tp_id) \
>> +({ \
>> + unsigned char class, instance, ring; \
>> +\
>> + class = READ_TP_FIELD_U16(sample, tp_id, class); \
>> + instance = READ_TP_FIELD_U16(sample, tp_id, instance); \
>> +\
>> + assert(class <= I915_ENGINE_CLASS_VIDEO_ENHANCE); \
>> + assert(instance <= 4); \
>> +\
>> + ring = class * 4 + instance; \
>> +\
>> + ring; \
>> +})
>> +
>> static int perf_tracepoint_open(struct gpu_perf *gp, int tp_id,
>> int (*func)(struct gpu_perf *, const void *))
>> {
>> @@ -313,7 +337,7 @@ static int request_add(struct gpu_perf *gp, const
>> void *event)
>> if (comm == NULL)
>> return 0;
>> - comm->nr_requests[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_ADD,
>> ring)]++;
>> + comm->nr_requests[GET_RING_ID(sample, TP_GEM_REQUEST_ADD)]++;
>> return 1;
>> }
>> @@ -329,7 +353,7 @@ static int ctx_switch(struct gpu_perf *gp, const
>> void *event)
>> {
>> const struct sample_event *sample = event;
>> - gp->ctx_switch[READ_TP_FIELD_U32(sample,
>> TP_GEM_RING_SWITCH_CONTEXT, ring)]++;
>> + gp->ctx_switch[GET_RING_ID(sample, TP_GEM_RING_SWITCH_CONTEXT)]++;
>> return 1;
>> }
>> @@ -367,8 +391,8 @@ static int wait_begin(struct gpu_perf *gp, const
>> void *event)
>> wait->context = READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_BEGIN, ctx);
>> wait->seqno = READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_BEGIN, seqno);
>> wait->time = sample->time;
>> - wait->next = gp->wait[READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_BEGIN, ring)];
>> - gp->wait[READ_TP_FIELD_U32(sample, TP_GEM_REQUEST_WAIT_BEGIN,
>> ring)] = wait;
>> + wait->next = gp->wait[GET_RING_ID(sample,
>> TP_GEM_REQUEST_WAIT_BEGIN)];
>> + gp->wait[GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_BEGIN)] = wait;
>> return 0;
>> }
>> @@ -377,7 +401,7 @@ static int wait_end(struct gpu_perf *gp, const
>> void *event)
>> {
>> const struct sample_event *sample = event;
>> struct gpu_perf_time *wait, **prev;
>> - uint32_t engine = READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_END, ring);
>> + uint32_t engine = GET_RING_ID(sample, TP_GEM_REQUEST_WAIT_END);
>> uint32_t context = READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_END, ctx);
>> uint32_t seqno = READ_TP_FIELD_U32(sample,
>> TP_GEM_REQUEST_WAIT_END, seqno);
>> diff --git a/overlay/overlay.c b/overlay/overlay.c
>> index 545af7bcb2f5..eae5ddfa8823 100644
>> --- a/overlay/overlay.c
>> +++ b/overlay/overlay.c
>> @@ -148,6 +148,7 @@ static void init_gpu_top(struct overlay_context *ctx,
>> { 0.25, 1, 0.25, 1 },
>> { 0.25, 0.25, 1, 1 },
>> { 1, 1, 1, 1 },
>> + { 1, 1, 0.25, 1 },
>> };
>> int n;
>> @@ -311,11 +312,11 @@ static void show_gpu_perf(struct overlay_context
>> *ctx, struct overlay_gpu_perf *
>> { 1, 1, 1, 1 },
>> };
>> struct gpu_perf_comm *comm, **prev;
>> - const char *ring_name[] = {
>> - "R",
>> - "B",
>> - "V0",
>> - "V1",
>> + const char *ring_name[MAX_RINGS] = {
>> + "R", "?", "?", "?",
>> + "B", "?", "?", "?",
>> + "V0", "V1", "?", "?",
>> + "VE0", "?", "?", "?",
>> };
>
> I guess if you defined a MAX_ENGINE_INSTANCES somewhere, you could just
> have an array of class names and then generate ring_name off the n
> variable further below.
>
> class = n / MAX_ENGINE_INSTANCES
> instance = n % MAX_ENGINE_INSTANCES
>
> snprintf(ring_name, sizeof(ring_name), "%s%i", class_names[class],
> instance);
>
>
> Just a suggestion, regardless :
>
> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Thanks! Above is a completely reasonable suggestion but I have pushed
this for now just so the tool doesn't segfault for now. I suspect there
are more issues lurking in there if it is to be made really future proof.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-06-06 11:01 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-05 16:50 [PATCH i-g-t 1/2] scripts/trace.pl: Support class:instance engine tracepoints Tvrtko Ursulin
2018-06-05 16:50 ` [PATCH i-g-t 2/2] intel_gpu_overlay: Update for " Tvrtko Ursulin
2018-06-05 17:14 ` Lionel Landwerlin
2018-06-05 19:40 ` [igt-dev] " Chris Wilson
2018-06-06 9:02 ` [PATCH i-g-t v2 " Tvrtko Ursulin
2018-06-06 10:29 ` Lionel Landwerlin
2018-06-06 11:01 ` Tvrtko Ursulin
2018-06-05 17:15 ` [igt-dev] [PATCH i-g-t 1/2] scripts/trace.pl: Support " Lionel Landwerlin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox