From patchwork Wed Jun 6 12:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10450171 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3C0DA60375 for ; Wed, 6 Jun 2018 12:50:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2639929C35 for ; Wed, 6 Jun 2018 12:50:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AFEC294C3; Wed, 6 Jun 2018 12:50:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DC9929D5C for ; Wed, 6 Jun 2018 12:49:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36E986F002; Wed, 6 Jun 2018 12:49:19 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 46A9E6F000 for ; Wed, 6 Jun 2018 12:49:18 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id v16-v6so11293098wmh.5 for ; Wed, 06 Jun 2018 05:49:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jVCouqac4HASZ43tMJzWkI+GfgbSX7lwvDUnvEvefLI=; b=GH0L3YQu/msh8mvmGRXXougSV8viTAXd9nIsT3TsI54Uvj1HFATpmr/YHWZ94haPbr hZZ8sqvgV6Iw8TRRhBoKhQo9gsTHfRGB5nYtzCUizm8IFpQxZ7swIbnu8oxlk8OySQy/ 2Y6J53QBUHz7iifsulMK9EnbnmFRWraywR/xmplmEkfaxFvnryHZlB0Y/WpJ0n4LPRlV KbKg7MGuA7T8vKLJs16S0DiIp7R+bQMtSDLlYH/CM/ieGOMsp2LvnrloBEmOapNApbPO iXMSyhLophIOCPBsw/TNBmsGfpSTzDD0CoPH25T09JF4K2h1LsbSg2kMIdkLFEQV4wL7 VEJg== X-Gm-Message-State: APt69E0kH+MBUWOqWca0Y5Z/9IHKGDDoMlfmJ6rLktNW5Fc/jzP6m+mK gJcL7x8+TgTSXGtkZT5dBDZTaw== X-Google-Smtp-Source: ADUXVKJEqc0PNsVoMyH+v0mfWILOW7WMQZcTdbbW2KxbqHsqYPNwQYicaGt3RX+HUXMDe0jpaz2Q3A== X-Received: by 2002:a1c:e90f:: with SMTP id q15-v6mr1810706wmc.149.1528289356912; Wed, 06 Jun 2018 05:49:16 -0700 (PDT) Received: from localhost.localdomain ([95.146.151.144]) by smtp.gmail.com with ESMTPSA id x5-v6sm19616176wrr.3.2018.06.06.05.49.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 05:49:16 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Wed, 6 Jun 2018 13:49:03 +0100 Message-Id: <20180606124907.13139-3-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180606124907.13139-1-tvrtko.ursulin@linux.intel.com> References: <20180606124907.13139-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/6] intel-gpu-overlay: Add engine queue stats X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Use new PMU engine queue stats (queued, runnable and running) and display them per engine. v2: * Compact per engine stats. (Chris Wilson) Signed-off-by: Tvrtko Ursulin --- overlay/gpu-top.c | 42 ++++++++++++++++++++++++++++++++++++++++++ overlay/gpu-top.h | 11 +++++++++++ overlay/overlay.c | 7 +++++++ 3 files changed, 60 insertions(+) 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 eae5ddfa8823..7087d5e5b24e 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -256,6 +256,13 @@ 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 && + gt->gpu_top.have_runnable && + gt->gpu_top.have_running) + len += sprintf(txt + len, " (%.2f / %.2f / %.2f)", + gt->gpu_top.ring[n].queued, + gt->gpu_top.ring[n].runnable, + 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);