From patchwork Thu Apr 5 12:40:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10324531 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 5346460545 for ; Thu, 5 Apr 2018 12:40:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44D3129186 for ; Thu, 5 Apr 2018 12:40:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 386692918E; Thu, 5 Apr 2018 12:40:47 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 C44DB29192 for ; Thu, 5 Apr 2018 12:40:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 979376E771; Thu, 5 Apr 2018 12:40:44 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 431936E71D for ; Thu, 5 Apr 2018 12:40:40 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id m13so28165443wrj.5 for ; Thu, 05 Apr 2018 05:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OC4BOKOtG4VSA4IcAvtuN/6Kp4FK0c1CfcetTGZUJ/Q=; b=hhjmy1HJRbM4syJbclW1AcoCtU3lag3W6YpgitPnv5M2HRjCnC1NxcQrzIxBiyrFUZ REE5W4GJmr2Nha/zoiYicebzhfXH5/RMrncJvk8PSbt/Dspv0yyedLDJGCb+CbCHyByI CcuU7J1zJQDEZlOFJRZx2ZD2zsvI0jE/1jWGSgJVuJqex/Zy5HdTtK7sUQs9hRQXkWVD hvsCtBEltELC6Rt0D72XiCw/QxHgmNKz7maF9aA6l+OCVkpQRJgNe7/yPja9xb+2UJVA 7z8tmL64qoctbiCJIZk5bKOmbx81eVKyl6X919ZUZZtMXTAWZPs/ikjBUo6+hGBuG8xu YVvw== 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=OC4BOKOtG4VSA4IcAvtuN/6Kp4FK0c1CfcetTGZUJ/Q=; b=nQfzaDgMoWYGtQnFfyEtKCDjcfnFQI4traC7p/He9fIyjKghMeCUpynm17yhbfv5bW m6RawBFnpweNbJRV3rL5uTbHquvfXDK5fMBc6hgmA+lXlQCycl166zgQ0OQbsA4HhYfj O6FOnBjzAqG7vNxnfEOI1R89ldrBzxhnT8jKOFCrgsjGiAKYDWaatm5LHnaZOe4ZuQlL MBg5Wx3MQBvxPkC075GuDPltKtEIT+rcNlTK+fP5ZsVY1J2eVLhBm50EIN4v/RjX6UPQ frU1MeQOEoBGclaGrmNlrRII3oR//MbILF+6SuK8O/mpJ/+rUMJfWavu2mbbDtTAbki0 FMDw== X-Gm-Message-State: AElRT7EIx67526zXTim/L5qhNGHCcKpcKwA0fWCAqiQQi/7jk4aaY41j ByD3YOiF8bYXWT2IRwRHX330Qw== X-Google-Smtp-Source: AIpwx4/kCb8td38TFZRsraqYllqtmiP1ra3iqvaKFZwb5sHs4GQ+wKrTsQn2ahaTrB6nf+TFJHaUsA== X-Received: by 10.223.172.226 with SMTP id o89mr14912409wrc.264.1522932038920; Thu, 05 Apr 2018 05:40:38 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id i44sm4796068wri.23.2018.04.05.05.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Apr 2018 05:40:38 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 5 Apr 2018 13:40:25 +0100 Message-Id: <20180405124028.22766-3-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180405124028.22766-1-tvrtko.ursulin@linux.intel.com> References: <20180405124028.22766-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/5] 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 545af7bcb2f5..d3755397061b 100644 --- a/overlay/overlay.c +++ b/overlay/overlay.c @@ -255,6 +255,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);