mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
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>
This commit is contained in:
parent
1e65d5ac2f
commit
908df374a9
@ -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";
|
||||
|
@ -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;
|
||||
|
@ -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,7 +361,42 @@ 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->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;
|
||||
len += sprintf(buf + len, "%s %d%s", need_comma ? "," : "", comm->nr_requests[n], ring_name[n]);
|
||||
need_comma = true;
|
||||
}
|
||||
if (comm->wait_time) {
|
||||
if (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) {
|
||||
len += sprintf(buf + len, "%s %.1fus waits",
|
||||
need_comma ? "," : "",
|
||||
comm->wait_time / 1000.);
|
||||
} else {
|
||||
len += sprintf(buf, "%s %.0fns waits",
|
||||
need_comma ? "," : "",
|
||||
(double)comm->wait_time);
|
||||
}
|
||||
need_comma = true;
|
||||
comm->wait_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;
|
||||
@ -373,59 +408,10 @@ static void show_gpu_perf(struct overlay_context *ctx, struct overlay_gpu_perf *
|
||||
} 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);
|
||||
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);
|
||||
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.));
|
||||
} else if (comm->wait_time > 100) {
|
||||
sprintf(buf, "%s %.1f us waiting",
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user