* [igt-dev] [PATCH i-g-t 0/2] intel-gpu-overlay: Queued/runnable/running engine stats
@ 2018-02-12 19:01 Tvrtko Ursulin
2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats Tvrtko Ursulin
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-02-12 19:01 UTC (permalink / raw)
To: igt-dev; +Cc: Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Show engine load and load average in intel-gpu-overlay. Matching IGT series to
go with: https://patchwork.freedesktop.org/series/36926/.
Tvrtko Ursulin (2):
intel-gpu-overlay: Add engine queue stats
intel-gpu-overlay: Show 1s, 30s and 15m GPU load
lib/igt_perf.h | 18 ++++++++++++-
overlay/gpu-top.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
overlay/gpu-top.h | 21 ++++++++++++++-
overlay/overlay.c | 36 +++++++++++++++++++------
4 files changed, 143 insertions(+), 11 deletions(-)
--
2.14.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread* [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats 2018-02-12 19:01 [igt-dev] [PATCH i-g-t 0/2] intel-gpu-overlay: Queued/runnable/running engine stats Tvrtko Ursulin @ 2018-02-12 19:01 ` Tvrtko Ursulin 2018-02-13 10:49 ` Chris Wilson 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin 2018-02-12 19:39 ` [igt-dev] ✗ Fi.CI.BAT: failure for intel-gpu-overlay: Queued/runnable/running engine stats Patchwork 2 siblings, 1 reply; 8+ messages in thread From: Tvrtko Ursulin @ 2018-02-12 19:01 UTC (permalink / raw) To: igt-dev; +Cc: Tvrtko Ursulin From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Use new PMU engine queue stats (queued, runnable and running) and display them per engine. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- lib/igt_perf.h | 18 +++++++++++++++++- overlay/gpu-top.c | 42 ++++++++++++++++++++++++++++++++++++++++++ overlay/gpu-top.h | 11 +++++++++++ overlay/overlay.c | 9 +++++++++ 4 files changed, 79 insertions(+), 1 deletion(-) diff --git a/lib/igt_perf.h b/lib/igt_perf.h index 7b66fc582b88..68e208941ca9 100644 --- a/lib/igt_perf.h +++ b/lib/igt_perf.h @@ -35,9 +35,16 @@ enum drm_i915_pmu_engine_sample { I915_SAMPLE_BUSY = 0, I915_SAMPLE_WAIT = 1, I915_SAMPLE_SEMA = 2, - I915_ENGINE_SAMPLE_MAX /* non-ABI */ + I915_SAMPLE_QUEUED = 3, + I915_SAMPLE_RUNNABLE = 4, + I915_SAMPLE_RUNNING = 5, }; + /* Divide counter value by divisor to get the real value. */ +#define I915_SAMPLE_QUEUED_DIVISOR (1024) +#define I915_SAMPLE_RUNNABLE_DIVISOR (1024) +#define I915_SAMPLE_RUNNING_DIVISOR (1024) + #define I915_PMU_SAMPLE_BITS (4) #define I915_PMU_SAMPLE_MASK (0xf) #define I915_PMU_SAMPLE_INSTANCE_BITS (8) @@ -58,6 +65,15 @@ enum drm_i915_pmu_engine_sample { #define I915_PMU_ENGINE_SEMA(class, instance) \ __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA) +#define I915_PMU_ENGINE_QUEUED(class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_QUEUED) + +#define I915_PMU_ENGINE_RUNNABLE(class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_RUNNABLE) + +#define I915_PMU_ENGINE_RUNNING(class, instance) \ + __I915_PMU_ENGINE(class, instance, I915_SAMPLE_RUNNING) + #define __I915_PMU_OTHER(x) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) #define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0) diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index 61b8f62fd78c..22e9badb22c1 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -72,6 +72,18 @@ static int perf_init(struct gpu_top *gt) gt->fd) >= 0) gt->have_sema = 1; + if (perf_i915_open_group(I915_PMU_ENGINE_QUEUED(d->class, d->inst), + gt->fd) >= 0) + gt->have_queued = 1; + + if (perf_i915_open_group(I915_PMU_ENGINE_RUNNABLE(d->class, d->inst), + gt->fd) >= 0) + gt->have_runnable = 1; + + if (perf_i915_open_group(I915_PMU_ENGINE_RUNNING(d->class, d->inst), + gt->fd) >= 0) + gt->have_running = 1; + gt->ring[0].name = d->name; gt->num_rings = 1; @@ -93,6 +105,24 @@ static int perf_init(struct gpu_top *gt) gt->fd) < 0) return -1; + if (gt->have_queued && + perf_i915_open_group(I915_PMU_ENGINE_QUEUED(d->class, + d->inst), + gt->fd) < 0) + return -1; + + if (gt->have_runnable && + perf_i915_open_group(I915_PMU_ENGINE_RUNNABLE(d->class, + d->inst), + gt->fd) < 0) + return -1; + + if (gt->have_running && + perf_i915_open_group(I915_PMU_ENGINE_RUNNING(d->class, + d->inst), + gt->fd) < 0) + return -1; + gt->ring[gt->num_rings++].name = d->name; } @@ -298,6 +328,12 @@ int gpu_top_update(struct gpu_top *gt) s->wait[n] = sample[m++]; if (gt->have_sema) s->sema[n] = sample[m++]; + if (gt->have_queued) + s->queued[n] = sample[m++]; + if (gt->have_runnable) + s->runnable[n] = sample[m++]; + if (gt->have_running) + s->running[n] = sample[m++]; } if (gt->count == 1) @@ -310,6 +346,12 @@ int gpu_top_update(struct gpu_top *gt) gt->ring[n].u.u.wait = (100 * (s->wait[n] - d->wait[n]) + d_time/2) / d_time; if (gt->have_sema) gt->ring[n].u.u.sema = (100 * (s->sema[n] - d->sema[n]) + d_time/2) / d_time; + if (gt->have_queued) + gt->ring[n].queued = (double)((s->queued[n] - d->queued[n])) / I915_SAMPLE_QUEUED_DIVISOR * 1e9 / d_time; + if (gt->have_runnable) + gt->ring[n].runnable = (double)((s->runnable[n] - d->runnable[n])) / I915_SAMPLE_RUNNABLE_DIVISOR * 1e9 / d_time; + if (gt->have_running) + gt->ring[n].running = (double)((s->running[n] - d->running[n])) / I915_SAMPLE_RUNNING_DIVISOR * 1e9 / d_time; /* in case of rounding + sampling errors, fudge */ if (gt->ring[n].u.u.busy > 100) diff --git a/overlay/gpu-top.h b/overlay/gpu-top.h index d3cdd779760f..cb4310c82a94 100644 --- a/overlay/gpu-top.h +++ b/overlay/gpu-top.h @@ -36,6 +36,9 @@ struct gpu_top { int num_rings; int have_wait; int have_sema; + int have_queued; + int have_runnable; + int have_running; struct gpu_top_ring { const char *name; @@ -47,6 +50,10 @@ struct gpu_top { } u; uint32_t payload; } u; + + double queued; + double runnable; + double running; } ring[MAX_RINGS]; struct gpu_top_stat { @@ -54,7 +61,11 @@ struct gpu_top { uint64_t busy[MAX_RINGS]; uint64_t wait[MAX_RINGS]; uint64_t sema[MAX_RINGS]; + uint64_t queued[MAX_RINGS]; + uint64_t runnable[MAX_RINGS]; + uint64_t running[MAX_RINGS]; } stat[2]; + int count; }; diff --git a/overlay/overlay.c b/overlay/overlay.c index 545af7bcb2f5..a639703ebcec 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -255,6 +255,15 @@ static void show_gpu_top(struct overlay_context *ctx, struct overlay_gpu_top *gt len = sprintf(txt, "%s: %3d%% busy", gt->gpu_top.ring[n].name, gt->gpu_top.ring[n].u.u.busy); + if (gt->gpu_top.have_queued) + len += sprintf(txt + len, ", qd %.2f", + gt->gpu_top.ring[n].queued); + if (gt->gpu_top.have_runnable) + len += sprintf(txt + len, ", rd %.2f", + gt->gpu_top.ring[n].runnable); + if (gt->gpu_top.have_running) + len += sprintf(txt + len, ", ed %.2f", + gt->gpu_top.ring[n].running); if (gt->gpu_top.ring[n].u.u.wait) len += sprintf(txt + len, ", %d%% wait", gt->gpu_top.ring[n].u.u.wait); -- 2.14.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats Tvrtko Ursulin @ 2018-02-13 10:49 ` Chris Wilson 0 siblings, 0 replies; 8+ messages in thread From: Chris Wilson @ 2018-02-13 10:49 UTC (permalink / raw) To: Tvrtko Ursulin, igt-dev; +Cc: Tvrtko Ursulin Quoting Tvrtko Ursulin (2018-02-12 19:01:57) > diff --git a/overlay/overlay.c b/overlay/overlay.c > index 545af7bcb2f5..a639703ebcec 100644 > --- a/overlay/overlay.c > +++ b/overlay/overlay.c > @@ -255,6 +255,15 @@ static void show_gpu_top(struct overlay_context *ctx, struct overlay_gpu_top *gt > len = sprintf(txt, "%s: %3d%% busy", > gt->gpu_top.ring[n].name, > gt->gpu_top.ring[n].u.u.busy); > + if (gt->gpu_top.have_queued) > + len += sprintf(txt + len, ", qd %.2f", > + gt->gpu_top.ring[n].queued); > + if (gt->gpu_top.have_runnable) > + len += sprintf(txt + len, ", rd %.2f", > + gt->gpu_top.ring[n].runnable); > + if (gt->gpu_top.have_running) > + len += sprintf(txt + len, ", ed %.2f", > + gt->gpu_top.ring[n].running); Hmm, I would like to compact this down to "%% busy (%.2f / %.2f / %.2f)" with execution, runnable, queued respectively. -Chris _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
* [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load 2018-02-12 19:01 [igt-dev] [PATCH i-g-t 0/2] intel-gpu-overlay: Queued/runnable/running engine stats Tvrtko Ursulin 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats Tvrtko Ursulin @ 2018-02-12 19:01 ` Tvrtko Ursulin 2018-02-12 21:00 ` Chris Wilson ` (2 more replies) 2018-02-12 19:39 ` [igt-dev] ✗ Fi.CI.BAT: failure for intel-gpu-overlay: Queued/runnable/running engine stats Patchwork 2 siblings, 3 replies; 8+ messages in thread From: Tvrtko Ursulin @ 2018-02-12 19:01 UTC (permalink / raw) To: igt-dev; +Cc: Tvrtko Ursulin From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Show total GPU loads in the window banner. Engine load is defined as total of runnable and running requests on an engine. Total, non-normalized, load is display. In other words if N engines are busy with exactly one request, the load will be shown as N. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- overlay/gpu-top.c | 37 ++++++++++++++++++++++++++++++++++++- overlay/gpu-top.h | 10 +++++++++- overlay/overlay.c | 27 +++++++++++++++++++-------- 3 files changed, 64 insertions(+), 10 deletions(-) diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index 22e9badb22c1..ca25e998e3d7 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -290,17 +290,35 @@ static void mmio_init(struct gpu_top *gt) } } -void gpu_top_init(struct gpu_top *gt) +void gpu_top_init(struct gpu_top *gt, unsigned int period_us) { + const double period = (double)period_us / 1e6; + const double load_period[NUM_LOADS] = { 1.0, 30.0, 900.0 }; + const char *load_names[NUM_LOADS] = { "1s", "30s", "15m" }; + unsigned int i; + memset(gt, 0, sizeof(*gt)); gt->fd = -1; + for (i = 0; i < NUM_LOADS; i++) { + gt->load_name[i] = load_names[i]; + gt->exp[i] = period / load_period[i]; + } + if (perf_init(gt) == 0) return; mmio_init(gt); } +static double update_load(double load, double exp, double val) +{ + load *= 1.0 - exp; + load += exp * val; + + return load; +} + int gpu_top_update(struct gpu_top *gt) { uint32_t data[1024]; @@ -313,6 +331,8 @@ int gpu_top_update(struct gpu_top *gt) struct gpu_top_stat *s = >->stat[gt->count++&1]; struct gpu_top_stat *d = >->stat[gt->count&1]; uint64_t *sample, d_time; + double gpu_qd = 0.0; + unsigned int i; int n, m; len = read(gt->fd, data, sizeof(data)); @@ -341,6 +361,8 @@ int gpu_top_update(struct gpu_top *gt) d_time = s->time - d->time; for (n = 0; n < gt->num_rings; n++) { + double qd = 0.0; + gt->ring[n].u.u.busy = (100 * (s->busy[n] - d->busy[n]) + d_time/2) / d_time; if (gt->have_wait) gt->ring[n].u.u.wait = (100 * (s->wait[n] - d->wait[n]) + d_time/2) / d_time; @@ -353,6 +375,14 @@ int gpu_top_update(struct gpu_top *gt) if (gt->have_running) gt->ring[n].running = (double)((s->running[n] - d->running[n])) / I915_SAMPLE_RUNNING_DIVISOR * 1e9 / d_time; + qd = gt->ring[n].runnable + gt->ring[n].running; + gpu_qd += qd; + + for (i = 0; i < NUM_LOADS; i++) + gt->ring[n].load[i] = + update_load(gt->ring[n].load[i], + gt->exp[i], qd); + /* in case of rounding + sampling errors, fudge */ if (gt->ring[n].u.u.busy > 100) gt->ring[n].u.u.busy = 100; @@ -362,6 +392,11 @@ int gpu_top_update(struct gpu_top *gt) gt->ring[n].u.u.sema = 100; } + for (i = 0; i < NUM_LOADS; i++) { + gt->load[i] = update_load(gt->load[i], gt->exp[i], + gpu_qd); + gt->norm_load[i] = gt->load[i] / gt->num_rings; + } update = 1; } else { while ((len = read(gt->fd, data, sizeof(data))) > 0) { diff --git a/overlay/gpu-top.h b/overlay/gpu-top.h index cb4310c82a94..8fc617ce8492 100644 --- a/overlay/gpu-top.h +++ b/overlay/gpu-top.h @@ -26,6 +26,7 @@ #define GPU_TOP_H #define MAX_RINGS 16 +#define NUM_LOADS 3 #include <stdint.h> @@ -40,6 +41,11 @@ struct gpu_top { int have_runnable; int have_running; + double exp[NUM_LOADS]; + double load[NUM_LOADS]; + double norm_load[NUM_LOADS]; + const char *load_name[NUM_LOADS]; + struct gpu_top_ring { const char *name; union gpu_top_payload { @@ -54,6 +60,8 @@ struct gpu_top { double queued; double runnable; double running; + + double load[NUM_LOADS]; } ring[MAX_RINGS]; struct gpu_top_stat { @@ -69,7 +77,7 @@ struct gpu_top { int count; }; -void gpu_top_init(struct gpu_top *gt); +void gpu_top_init(struct gpu_top *gt, unsigned int period_us); int gpu_top_update(struct gpu_top *gt); #endif /* GPU_TOP_H */ diff --git a/overlay/overlay.c b/overlay/overlay.c index a639703ebcec..30f712e4415a 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -141,7 +141,8 @@ struct overlay_context { }; static void init_gpu_top(struct overlay_context *ctx, - struct overlay_gpu_top *gt) + struct overlay_gpu_top *gt, + unsigned int period_us) { const double rgba[][4] = { { 1, 0.25, 0.25, 1 }, @@ -152,7 +153,7 @@ static void init_gpu_top(struct overlay_context *ctx, int n; cpu_top_init(>->cpu_top); - gpu_top_init(>->gpu_top); + gpu_top_init(>->gpu_top, period_us); chart_init(>->cpu, "CPU", 120); chart_set_position(>->cpu, PAD, PAD); @@ -929,13 +930,13 @@ int main(int argc, char **argv) debugfs_init(); - init_gpu_top(&ctx, &ctx.gpu_top); + sample_period = get_sample_period(&config); + + init_gpu_top(&ctx, &ctx.gpu_top, sample_period); init_gpu_perf(&ctx, &ctx.gpu_perf); init_gpu_freq(&ctx, &ctx.gpu_freq); init_gem_objects(&ctx, &ctx.gem_objects); - sample_period = get_sample_period(&config); - i = 0; while (1) { ctx.time = time(NULL); @@ -951,16 +952,26 @@ int main(int argc, char **argv) show_gem_objects(&ctx, &ctx.gem_objects); { - char buf[80]; + struct gpu_top *gt = &ctx.gpu_top.gpu_top; + char buf[80], buf2[256]; cairo_text_extents_t extents; + gethostname(buf, sizeof(buf)); + snprintf(buf2, sizeof(buf2), + "%s; %u engines; load-avg %s %.2f, %s %.2f, %s %.2f", + buf, + gt->num_rings, + gt->load_name[0], gt->load[0], + gt->load_name[1], gt->load[1], + gt->load_name[2], gt->load[2]); + cairo_set_source_rgb(ctx.cr, .5, .5, .5); cairo_set_font_size(ctx.cr, PAD-2); - cairo_text_extents(ctx.cr, buf, &extents); + cairo_text_extents(ctx.cr, buf2, &extents); cairo_move_to(ctx.cr, (ctx.width-extents.width)/2., 1+extents.height); - cairo_show_text(ctx.cr, buf); + cairo_show_text(ctx.cr, buf2); } cairo_destroy(ctx.cr); -- 2.14.1 _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin @ 2018-02-12 21:00 ` Chris Wilson 2018-02-13 10:46 ` Chris Wilson 2018-02-13 11:19 ` Chris Wilson 2 siblings, 0 replies; 8+ messages in thread From: Chris Wilson @ 2018-02-12 21:00 UTC (permalink / raw) To: Tvrtko Ursulin, igt-dev; +Cc: Tvrtko Ursulin Quoting Tvrtko Ursulin (2018-02-12 19:01:58) > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Show total GPU loads in the window banner. > > Engine load is defined as total of runnable and running requests on an > engine. > > Total, non-normalized, load is display. In other words if N engines are > busy with exactly one request, the load will be shown as N. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- All matches my understanding, at least :) > @@ -951,16 +952,26 @@ int main(int argc, char **argv) > show_gem_objects(&ctx, &ctx.gem_objects); > > { > - char buf[80]; > + struct gpu_top *gt = &ctx.gpu_top.gpu_top; > + char buf[80], buf2[256]; > cairo_text_extents_t extents; > + > gethostname(buf, sizeof(buf)); len = strlen(buf); snprintf(buf + len, sizeof(buf) - len, ? -Chris _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin 2018-02-12 21:00 ` Chris Wilson @ 2018-02-13 10:46 ` Chris Wilson 2018-02-13 11:19 ` Chris Wilson 2 siblings, 0 replies; 8+ messages in thread From: Chris Wilson @ 2018-02-13 10:46 UTC (permalink / raw) To: Tvrtko Ursulin, igt-dev; +Cc: Tvrtko Ursulin Quoting Tvrtko Ursulin (2018-02-12 19:01:58) > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Show total GPU loads in the window banner. > > Engine load is defined as total of runnable and running requests on an > engine. > > Total, non-normalized, load is display. In other words if N engines are > busy with exactly one request, the load will be shown as N. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- > overlay/gpu-top.c | 37 ++++++++++++++++++++++++++++++++++++- > overlay/gpu-top.h | 10 +++++++++- > overlay/overlay.c | 27 +++++++++++++++++++-------- > 3 files changed, 64 insertions(+), 10 deletions(-) > > diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c > index 22e9badb22c1..ca25e998e3d7 100644 > --- a/overlay/gpu-top.c > +++ b/overlay/gpu-top.c > @@ -290,17 +290,35 @@ static void mmio_init(struct gpu_top *gt) > } > } > > -void gpu_top_init(struct gpu_top *gt) > +void gpu_top_init(struct gpu_top *gt, unsigned int period_us) > { > + const double period = (double)period_us / 1e6; > + const double load_period[NUM_LOADS] = { 1.0, 30.0, 900.0 }; > + const char *load_names[NUM_LOADS] = { "1s", "30s", "15m" }; > + unsigned int i; > + > memset(gt, 0, sizeof(*gt)); > gt->fd = -1; > > + for (i = 0; i < NUM_LOADS; i++) { > + gt->load_name[i] = load_names[i]; > + gt->exp[i] = period / load_period[i]; > + } > + > if (perf_init(gt) == 0) > return; > > mmio_init(gt); > } > > +static double update_load(double load, double exp, double val) > +{ > + load *= 1.0 - exp; > + load += exp * val; > + > + return load; > +} > + > int gpu_top_update(struct gpu_top *gt) > { > uint32_t data[1024]; > @@ -313,6 +331,8 @@ int gpu_top_update(struct gpu_top *gt) > struct gpu_top_stat *s = >->stat[gt->count++&1]; > struct gpu_top_stat *d = >->stat[gt->count&1]; > uint64_t *sample, d_time; > + double gpu_qd = 0.0; > + unsigned int i; > int n, m; > > len = read(gt->fd, data, sizeof(data)); > @@ -341,6 +361,8 @@ int gpu_top_update(struct gpu_top *gt) > > d_time = s->time - d->time; > for (n = 0; n < gt->num_rings; n++) { > + double qd = 0.0; > + > gt->ring[n].u.u.busy = (100 * (s->busy[n] - d->busy[n]) + d_time/2) / d_time; > if (gt->have_wait) > gt->ring[n].u.u.wait = (100 * (s->wait[n] - d->wait[n]) + d_time/2) / d_time; > @@ -353,6 +375,14 @@ int gpu_top_update(struct gpu_top *gt) > if (gt->have_running) > gt->ring[n].running = (double)((s->running[n] - d->running[n])) / I915_SAMPLE_RUNNING_DIVISOR * 1e9 / d_time; > > + qd = gt->ring[n].runnable + gt->ring[n].running; > + gpu_qd += qd; > + > + for (i = 0; i < NUM_LOADS; i++) > + gt->ring[n].load[i] = > + update_load(gt->ring[n].load[i], > + gt->exp[i], qd); > + > /* in case of rounding + sampling errors, fudge */ > if (gt->ring[n].u.u.busy > 100) > gt->ring[n].u.u.busy = 100; > @@ -362,6 +392,11 @@ int gpu_top_update(struct gpu_top *gt) > gt->ring[n].u.u.sema = 100; > } > > + for (i = 0; i < NUM_LOADS; i++) { > + gt->load[i] = update_load(gt->load[i], gt->exp[i], > + gpu_qd); > + gt->norm_load[i] = gt->load[i] / gt->num_rings; > + } > update = 1; > } else { > while ((len = read(gt->fd, data, sizeof(data))) > 0) { > diff --git a/overlay/gpu-top.h b/overlay/gpu-top.h > index cb4310c82a94..8fc617ce8492 100644 > --- a/overlay/gpu-top.h > +++ b/overlay/gpu-top.h > @@ -26,6 +26,7 @@ > #define GPU_TOP_H > > #define MAX_RINGS 16 > +#define NUM_LOADS 3 > > #include <stdint.h> > > @@ -40,6 +41,11 @@ struct gpu_top { > int have_runnable; > int have_running; > > + double exp[NUM_LOADS]; > + double load[NUM_LOADS]; > + double norm_load[NUM_LOADS]; > + const char *load_name[NUM_LOADS]; > + > struct gpu_top_ring { > const char *name; > union gpu_top_payload { > @@ -54,6 +60,8 @@ struct gpu_top { > double queued; > double runnable; > double running; > + > + double load[NUM_LOADS]; > } ring[MAX_RINGS]; > > struct gpu_top_stat { > @@ -69,7 +77,7 @@ struct gpu_top { > int count; > }; > > -void gpu_top_init(struct gpu_top *gt); > +void gpu_top_init(struct gpu_top *gt, unsigned int period_us); > int gpu_top_update(struct gpu_top *gt); > > #endif /* GPU_TOP_H */ > diff --git a/overlay/overlay.c b/overlay/overlay.c > index a639703ebcec..30f712e4415a 100644 > --- a/overlay/overlay.c > +++ b/overlay/overlay.c > @@ -141,7 +141,8 @@ struct overlay_context { > }; > > static void init_gpu_top(struct overlay_context *ctx, > - struct overlay_gpu_top *gt) > + struct overlay_gpu_top *gt, > + unsigned int period_us) > { > const double rgba[][4] = { > { 1, 0.25, 0.25, 1 }, > @@ -152,7 +153,7 @@ static void init_gpu_top(struct overlay_context *ctx, > int n; > > cpu_top_init(>->cpu_top); > - gpu_top_init(>->gpu_top); > + gpu_top_init(>->gpu_top, period_us); > > chart_init(>->cpu, "CPU", 120); > chart_set_position(>->cpu, PAD, PAD); > @@ -929,13 +930,13 @@ int main(int argc, char **argv) > > debugfs_init(); > > - init_gpu_top(&ctx, &ctx.gpu_top); > + sample_period = get_sample_period(&config); > + > + init_gpu_top(&ctx, &ctx.gpu_top, sample_period); > init_gpu_perf(&ctx, &ctx.gpu_perf); > init_gpu_freq(&ctx, &ctx.gpu_freq); > init_gem_objects(&ctx, &ctx.gem_objects); > > - sample_period = get_sample_period(&config); > - > i = 0; > while (1) { > ctx.time = time(NULL); > @@ -951,16 +952,26 @@ int main(int argc, char **argv) > show_gem_objects(&ctx, &ctx.gem_objects); > > { > - char buf[80]; > + struct gpu_top *gt = &ctx.gpu_top.gpu_top; > + char buf[80], buf2[256]; > cairo_text_extents_t extents; > + > gethostname(buf, sizeof(buf)); > + snprintf(buf2, sizeof(buf2), > + "%s; %u engines; load-avg %s %.2f, %s %.2f, %s %.2f", > + buf, > + gt->num_rings, > + gt->load_name[0], gt->load[0], > + gt->load_name[1], gt->load[1], > + gt->load_name[2], gt->load[2]); Too much text :) "%s: %u engines, load %.2f %.2f %.2f" worksforme diff --git a/overlay/overlay.c b/overlay/overlay.c index 30f712e4..91f8d523 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -953,25 +953,27 @@ int main(int argc, char **argv) { struct gpu_top *gt = &ctx.gpu_top.gpu_top; - char buf[80], buf2[256]; cairo_text_extents_t extents; + char buf[256]; gethostname(buf, sizeof(buf)); - snprintf(buf2, sizeof(buf2), - "%s; %u engines; load-avg %s %.2f, %s %.2f, %s %.2f", - buf, - gt->num_rings, - gt->load_name[0], gt->load[0], - gt->load_name[1], gt->load[1], - gt->load_name[2], gt->load[2]); + if (gt->load[2] > 0) { /* gt->has_load_avg */ + int len = strlen(buf); + snprintf(buf + len, sizeof(buf) - len, + ": %u engines, load %.2f %.2f %.2f", + gt->num_rings, + gt->load[0], + gt->load[1], + gt->load[2]); + } cairo_set_source_rgb(ctx.cr, .5, .5, .5); cairo_set_font_size(ctx.cr, PAD-2); - cairo_text_extents(ctx.cr, buf2, &extents); + cairo_text_extents(ctx.cr, buf, &extents); cairo_move_to(ctx.cr, (ctx.width-extents.width)/2., 1+extents.height); - cairo_show_text(ctx.cr, buf2); + cairo_show_text(ctx.cr, buf); } cairo_destroy(ctx.cr); _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin 2018-02-12 21:00 ` Chris Wilson 2018-02-13 10:46 ` Chris Wilson @ 2018-02-13 11:19 ` Chris Wilson 2 siblings, 0 replies; 8+ messages in thread From: Chris Wilson @ 2018-02-13 11:19 UTC (permalink / raw) To: Tvrtko Ursulin, igt-dev; +Cc: Tvrtko Ursulin Quoting Tvrtko Ursulin (2018-02-12 19:01:58) > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > > Show total GPU loads in the window banner. > > Engine load is defined as total of runnable and running requests on an > engine. > > Total, non-normalized, load is display. In other words if N engines are > busy with exactly one request, the load will be shown as N. > > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- > overlay/gpu-top.c | 37 ++++++++++++++++++++++++++++++++++++- > overlay/gpu-top.h | 10 +++++++++- > overlay/overlay.c | 27 +++++++++++++++++++-------- > 3 files changed, 64 insertions(+), 10 deletions(-) > > diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c > index 22e9badb22c1..ca25e998e3d7 100644 > --- a/overlay/gpu-top.c > +++ b/overlay/gpu-top.c > @@ -290,17 +290,35 @@ static void mmio_init(struct gpu_top *gt) > } > } > > -void gpu_top_init(struct gpu_top *gt) > +void gpu_top_init(struct gpu_top *gt, unsigned int period_us) > { > + const double period = (double)period_us / 1e6; > + const double load_period[NUM_LOADS] = { 1.0, 30.0, 900.0 }; > + const char *load_names[NUM_LOADS] = { "1s", "30s", "15m" }; > + unsigned int i; > + > memset(gt, 0, sizeof(*gt)); > gt->fd = -1; > > + for (i = 0; i < NUM_LOADS; i++) { > + gt->load_name[i] = load_names[i]; > + gt->exp[i] = period / load_period[i]; > + } > + > if (perf_init(gt) == 0) > return; > > mmio_init(gt); > } > > +static double update_load(double load, double exp, double val) > +{ > + load *= 1.0 - exp; > + load += exp * val; > + > + return load; > +} I think you forgot the exp() here... diff --git a/overlay/gpu-top.c b/overlay/gpu-top.c index ca25e998..e40766fe 100644 --- a/overlay/gpu-top.c +++ b/overlay/gpu-top.c @@ -29,6 +29,7 @@ #include <unistd.h> #include <fcntl.h> #include <errno.h> +#include <math.h> #include <assert.h> #include "igt_perf.h" @@ -302,7 +303,7 @@ void gpu_top_init(struct gpu_top *gt, unsigned int period_us) for (i = 0; i < NUM_LOADS; i++) { gt->load_name[i] = load_names[i]; - gt->exp[i] = period / load_period[i]; + gt->exp[i] = exp(-period / load_period[i]); } if (perf_init(gt) == 0) @@ -313,10 +314,7 @@ void gpu_top_init(struct gpu_top *gt, unsigned int period_us) static double update_load(double load, double exp, double val) { - load *= 1.0 - exp; - load += exp * val; - - return load; + return val + exp * (load - val); } stops the loadavg from claiming to over 1M :) -Chris _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for intel-gpu-overlay: Queued/runnable/running engine stats 2018-02-12 19:01 [igt-dev] [PATCH i-g-t 0/2] intel-gpu-overlay: Queued/runnable/running engine stats Tvrtko Ursulin 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats Tvrtko Ursulin 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin @ 2018-02-12 19:39 ` Patchwork 2 siblings, 0 replies; 8+ messages in thread From: Patchwork @ 2018-02-12 19:39 UTC (permalink / raw) To: Tvrtko Ursulin; +Cc: igt-dev == Series Details == Series: intel-gpu-overlay: Queued/runnable/running engine stats URL : https://patchwork.freedesktop.org/series/38101/ State : failure == Summary == IGT patchset tested on top of latest successful build 3f62e3da85b792ff74c0420e62f2d39a09ddcc1f tests/kms_rotation_crc: Test all pixel formats on all planes. with latest DRM-Tip kernel build CI_DRM_3757 83878f486e68 drm-tip: 2018y-02m-12d-17h-43m-07s UTC integration manifest No testlist changes. Test kms_pipe_crc_basic: Subgroup suspend-read-crc-pipe-b: pass -> INCOMPLETE (fi-snb-2520m) fdo#103713 Test prime_vgem: Subgroup basic-fence-flip: fail -> PASS (fi-ilk-650) pass -> FAIL (fi-hsw-4770) fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713 fi-bdw-5557u total:288 pass:265 dwarn:0 dfail:0 fail:2 skip:21 time:440s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:427s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:377s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:493s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:290s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:485s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:492s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:474s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:465s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:573s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:577s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:418s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:286s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:516s fi-hsw-4770 total:288 pass:258 dwarn:0 dfail:0 fail:3 skip:27 time:413s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:414s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:461s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:416s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:459s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:493s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:501s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:595s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:428s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:506s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:529s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:487s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:480s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:419s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:430s fi-snb-2520m total:245 pass:211 dwarn:0 dfail:0 fail:0 skip:33 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:410s Blacklisted hosts: fi-glk-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:474s == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_904/issues.html _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-02-13 11:19 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-02-12 19:01 [igt-dev] [PATCH i-g-t 0/2] intel-gpu-overlay: Queued/runnable/running engine stats Tvrtko Ursulin 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 1/2] intel-gpu-overlay: Add engine queue stats Tvrtko Ursulin 2018-02-13 10:49 ` Chris Wilson 2018-02-12 19:01 ` [igt-dev] [PATCH i-g-t 2/2] intel-gpu-overlay: Show 1s, 30s and 15m GPU load Tvrtko Ursulin 2018-02-12 21:00 ` Chris Wilson 2018-02-13 10:46 ` Chris Wilson 2018-02-13 11:19 ` Chris Wilson 2018-02-12 19:39 ` [igt-dev] ✗ Fi.CI.BAT: failure for intel-gpu-overlay: Queued/runnable/running engine stats Patchwork
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox