summaryrefslogtreecommitdiff
path: root/overlay
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-08-26 14:11:27 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-08-26 14:34:05 +0100
commit908df374a9b469a8d8accdc504564a1bd79eeab5 (patch)
tree4281c3aa4ca5f70cca1706d7303242864c7ca648 /overlay
parent1e65d5ac2f1c3b80444fd3c12e7bfcaf033a117f (diff)
overlay: Count number of semaphores used by each process
This required me to contract the per-process information considerably, hopefully readability is not sacrificed too much. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay')
-rw-r--r--overlay/gpu-perf.c14
-rw-r--r--overlay/gpu-perf.h2
-rw-r--r--overlay/overlay.c90
3 files changed, 53 insertions, 53 deletions
diff --git a/overlay/gpu-perf.c b/overlay/gpu-perf.c
index 61e447da..142357cb 100644
--- a/overlay/gpu-perf.c
+++ b/overlay/gpu-perf.c
@@ -249,6 +249,19 @@ static int flip_complete(struct gpu_perf *gp, const void *event)
return 1;
}
+static int ring_sync(struct gpu_perf *gp, const void *event)
+{
+ const struct sample_event *sample = event;
+ struct gpu_perf_comm *comm;
+
+ comm = lookup_comm(gp, sample->pid);
+ if (comm == NULL)
+ return 0;
+
+ comm->nr_sema++;
+ return 1;
+}
+
static int wait_begin(struct gpu_perf *gp, const void *event)
{
const struct sample_event *sample = event;
@@ -300,6 +313,7 @@ void gpu_perf_init(struct gpu_perf *gp, unsigned flags)
if (perf_tracepoint_open(gp, "i915", "i915_gem_request_wait_begin", wait_begin) == 0)
perf_tracepoint_open(gp, "i915", "i915_gem_request_wait_end", wait_end);
perf_tracepoint_open(gp, "i915", "i915_flip_complete", flip_complete);
+ perf_tracepoint_open(gp, "i915", "i915_gem_ring_sync_to", ring_sync);
if (gp->nr_events == 0) {
gp->error = "i915.ko tracepoints not available";
diff --git a/overlay/gpu-perf.h b/overlay/gpu-perf.h
index 53699f75..395eb8af 100644
--- a/overlay/gpu-perf.h
+++ b/overlay/gpu-perf.h
@@ -50,7 +50,7 @@ struct gpu_perf {
void *user_data;
uint64_t wait_time;
- uint64_t busy_time;
+ uint32_t nr_sema;
} *comm;
struct gpu_perf_time {
struct gpu_perf_time *next;
diff --git a/overlay/overlay.c b/overlay/overlay.c
index acbd853b..6ee51e84 100644
--- a/overlay/overlay.c
+++ b/overlay/overlay.c
@@ -282,9 +282,9 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
};
struct gpu_perf_comm *comm, **prev;
const char *ring_name[] = {
- "render",
- "video",
- "blt",
+ "R",
+ "V",
+ "B",
};
double range[2];
char buf[1024];
@@ -361,71 +361,57 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
cairo_fill(ctx->cr);
for (prev = &gp->gpu_perf.comm; (comm = *prev) != NULL; ) {
- int need_comma = 0;
+ int need_comma = 0, len;
- if (comm->user_data) {
- struct chart *c = comm->user_data;
- cairo_set_source_rgba(ctx->cr,
- c->stroke_rgb[0],
- c->stroke_rgb[1],
- c->stroke_rgb[2],
- c->stroke_rgb[3]);
- } else
- cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1);
- cairo_move_to(ctx->cr, x, y);
- sprintf(buf, "%s:", comm->name);
- cairo_show_text(ctx->cr, buf);
+ if (comm->name[0] == '\0')
+ goto skip_comm;
+
+ len = sprintf(buf, "%s:", comm->name);
for (n = 0; n < 3; n++) {
if (comm->nr_requests[n] == 0)
continue;
- sprintf(buf, "%s %d %s", need_comma ? "," : "", comm->nr_requests[n], ring_name[n]);
- cairo_show_text(ctx->cr, buf);
+ len += sprintf(buf + len, "%s %d%s", need_comma ? "," : "", comm->nr_requests[n], ring_name[n]);
need_comma = true;
}
if (comm->wait_time) {
- buf[0] = '\0';
if (comm->wait_time > 1000*1000) {
- sprintf(buf, "%s %.1f ms waiting",
- need_comma ? "," : "",
- comm->wait_time / (1000*1000.));
+ len += sprintf(buf + len, "%s %.1fms waits",
+ need_comma ? "," : "",
+ comm->wait_time / (1000*1000.));
} else if (comm->wait_time > 100) {
- sprintf(buf, "%s %.1f us waiting",
- need_comma ? "," : "",
- comm->wait_time / 1000.);
+ len += sprintf(buf + len, "%s %.1fus waits",
+ need_comma ? "," : "",
+ comm->wait_time / 1000.);
} else {
- sprintf(buf, "%s %.0f ns waiting",
- need_comma ? "," : "",
- (double)comm->wait_time);
- }
- if (buf[0] != '\0') {
- cairo_show_text(ctx->cr, buf);
- need_comma = true;
+ len += sprintf(buf, "%s %.0fns waits",
+ need_comma ? "," : "",
+ (double)comm->wait_time);
}
+ need_comma = true;
comm->wait_time = 0;
}
- if (comm->busy_time) {
- buf[0] = '\0';
- if (comm->busy_time > 1000*1000) {
- sprintf(buf, "%s %.1f ms busy",
- need_comma ? "," : "",
- comm->busy_time / (1000*1000.));
- } else if (comm->busy_time > 100) {
- sprintf(buf, "%s %.1f us busy",
- need_comma ? "," : "",
- comm->busy_time / 1000.);
- } else {
- sprintf(buf, "%s %.0f ns busy",
- need_comma ? "," : "",
- (double)comm->busy_time);
- }
- if (buf[0] != '\0') {
- cairo_show_text(ctx->cr, buf);
- need_comma = true;
- }
- comm->busy_time = 0;
+ if (comm->nr_sema) {
+ len += sprintf(buf + len, "%s %d syncs",
+ need_comma ? "," : "",
+ comm->nr_sema);
+ need_comma = true;
+ comm->nr_sema = 0;
}
+
+ if (comm->user_data) {
+ struct chart *c = comm->user_data;
+ cairo_set_source_rgba(ctx->cr,
+ c->stroke_rgb[0],
+ c->stroke_rgb[1],
+ c->stroke_rgb[2],
+ c->stroke_rgb[3]);
+ } else
+ cairo_set_source_rgba(ctx->cr, 1, 1, 1, 1);
+ cairo_move_to(ctx->cr, x, y);
+ cairo_show_text(ctx->cr, buf);
y += 14;
+skip_comm:
memset(comm->nr_requests, 0, sizeof(comm->nr_requests));
if (strcmp(comm->name, get_comm(comm->pid, buf, sizeof(buf)))) {
*prev = comm->next;