All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-14 12:17 ` Tvrtko Ursulin
  0 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-14 12:17 UTC (permalink / raw)
  To: igt-dev, Intel-gfx

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

On a slow machine, or with many processes and/or file descriptors to
parse, the period of the scanning loop can drift significantly from the
assumed value. This results in artificially inflated client busyness
percentages.

To alleviate the issue take some real timestamps and use actual elapsed
time when calculating relative busyness.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index e13e35b71f4b..af4b350da8e4 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -43,6 +43,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <termios.h>
+#include <time.h>
 #include <sys/sysmacros.h>
 
 #include "igt_perf.h"
@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
 "\n");
 }
 
+static int gettime(struct timespec *ts)
+{
+	memset(ts, 0, sizeof(*ts));
+
+#ifdef CLOCK_MONOTONIC_RAW
+	if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
+		return 0;
+#endif
+#ifdef CLOCK_MONOTONIC_COARSE
+	if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
+		return 0;
+#endif
+
+	return clock_gettime(CLOCK_MONOTONIC, ts);
+}
+
+static unsigned long elapsed_us(struct timespec *prev, unsigned int period_us)
+{
+	unsigned long elapsed;
+	struct timespec now;
+
+	if (gettime(&now))
+		return period_us;
+
+	elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
+	           (unsigned long)USEC_PER_SEC * (now.tv_sec - prev->tv_sec));
+
+	*prev = now;
+
+	return elapsed;
+}
+
 int main(int argc, char **argv)
 {
 	unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
 	char *pmu_device, *opt_device = NULL;
 	struct igt_device_card card;
 	char *codename = NULL;
+	struct timespec ts;
 
 	/* Parse options */
 	while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
 
 	pmu_sample(engines);
 	scan_clients(clients, false);
+	gettime(&ts);
 	codename = igt_device_get_pretty_name(&card, false);
 
 	if (output_mode == JSON)
@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
 	while (!stop_top) {
 		struct clients *disp_clients;
 		bool consumed = false;
+		unsigned int scan_us;
 		int j, lines = 0;
 		struct winsize ws;
 		struct client *c;
@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
 		t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
 
 		disp_clients = scan_clients(clients, true);
+		scan_us = elapsed_us(&ts, period_us);
 
 		if (stop_top)
 			break;
@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
 
 					lines = print_client(c, engines, t,
 							     lines, con_w,
-							     con_h, period_us,
+							     con_h, scan_us,
 							     &class_w);
 				}
 
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-14 12:17 ` Tvrtko Ursulin
  0 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-14 12:17 UTC (permalink / raw)
  To: igt-dev, Intel-gfx; +Cc: Tvrtko Ursulin

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

On a slow machine, or with many processes and/or file descriptors to
parse, the period of the scanning loop can drift significantly from the
assumed value. This results in artificially inflated client busyness
percentages.

To alleviate the issue take some real timestamps and use actual elapsed
time when calculating relative busyness.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index e13e35b71f4b..af4b350da8e4 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -43,6 +43,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <termios.h>
+#include <time.h>
 #include <sys/sysmacros.h>
 
 #include "igt_perf.h"
@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
 "\n");
 }
 
+static int gettime(struct timespec *ts)
+{
+	memset(ts, 0, sizeof(*ts));
+
+#ifdef CLOCK_MONOTONIC_RAW
+	if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
+		return 0;
+#endif
+#ifdef CLOCK_MONOTONIC_COARSE
+	if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
+		return 0;
+#endif
+
+	return clock_gettime(CLOCK_MONOTONIC, ts);
+}
+
+static unsigned long elapsed_us(struct timespec *prev, unsigned int period_us)
+{
+	unsigned long elapsed;
+	struct timespec now;
+
+	if (gettime(&now))
+		return period_us;
+
+	elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
+	           (unsigned long)USEC_PER_SEC * (now.tv_sec - prev->tv_sec));
+
+	*prev = now;
+
+	return elapsed;
+}
+
 int main(int argc, char **argv)
 {
 	unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
 	char *pmu_device, *opt_device = NULL;
 	struct igt_device_card card;
 	char *codename = NULL;
+	struct timespec ts;
 
 	/* Parse options */
 	while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
 
 	pmu_sample(engines);
 	scan_clients(clients, false);
+	gettime(&ts);
 	codename = igt_device_get_pretty_name(&card, false);
 
 	if (output_mode == JSON)
@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
 	while (!stop_top) {
 		struct clients *disp_clients;
 		bool consumed = false;
+		unsigned int scan_us;
 		int j, lines = 0;
 		struct winsize ws;
 		struct client *c;
@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
 		t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
 
 		disp_clients = scan_clients(clients, true);
+		scan_us = elapsed_us(&ts, period_us);
 
 		if (stop_top)
 			break;
@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
 
 					lines = print_client(c, engines, t,
 							     lines, con_w,
-							     con_h, period_us,
+							     con_h, scan_us,
 							     &class_w);
 				}
 
-- 
2.37.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for intel_gpu_top: Use actual period when calculating client busyness
  2023-03-14 12:17 ` [igt-dev] " Tvrtko Ursulin
  (?)
@ 2023-03-14 14:42 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-03-14 14:42 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 3371 bytes --]

== Series Details ==

Series: intel_gpu_top: Use actual period when calculating client busyness
URL   : https://patchwork.freedesktop.org/series/115124/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12857 -> IGTPW_8604
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html

Participating hosts (36 -> 35)
------------------------------

  Missing    (1): fi-snb-2520m 

Known issues
------------

  Here are the changes found in IGTPW_8604 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_chamelium_hpd@common-hpd-after-suspend:
    - bat-adlp-9:         NOTRUN -> [SKIP][1] ([i915#7828])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/bat-adlp-9/igt@kms_chamelium_hpd@common-hpd-after-suspend.html
    - bat-rpls-1:         NOTRUN -> [SKIP][2] ([i915#7828])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/bat-rpls-1/igt@kms_chamelium_hpd@common-hpd-after-suspend.html

  * igt@kms_pipe_crc_basic@suspend-read-crc:
    - bat-rpls-1:         NOTRUN -> [SKIP][3] ([i915#1845])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/bat-rpls-1/igt@kms_pipe_crc_basic@suspend-read-crc.html

  
#### Possible fixes ####

  * igt@i915_selftest@live@gt_heartbeat:
    - fi-cfl-8109u:       [DMESG-FAIL][4] ([i915#5334]) -> [PASS][5]
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/fi-cfl-8109u/igt@i915_selftest@live@gt_heartbeat.html

  * igt@i915_selftest@live@requests:
    - bat-rpls-1:         [ABORT][6] ([i915#4983] / [i915#7694] / [i915#7911] / [i915#7981]) -> [PASS][7]
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/bat-rpls-1/igt@i915_selftest@live@requests.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/bat-rpls-1/igt@i915_selftest@live@requests.html
    - bat-adlp-9:         [ABORT][8] ([i915#7982]) -> [PASS][9]
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/bat-adlp-9/igt@i915_selftest@live@requests.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/bat-adlp-9/igt@i915_selftest@live@requests.html

  
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#7694]: https://gitlab.freedesktop.org/drm/intel/issues/7694
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
  [i915#7981]: https://gitlab.freedesktop.org/drm/intel/issues/7981
  [i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7194 -> IGTPW_8604

  CI-20190529: 20190529
  CI_DRM_12857: 004fefbbf160569f80946d1e516d538b7ecb04f2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8604: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html
  IGT_7194: d22d66efd6211a22d301649b63d58c8c293e0817 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html

[-- Attachment #2: Type: text/html, Size: 4161 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
  2023-03-14 12:17 ` [igt-dev] " Tvrtko Ursulin
@ 2023-03-14 18:25   ` Umesh Nerlige Ramappa
  -1 siblings, 0 replies; 12+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-03-14 18:25 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx

lgtm,

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
>On a slow machine, or with many processes and/or file descriptors to
>parse, the period of the scanning loop can drift significantly from the
>assumed value. This results in artificially inflated client busyness
>percentages.
>
>To alleviate the issue take some real timestamps and use actual elapsed
>time when calculating relative busyness.
>
>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>---
> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 38 insertions(+), 1 deletion(-)
>
>diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>index e13e35b71f4b..af4b350da8e4 100644
>--- a/tools/intel_gpu_top.c
>+++ b/tools/intel_gpu_top.c
>@@ -43,6 +43,7 @@
> #include <sys/types.h>
> #include <unistd.h>
> #include <termios.h>
>+#include <time.h>
> #include <sys/sysmacros.h>
>
> #include "igt_perf.h"
>@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
> "\n");
> }
>
>+static int gettime(struct timespec *ts)
>+{
>+	memset(ts, 0, sizeof(*ts));
>+
>+#ifdef CLOCK_MONOTONIC_RAW
>+	if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>+		return 0;
>+#endif
>+#ifdef CLOCK_MONOTONIC_COARSE
>+	if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>+		return 0;
>+#endif
>+
>+	return clock_gettime(CLOCK_MONOTONIC, ts);
>+}
>+
>+static unsigned long elapsed_us(struct timespec *prev, unsigned int period_us)
>+{
>+	unsigned long elapsed;
>+	struct timespec now;
>+
>+	if (gettime(&now))
>+		return period_us;
>+
>+	elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>+	           (unsigned long)USEC_PER_SEC * (now.tv_sec - prev->tv_sec));
>+
>+	*prev = now;
>+
>+	return elapsed;
>+}
>+
> int main(int argc, char **argv)
> {
> 	unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
> 	char *pmu_device, *opt_device = NULL;
> 	struct igt_device_card card;
> 	char *codename = NULL;
>+	struct timespec ts;
>
> 	/* Parse options */
> 	while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>
> 	pmu_sample(engines);
> 	scan_clients(clients, false);
>+	gettime(&ts);
> 	codename = igt_device_get_pretty_name(&card, false);
>
> 	if (output_mode == JSON)
>@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
> 	while (!stop_top) {
> 		struct clients *disp_clients;
> 		bool consumed = false;
>+		unsigned int scan_us;
> 		int j, lines = 0;
> 		struct winsize ws;
> 		struct client *c;
>@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
> 		t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>
> 		disp_clients = scan_clients(clients, true);
>+		scan_us = elapsed_us(&ts, period_us);
>
> 		if (stop_top)
> 			break;
>@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>
> 					lines = print_client(c, engines, t,
> 							     lines, con_w,
>-							     con_h, period_us,
>+							     con_h, scan_us,
> 							     &class_w);
> 				}
>
>-- 
>2.37.2
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-14 18:25   ` Umesh Nerlige Ramappa
  0 siblings, 0 replies; 12+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-03-14 18:25 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx

lgtm,

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
>On a slow machine, or with many processes and/or file descriptors to
>parse, the period of the scanning loop can drift significantly from the
>assumed value. This results in artificially inflated client busyness
>percentages.
>
>To alleviate the issue take some real timestamps and use actual elapsed
>time when calculating relative busyness.
>
>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>---
> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 38 insertions(+), 1 deletion(-)
>
>diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>index e13e35b71f4b..af4b350da8e4 100644
>--- a/tools/intel_gpu_top.c
>+++ b/tools/intel_gpu_top.c
>@@ -43,6 +43,7 @@
> #include <sys/types.h>
> #include <unistd.h>
> #include <termios.h>
>+#include <time.h>
> #include <sys/sysmacros.h>
>
> #include "igt_perf.h"
>@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
> "\n");
> }
>
>+static int gettime(struct timespec *ts)
>+{
>+	memset(ts, 0, sizeof(*ts));
>+
>+#ifdef CLOCK_MONOTONIC_RAW
>+	if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>+		return 0;
>+#endif
>+#ifdef CLOCK_MONOTONIC_COARSE
>+	if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>+		return 0;
>+#endif
>+
>+	return clock_gettime(CLOCK_MONOTONIC, ts);
>+}
>+
>+static unsigned long elapsed_us(struct timespec *prev, unsigned int period_us)
>+{
>+	unsigned long elapsed;
>+	struct timespec now;
>+
>+	if (gettime(&now))
>+		return period_us;
>+
>+	elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>+	           (unsigned long)USEC_PER_SEC * (now.tv_sec - prev->tv_sec));
>+
>+	*prev = now;
>+
>+	return elapsed;
>+}
>+
> int main(int argc, char **argv)
> {
> 	unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
> 	char *pmu_device, *opt_device = NULL;
> 	struct igt_device_card card;
> 	char *codename = NULL;
>+	struct timespec ts;
>
> 	/* Parse options */
> 	while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>
> 	pmu_sample(engines);
> 	scan_clients(clients, false);
>+	gettime(&ts);
> 	codename = igt_device_get_pretty_name(&card, false);
>
> 	if (output_mode == JSON)
>@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
> 	while (!stop_top) {
> 		struct clients *disp_clients;
> 		bool consumed = false;
>+		unsigned int scan_us;
> 		int j, lines = 0;
> 		struct winsize ws;
> 		struct client *c;
>@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
> 		t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>
> 		disp_clients = scan_clients(clients, true);
>+		scan_us = elapsed_us(&ts, period_us);
>
> 		if (stop_top)
> 			break;
>@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>
> 					lines = print_client(c, engines, t,
> 							     lines, con_w,
>-							     con_h, period_us,
>+							     con_h, scan_us,
> 							     &class_w);
> 				}
>
>-- 
>2.37.2
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
  2023-03-14 18:25   ` [igt-dev] " Umesh Nerlige Ramappa
@ 2023-03-15  9:20     ` Tvrtko Ursulin
  -1 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-15  9:20 UTC (permalink / raw)
  To: Umesh Nerlige Ramappa; +Cc: igt-dev, Intel-gfx


Hi Umesh,

On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
> lgtm,
> 
> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

Thanks - I had one second thought though. See below please.

> On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> On a slow machine, or with many processes and/or file descriptors to
>> parse, the period of the scanning loop can drift significantly from the
>> assumed value. This results in artificially inflated client busyness
>> percentages.
>>
>> To alleviate the issue take some real timestamps and use actual elapsed
>> time when calculating relative busyness.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 38 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index e13e35b71f4b..af4b350da8e4 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -43,6 +43,7 @@
>> #include <sys/types.h>
>> #include <unistd.h>
>> #include <termios.h>
>> +#include <time.h>
>> #include <sys/sysmacros.h>
>>
>> #include "igt_perf.h"
>> @@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>> "\n");
>> }
>>
>> +static int gettime(struct timespec *ts)
>> +{
>> +    memset(ts, 0, sizeof(*ts));
>> +
>> +#ifdef CLOCK_MONOTONIC_RAW
>> +    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>> +        return 0;
>> +#endif
>> +#ifdef CLOCK_MONOTONIC_COARSE
>> +    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>> +        return 0;
>> +#endif

So I copied this (with some edits) from igt_core.c but I think I should 
actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
intel_gpu_top is not performance sensitive and tick granularity actually 
defeats to point of this patch.

Okay to keep the r-b if I remove it?

Regards,

Tvrtko

>> +
>> +    return clock_gettime(CLOCK_MONOTONIC, ts);
>> +}
>> +
>> +static unsigned long elapsed_us(struct timespec *prev, unsigned int 
>> period_us)
>> +{
>> +    unsigned long elapsed;
>> +    struct timespec now;
>> +
>> +    if (gettime(&now))
>> +        return period_us;
>> +
>> +    elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>> +               (unsigned long)USEC_PER_SEC * (now.tv_sec - 
>> prev->tv_sec));
>> +
>> +    *prev = now;
>> +
>> +    return elapsed;
>> +}
>> +
>> int main(int argc, char **argv)
>> {
>>     unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>> @@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
>>     char *pmu_device, *opt_device = NULL;
>>     struct igt_device_card card;
>>     char *codename = NULL;
>> +    struct timespec ts;
>>
>>     /* Parse options */
>>     while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>> @@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>>
>>     pmu_sample(engines);
>>     scan_clients(clients, false);
>> +    gettime(&ts);
>>     codename = igt_device_get_pretty_name(&card, false);
>>
>>     if (output_mode == JSON)
>> @@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
>>     while (!stop_top) {
>>         struct clients *disp_clients;
>>         bool consumed = false;
>> +        unsigned int scan_us;
>>         int j, lines = 0;
>>         struct winsize ws;
>>         struct client *c;
>> @@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
>>         t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>>
>>         disp_clients = scan_clients(clients, true);
>> +        scan_us = elapsed_us(&ts, period_us);
>>
>>         if (stop_top)
>>             break;
>> @@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>>
>>                     lines = print_client(c, engines, t,
>>                                  lines, con_w,
>> -                                 con_h, period_us,
>> +                                 con_h, scan_us,
>>                                  &class_w);
>>                 }
>>
>> -- 
>> 2.37.2
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-15  9:20     ` Tvrtko Ursulin
  0 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-15  9:20 UTC (permalink / raw)
  To: Umesh Nerlige Ramappa; +Cc: igt-dev, Intel-gfx


Hi Umesh,

On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
> lgtm,
> 
> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>

Thanks - I had one second thought though. See below please.

> On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> On a slow machine, or with many processes and/or file descriptors to
>> parse, the period of the scanning loop can drift significantly from the
>> assumed value. This results in artificially inflated client busyness
>> percentages.
>>
>> To alleviate the issue take some real timestamps and use actual elapsed
>> time when calculating relative busyness.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 38 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index e13e35b71f4b..af4b350da8e4 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -43,6 +43,7 @@
>> #include <sys/types.h>
>> #include <unistd.h>
>> #include <termios.h>
>> +#include <time.h>
>> #include <sys/sysmacros.h>
>>
>> #include "igt_perf.h"
>> @@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>> "\n");
>> }
>>
>> +static int gettime(struct timespec *ts)
>> +{
>> +    memset(ts, 0, sizeof(*ts));
>> +
>> +#ifdef CLOCK_MONOTONIC_RAW
>> +    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>> +        return 0;
>> +#endif
>> +#ifdef CLOCK_MONOTONIC_COARSE
>> +    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>> +        return 0;
>> +#endif

So I copied this (with some edits) from igt_core.c but I think I should 
actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
intel_gpu_top is not performance sensitive and tick granularity actually 
defeats to point of this patch.

Okay to keep the r-b if I remove it?

Regards,

Tvrtko

>> +
>> +    return clock_gettime(CLOCK_MONOTONIC, ts);
>> +}
>> +
>> +static unsigned long elapsed_us(struct timespec *prev, unsigned int 
>> period_us)
>> +{
>> +    unsigned long elapsed;
>> +    struct timespec now;
>> +
>> +    if (gettime(&now))
>> +        return period_us;
>> +
>> +    elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>> +               (unsigned long)USEC_PER_SEC * (now.tv_sec - 
>> prev->tv_sec));
>> +
>> +    *prev = now;
>> +
>> +    return elapsed;
>> +}
>> +
>> int main(int argc, char **argv)
>> {
>>     unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>> @@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
>>     char *pmu_device, *opt_device = NULL;
>>     struct igt_device_card card;
>>     char *codename = NULL;
>> +    struct timespec ts;
>>
>>     /* Parse options */
>>     while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>> @@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>>
>>     pmu_sample(engines);
>>     scan_clients(clients, false);
>> +    gettime(&ts);
>>     codename = igt_device_get_pretty_name(&card, false);
>>
>>     if (output_mode == JSON)
>> @@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
>>     while (!stop_top) {
>>         struct clients *disp_clients;
>>         bool consumed = false;
>> +        unsigned int scan_us;
>>         int j, lines = 0;
>>         struct winsize ws;
>>         struct client *c;
>> @@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
>>         t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>>
>>         disp_clients = scan_clients(clients, true);
>> +        scan_us = elapsed_us(&ts, period_us);
>>
>>         if (stop_top)
>>             break;
>> @@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>>
>>                     lines = print_client(c, engines, t,
>>                                  lines, con_w,
>> -                                 con_h, period_us,
>> +                                 con_h, scan_us,
>>                                  &class_w);
>>                 }
>>
>> -- 
>> 2.37.2
>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for intel_gpu_top: Use actual period when calculating client busyness
  2023-03-14 12:17 ` [igt-dev] " Tvrtko Ursulin
                   ` (2 preceding siblings ...)
  (?)
@ 2023-03-15 18:46 ` Patchwork
  -1 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2023-03-15 18:46 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 25353 bytes --]

== Series Details ==

Series: intel_gpu_top: Use actual period when calculating client busyness
URL   : https://patchwork.freedesktop.org/series/115124/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12857_full -> IGTPW_8604_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html

Participating hosts (8 -> 8)
------------------------------

  Additional (1): shard-rkl0 
  Missing    (1): shard-tglu0 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_8604_full:

### IGT changes ###

#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * {igt@kms_plane_scaling@planes-downscale-factor-0-25-upscale-0-25}:
    - {shard-tglu}:       NOTRUN -> [SKIP][1] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-10/igt@kms_plane_scaling@planes-downscale-factor-0-25-upscale-0-25.html

  
Known issues
------------

  Here are the changes found in IGTPW_8604_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_fair@basic-none-solo@rcs0:
    - shard-apl:          [PASS][2] -> [FAIL][3] ([i915#2842])
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-apl4/igt@gem_exec_fair@basic-none-solo@rcs0.html
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-apl4/igt@gem_exec_fair@basic-none-solo@rcs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:
    - shard-glk:          [PASS][4] -> [FAIL][5] ([i915#2842])
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-glk6/igt@gem_exec_fair@basic-throttle@rcs0.html
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-glk3/igt@gem_exec_fair@basic-throttle@rcs0.html

  * igt@i915_selftest@live@gt_heartbeat:
    - shard-apl:          [PASS][6] -> [DMESG-FAIL][7] ([i915#5334])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-apl2/igt@i915_selftest@live@gt_heartbeat.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-apl6/igt@i915_selftest@live@gt_heartbeat.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
    - shard-glk:          [PASS][8] -> [FAIL][9] ([i915#2346])
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-glk1/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-glk3/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

  * igt@kms_flip@flip-vs-absolute-wf_vblank@a-hdmi-a2:
    - shard-glk:          [PASS][10] -> [FAIL][11] ([i915#2122])
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-glk3/igt@kms_flip@flip-vs-absolute-wf_vblank@a-hdmi-a2.html
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-glk7/igt@kms_flip@flip-vs-absolute-wf_vblank@a-hdmi-a2.html

  * igt@kms_flip@flip-vs-suspend-interruptible@c-dp1:
    - shard-apl:          [PASS][12] -> [ABORT][13] ([i915#180])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-apl4/igt@kms_flip@flip-vs-suspend-interruptible@c-dp1.html
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-apl6/igt@kms_flip@flip-vs-suspend-interruptible@c-dp1.html

  
#### Possible fixes ####

  * igt@device_reset@unbind-reset-rebind:
    - {shard-rkl}:        [FAIL][14] ([i915#4778]) -> [PASS][15]
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-5/igt@device_reset@unbind-reset-rebind.html
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-4/igt@device_reset@unbind-reset-rebind.html

  * igt@drm_fdinfo@idle@rcs0:
    - {shard-rkl}:        [FAIL][16] ([i915#7742]) -> [PASS][17]
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@drm_fdinfo@idle@rcs0.html
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@drm_fdinfo@idle@rcs0.html

  * igt@gem_ctx_exec@basic-nohangcheck:
    - {shard-rkl}:        [FAIL][18] ([i915#6268]) -> [PASS][19]
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-4/igt@gem_ctx_exec@basic-nohangcheck.html
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gem_ctx_exec@basic-nohangcheck.html

  * igt@gem_ctx_persistence@engines-hang@bcs0:
    - {shard-rkl}:        [SKIP][20] ([i915#6252]) -> [PASS][21]
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-5/igt@gem_ctx_persistence@engines-hang@bcs0.html
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-3/igt@gem_ctx_persistence@engines-hang@bcs0.html

  * igt@gem_exec_fair@basic-none-share@rcs0:
    - {shard-rkl}:        [FAIL][22] ([i915#2842]) -> [PASS][23]
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-2/igt@gem_exec_fair@basic-none-share@rcs0.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gem_exec_fair@basic-none-share@rcs0.html

  * igt@gem_exec_fair@basic-throttle@rcs0:
    - {shard-tglu}:       [FAIL][24] ([i915#2842]) -> [PASS][25]
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-8/igt@gem_exec_fair@basic-throttle@rcs0.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-3/igt@gem_exec_fair@basic-throttle@rcs0.html

  * igt@gem_exec_reloc@basic-gtt-read:
    - {shard-rkl}:        [SKIP][26] ([i915#3281]) -> [PASS][27] +4 similar issues
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-2/igt@gem_exec_reloc@basic-gtt-read.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gem_exec_reloc@basic-gtt-read.html

  * igt@gem_exec_schedule@semaphore-power:
    - {shard-rkl}:        [SKIP][28] ([i915#7276]) -> [PASS][29]
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-2/igt@gem_exec_schedule@semaphore-power.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gem_exec_schedule@semaphore-power.html

  * igt@gem_exec_suspend@basic-s4-devices@lmem0:
    - {shard-dg1}:        [ABORT][30] ([i915#7975]) -> [PASS][31]
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-dg1-14/igt@gem_exec_suspend@basic-s4-devices@lmem0.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-dg1-15/igt@gem_exec_suspend@basic-s4-devices@lmem0.html

  * igt@gem_mmap_wc@set-cache-level:
    - {shard-tglu}:       [SKIP][32] ([i915#1850]) -> [PASS][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@gem_mmap_wc@set-cache-level.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-6/igt@gem_mmap_wc@set-cache-level.html

  * igt@gem_set_tiling_vs_pwrite:
    - {shard-rkl}:        [SKIP][34] ([i915#3282]) -> [PASS][35] +4 similar issues
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-3/igt@gem_set_tiling_vs_pwrite.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gem_set_tiling_vs_pwrite.html

  * igt@gen9_exec_parse@bb-start-out:
    - {shard-rkl}:        [SKIP][36] ([i915#2527]) -> [PASS][37] +5 similar issues
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-4/igt@gen9_exec_parse@bb-start-out.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@gen9_exec_parse@bb-start-out.html

  * igt@i915_pm_rc6_residency@rc6-idle@bcs0:
    - {shard-dg1}:        [FAIL][38] ([i915#3591]) -> [PASS][39] +1 similar issue
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-dg1-14/igt@i915_pm_rc6_residency@rc6-idle@bcs0.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-dg1-13/igt@i915_pm_rc6_residency@rc6-idle@bcs0.html

  * igt@i915_pm_rpm@modeset-lpsp:
    - {shard-tglu}:       [SKIP][40] ([i915#1397]) -> [PASS][41]
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@i915_pm_rpm@modeset-lpsp.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-8/igt@i915_pm_rpm@modeset-lpsp.html

  * igt@i915_pm_rpm@pm-tiling:
    - {shard-rkl}:        [SKIP][42] ([fdo#109308]) -> [PASS][43]
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-2/igt@i915_pm_rpm@pm-tiling.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-6/igt@i915_pm_rpm@pm-tiling.html

  * {igt@i915_power@sanity}:
    - {shard-rkl}:        [SKIP][44] ([i915#7984]) -> [PASS][45]
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@i915_power@sanity.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@i915_power@sanity.html

  * igt@i915_selftest@live@dmabuf:
    - shard-apl:          [DMESG-FAIL][46] ([i915#7562]) -> [PASS][47]
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-apl2/igt@i915_selftest@live@dmabuf.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-apl6/igt@i915_selftest@live@dmabuf.html

  * igt@kms_ccs@pipe-c-bad-aux-stride-y_tiled_gen12_rc_ccs:
    - {shard-tglu}:       [SKIP][48] ([i915#1845] / [i915#7651]) -> [PASS][49] +28 similar issues
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@kms_ccs@pipe-c-bad-aux-stride-y_tiled_gen12_rc_ccs.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-6/igt@kms_ccs@pipe-c-bad-aux-stride-y_tiled_gen12_rc_ccs.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic:
    - {shard-rkl}:        [SKIP][50] ([i915#1845] / [i915#4098]) -> [PASS][51] +24 similar issues
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@kms_cursor_legacy@flip-vs-cursor-atomic.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-6/igt@kms_cursor_legacy@flip-vs-cursor-atomic.html

  * igt@kms_fbcon_fbt@fbc-suspend:
    - shard-apl:          [FAIL][52] ([i915#4767]) -> [PASS][53]
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-apl6/igt@kms_fbcon_fbt@fbc-suspend.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-apl2/igt@kms_fbcon_fbt@fbc-suspend.html

  * igt@kms_frontbuffer_tracking@fbc-tiling-linear:
    - {shard-tglu}:       [SKIP][54] ([i915#1849]) -> [PASS][55] +5 similar issues
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@kms_frontbuffer_tracking@fbc-tiling-linear.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-5/igt@kms_frontbuffer_tracking@fbc-tiling-linear.html

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-pwrite:
    - {shard-rkl}:        [SKIP][56] ([i915#1849] / [i915#4098]) -> [PASS][57] +16 similar issues
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-pwrite.html
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-6/igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-pwrite.html

  * igt@kms_psr@primary_blt:
    - {shard-rkl}:        [SKIP][58] ([i915#1072]) -> [PASS][59] +1 similar issue
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@kms_psr@primary_blt.html
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-6/igt@kms_psr@primary_blt.html

  * igt@kms_rotation_crc@cursor-rotation-180:
    - {shard-tglu}:       [SKIP][60] ([i915#1845]) -> [PASS][61] +2 similar issues
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@kms_rotation_crc@cursor-rotation-180.html
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-4/igt@kms_rotation_crc@cursor-rotation-180.html

  * igt@kms_universal_plane@universal-plane-pipe-d-functional:
    - {shard-tglu}:       [SKIP][62] ([fdo#109274]) -> [PASS][63] +1 similar issue
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-tglu-9/igt@kms_universal_plane@universal-plane-pipe-d-functional.html
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-tglu-8/igt@kms_universal_plane@universal-plane-pipe-d-functional.html

  * igt@prime_self_import@basic-with_one_bo:
    - {shard-rkl}:        [SKIP][64] ([fdo#109315]) -> [PASS][65] +3 similar issues
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-5/igt@prime_self_import@basic-with_one_bo.html
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-3/igt@prime_self_import@basic-with_one_bo.html

  * igt@prime_vgem@basic-write:
    - {shard-rkl}:        [SKIP][66] ([fdo#109295] / [i915#3291] / [i915#3708]) -> [PASS][67]
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-1/igt@prime_vgem@basic-write.html
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@prime_vgem@basic-write.html

  * igt@prime_vgem@coherency-gtt:
    - {shard-rkl}:        [SKIP][68] ([fdo#109295] / [fdo#111656] / [i915#3708]) -> [PASS][69]
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-2/igt@prime_vgem@coherency-gtt.html
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-5/igt@prime_vgem@coherency-gtt.html

  * igt@syncobj_timeline@wait-all-for-submit-delayed-submit:
    - {shard-rkl}:        [SKIP][70] ([i915#2575]) -> [PASS][71] +1 similar issue
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12857/shard-rkl-5/igt@syncobj_timeline@wait-all-for-submit-delayed-submit.html
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/shard-rkl-2/igt@syncobj_timeline@wait-all-for-submit-delayed-submit.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
  [fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
  [fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
  [i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
  [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
  [i915#1722]: https://gitlab.freedesktop.org/drm/intel/issues/1722
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
  [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
  [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
  [i915#1850]: https://gitlab.freedesktop.org/drm/intel/issues/1850
  [i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
  [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
  [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
  [i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
  [i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
  [i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
  [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
  [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
  [i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
  [i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
  [i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
  [i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
  [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
  [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
  [i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
  [i915#3528]: https://gitlab.freedesktop.org/drm/intel/issues/3528
  [i915#3536]: https://gitlab.freedesktop.org/drm/intel/issues/3536
  [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
  [i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
  [i915#3547]: https://gitlab.freedesktop.org/drm/intel/issues/3547
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
  [i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
  [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
  [i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
  [i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
  [i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
  [i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
  [i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
  [i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
  [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
  [i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
  [i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
  [i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
  [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
  [i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
  [i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
  [i915#4778]: https://gitlab.freedesktop.org/drm/intel/issues/4778
  [i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
  [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
  [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
  [i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
  [i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
  [i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
  [i915#4936]: https://gitlab.freedesktop.org/drm/intel/issues/4936
  [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
  [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
  [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
  [i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
  [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
  [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
  [i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
  [i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
  [i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
  [i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
  [i915#5723]: https://gitlab.freedesktop.org/drm/intel/issues/5723
  [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
  [i915#6117]: https://gitlab.freedesktop.org/drm/intel/issues/6117
  [i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
  [i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
  [i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
  [i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
  [i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
  [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
  [i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
  [i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
  [i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
  [i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
  [i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
  [i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
  [i915#7037]: https://gitlab.freedesktop.org/drm/intel/issues/7037
  [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
  [i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
  [i915#7128]: https://gitlab.freedesktop.org/drm/intel/issues/7128
  [i915#7276]: https://gitlab.freedesktop.org/drm/intel/issues/7276
  [i915#7294]: https://gitlab.freedesktop.org/drm/intel/issues/7294
  [i915#7443]: https://gitlab.freedesktop.org/drm/intel/issues/7443
  [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
  [i915#7562]: https://gitlab.freedesktop.org/drm/intel/issues/7562
  [i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
  [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
  [i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
  [i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7957]: https://gitlab.freedesktop.org/drm/intel/issues/7957
  [i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
  [i915#7984]: https://gitlab.freedesktop.org/drm/intel/issues/7984
  [i915#8152]: https://gitlab.freedesktop.org/drm/intel/issues/8152
  [i915#8154]: https://gitlab.freedesktop.org/drm/intel/issues/8154
  [i915#8228]: https://gitlab.freedesktop.org/drm/intel/issues/8228
  [i915#8273]: https://gitlab.freedesktop.org/drm/intel/issues/8273
  [i915#8282]: https://gitlab.freedesktop.org/drm/intel/issues/8282


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7194 -> IGTPW_8604
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_12857: 004fefbbf160569f80946d1e516d538b7ecb04f2 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8604: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html
  IGT_7194: d22d66efd6211a22d301649b63d58c8c293e0817 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8604/index.html

[-- Attachment #2: Type: text/html, Size: 18906 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
  2023-03-15  9:20     ` [igt-dev] " Tvrtko Ursulin
@ 2023-03-15 19:56       ` Umesh Nerlige Ramappa
  -1 siblings, 0 replies; 12+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-03-15 19:56 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx

On Wed, Mar 15, 2023 at 09:20:49AM +0000, Tvrtko Ursulin wrote:
>
>Hi Umesh,
>
>On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
>>lgtm,
>>
>>Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>
>Thanks - I had one second thought though. See below please.
>
>>On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>>>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>>On a slow machine, or with many processes and/or file descriptors to
>>>parse, the period of the scanning loop can drift significantly from the
>>>assumed value. This results in artificially inflated client busyness
>>>percentages.
>>>
>>>To alleviate the issue take some real timestamps and use actual elapsed
>>>time when calculating relative busyness.
>>>
>>>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>---
>>>tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>>>1 file changed, 38 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>>>index e13e35b71f4b..af4b350da8e4 100644
>>>--- a/tools/intel_gpu_top.c
>>>+++ b/tools/intel_gpu_top.c
>>>@@ -43,6 +43,7 @@
>>>#include <sys/types.h>
>>>#include <unistd.h>
>>>#include <termios.h>
>>>+#include <time.h>
>>>#include <sys/sysmacros.h>
>>>
>>>#include "igt_perf.h"
>>>@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>>>"\n");
>>>}
>>>
>>>+static int gettime(struct timespec *ts)
>>>+{
>>>+    memset(ts, 0, sizeof(*ts));
>>>+
>>>+#ifdef CLOCK_MONOTONIC_RAW
>>>+    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>>>+        return 0;
>>>+#endif
>>>+#ifdef CLOCK_MONOTONIC_COARSE
>>>+    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>>>+        return 0;
>>>+#endif
>
>So I copied this (with some edits) from igt_core.c but I think I 
>should actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
>intel_gpu_top is not performance sensitive and tick granularity 
>actually defeats to point of this patch.
>
>Okay to keep the r-b if I remove it?

Sure, okay to keep the R-b.

Regards,
Umesh
>
>Regards,
>
>Tvrtko
>
>>>+
>>>+    return clock_gettime(CLOCK_MONOTONIC, ts);
>>>+}
>>>+
>>>+static unsigned long elapsed_us(struct timespec *prev, unsigned 
>>>int period_us)
>>>+{
>>>+    unsigned long elapsed;
>>>+    struct timespec now;
>>>+
>>>+    if (gettime(&now))
>>>+        return period_us;
>>>+
>>>+    elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>>>+               (unsigned long)USEC_PER_SEC * (now.tv_sec - 
>>>prev->tv_sec));
>>>+
>>>+    *prev = now;
>>>+
>>>+    return elapsed;
>>>+}
>>>+
>>>int main(int argc, char **argv)
>>>{
>>>    unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>>>@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
>>>    char *pmu_device, *opt_device = NULL;
>>>    struct igt_device_card card;
>>>    char *codename = NULL;
>>>+    struct timespec ts;
>>>
>>>    /* Parse options */
>>>    while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>>>@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>>>
>>>    pmu_sample(engines);
>>>    scan_clients(clients, false);
>>>+    gettime(&ts);
>>>    codename = igt_device_get_pretty_name(&card, false);
>>>
>>>    if (output_mode == JSON)
>>>@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
>>>    while (!stop_top) {
>>>        struct clients *disp_clients;
>>>        bool consumed = false;
>>>+        unsigned int scan_us;
>>>        int j, lines = 0;
>>>        struct winsize ws;
>>>        struct client *c;
>>>@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
>>>        t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>>>
>>>        disp_clients = scan_clients(clients, true);
>>>+        scan_us = elapsed_us(&ts, period_us);
>>>
>>>        if (stop_top)
>>>            break;
>>>@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>>>
>>>                    lines = print_client(c, engines, t,
>>>                                 lines, con_w,
>>>-                                 con_h, period_us,
>>>+                                 con_h, scan_us,
>>>                                 &class_w);
>>>                }
>>>
>>>-- 
>>>2.37.2
>>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-15 19:56       ` Umesh Nerlige Ramappa
  0 siblings, 0 replies; 12+ messages in thread
From: Umesh Nerlige Ramappa @ 2023-03-15 19:56 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: igt-dev, Intel-gfx

On Wed, Mar 15, 2023 at 09:20:49AM +0000, Tvrtko Ursulin wrote:
>
>Hi Umesh,
>
>On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
>>lgtm,
>>
>>Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>
>Thanks - I had one second thought though. See below please.
>
>>On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>>>From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>>On a slow machine, or with many processes and/or file descriptors to
>>>parse, the period of the scanning loop can drift significantly from the
>>>assumed value. This results in artificially inflated client busyness
>>>percentages.
>>>
>>>To alleviate the issue take some real timestamps and use actual elapsed
>>>time when calculating relative busyness.
>>>
>>>Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>---
>>>tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>>>1 file changed, 38 insertions(+), 1 deletion(-)
>>>
>>>diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>>>index e13e35b71f4b..af4b350da8e4 100644
>>>--- a/tools/intel_gpu_top.c
>>>+++ b/tools/intel_gpu_top.c
>>>@@ -43,6 +43,7 @@
>>>#include <sys/types.h>
>>>#include <unistd.h>
>>>#include <termios.h>
>>>+#include <time.h>
>>>#include <sys/sysmacros.h>
>>>
>>>#include "igt_perf.h"
>>>@@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>>>"\n");
>>>}
>>>
>>>+static int gettime(struct timespec *ts)
>>>+{
>>>+    memset(ts, 0, sizeof(*ts));
>>>+
>>>+#ifdef CLOCK_MONOTONIC_RAW
>>>+    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>>>+        return 0;
>>>+#endif
>>>+#ifdef CLOCK_MONOTONIC_COARSE
>>>+    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>>>+        return 0;
>>>+#endif
>
>So I copied this (with some edits) from igt_core.c but I think I 
>should actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
>intel_gpu_top is not performance sensitive and tick granularity 
>actually defeats to point of this patch.
>
>Okay to keep the r-b if I remove it?

Sure, okay to keep the R-b.

Regards,
Umesh
>
>Regards,
>
>Tvrtko
>
>>>+
>>>+    return clock_gettime(CLOCK_MONOTONIC, ts);
>>>+}
>>>+
>>>+static unsigned long elapsed_us(struct timespec *prev, unsigned 
>>>int period_us)
>>>+{
>>>+    unsigned long elapsed;
>>>+    struct timespec now;
>>>+
>>>+    if (gettime(&now))
>>>+        return period_us;
>>>+
>>>+    elapsed = ((now.tv_nsec - prev->tv_nsec) / 1000 +
>>>+               (unsigned long)USEC_PER_SEC * (now.tv_sec - 
>>>prev->tv_sec));
>>>+
>>>+    *prev = now;
>>>+
>>>+    return elapsed;
>>>+}
>>>+
>>>int main(int argc, char **argv)
>>>{
>>>    unsigned int period_us = DEFAULT_PERIOD_MS * 1000;
>>>@@ -2537,6 +2570,7 @@ int main(int argc, char **argv)
>>>    char *pmu_device, *opt_device = NULL;
>>>    struct igt_device_card card;
>>>    char *codename = NULL;
>>>+    struct timespec ts;
>>>
>>>    /* Parse options */
>>>    while ((ch = getopt(argc, argv, "o:s:d:pcJLlh")) != -1) {
>>>@@ -2690,6 +2724,7 @@ int main(int argc, char **argv)
>>>
>>>    pmu_sample(engines);
>>>    scan_clients(clients, false);
>>>+    gettime(&ts);
>>>    codename = igt_device_get_pretty_name(&card, false);
>>>
>>>    if (output_mode == JSON)
>>>@@ -2698,6 +2733,7 @@ int main(int argc, char **argv)
>>>    while (!stop_top) {
>>>        struct clients *disp_clients;
>>>        bool consumed = false;
>>>+        unsigned int scan_us;
>>>        int j, lines = 0;
>>>        struct winsize ws;
>>>        struct client *c;
>>>@@ -2720,6 +2756,7 @@ int main(int argc, char **argv)
>>>        t = (double)(engines->ts.cur - engines->ts.prev) / 1e9;
>>>
>>>        disp_clients = scan_clients(clients, true);
>>>+        scan_us = elapsed_us(&ts, period_us);
>>>
>>>        if (stop_top)
>>>            break;
>>>@@ -2757,7 +2794,7 @@ int main(int argc, char **argv)
>>>
>>>                    lines = print_client(c, engines, t,
>>>                                 lines, con_w,
>>>-                                 con_h, period_us,
>>>+                                 con_h, scan_us,
>>>                                 &class_w);
>>>                }
>>>
>>>-- 
>>>2.37.2
>>>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
  2023-03-15 19:56       ` [igt-dev] " Umesh Nerlige Ramappa
@ 2023-03-16  9:04         ` Tvrtko Ursulin
  -1 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-16  9:04 UTC (permalink / raw)
  To: Umesh Nerlige Ramappa; +Cc: igt-dev, Intel-gfx


On 15/03/2023 19:56, Umesh Nerlige Ramappa wrote:
> On Wed, Mar 15, 2023 at 09:20:49AM +0000, Tvrtko Ursulin wrote:
>>
>> Hi Umesh,
>>
>> On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
>>> lgtm,
>>>
>>> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>>
>> Thanks - I had one second thought though. See below please.
>>
>>> On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> On a slow machine, or with many processes and/or file descriptors to
>>>> parse, the period of the scanning loop can drift significantly from the
>>>> assumed value. This results in artificially inflated client busyness
>>>> percentages.
>>>>
>>>> To alleviate the issue take some real timestamps and use actual elapsed
>>>> time when calculating relative busyness.
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> ---
>>>> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>>>> 1 file changed, 38 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>>>> index e13e35b71f4b..af4b350da8e4 100644
>>>> --- a/tools/intel_gpu_top.c
>>>> +++ b/tools/intel_gpu_top.c
>>>> @@ -43,6 +43,7 @@
>>>> #include <sys/types.h>
>>>> #include <unistd.h>
>>>> #include <termios.h>
>>>> +#include <time.h>
>>>> #include <sys/sysmacros.h>
>>>>
>>>> #include "igt_perf.h"
>>>> @@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>>>> "\n");
>>>> }
>>>>
>>>> +static int gettime(struct timespec *ts)
>>>> +{
>>>> +    memset(ts, 0, sizeof(*ts));
>>>> +
>>>> +#ifdef CLOCK_MONOTONIC_RAW
>>>> +    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>>>> +        return 0;
>>>> +#endif
>>>> +#ifdef CLOCK_MONOTONIC_COARSE
>>>> +    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>>>> +        return 0;
>>>> +#endif
>>
>> So I copied this (with some edits) from igt_core.c but I think I 
>> should actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
>> intel_gpu_top is not performance sensitive and tick granularity 
>> actually defeats to point of this patch.
>>
>> Okay to keep the r-b if I remove it?
> 
> Sure, okay to keep the R-b.

Thanks, pushed!

Regards,

Tvrtko

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness
@ 2023-03-16  9:04         ` Tvrtko Ursulin
  0 siblings, 0 replies; 12+ messages in thread
From: Tvrtko Ursulin @ 2023-03-16  9:04 UTC (permalink / raw)
  To: Umesh Nerlige Ramappa; +Cc: igt-dev, Intel-gfx


On 15/03/2023 19:56, Umesh Nerlige Ramappa wrote:
> On Wed, Mar 15, 2023 at 09:20:49AM +0000, Tvrtko Ursulin wrote:
>>
>> Hi Umesh,
>>
>> On 14/03/2023 18:25, Umesh Nerlige Ramappa wrote:
>>> lgtm,
>>>
>>> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>>
>> Thanks - I had one second thought though. See below please.
>>
>>> On Tue, Mar 14, 2023 at 12:17:40PM +0000, Tvrtko Ursulin wrote:
>>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>>
>>>> On a slow machine, or with many processes and/or file descriptors to
>>>> parse, the period of the scanning loop can drift significantly from the
>>>> assumed value. This results in artificially inflated client busyness
>>>> percentages.
>>>>
>>>> To alleviate the issue take some real timestamps and use actual elapsed
>>>> time when calculating relative busyness.
>>>>
>>>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>> ---
>>>> tools/intel_gpu_top.c | 39 ++++++++++++++++++++++++++++++++++++++-
>>>> 1 file changed, 38 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>>>> index e13e35b71f4b..af4b350da8e4 100644
>>>> --- a/tools/intel_gpu_top.c
>>>> +++ b/tools/intel_gpu_top.c
>>>> @@ -43,6 +43,7 @@
>>>> #include <sys/types.h>
>>>> #include <unistd.h>
>>>> #include <termios.h>
>>>> +#include <time.h>
>>>> #include <sys/sysmacros.h>
>>>>
>>>> #include "igt_perf.h"
>>>> @@ -2524,6 +2525,38 @@ static void show_help_screen(void)
>>>> "\n");
>>>> }
>>>>
>>>> +static int gettime(struct timespec *ts)
>>>> +{
>>>> +    memset(ts, 0, sizeof(*ts));
>>>> +
>>>> +#ifdef CLOCK_MONOTONIC_RAW
>>>> +    if (!clock_gettime(CLOCK_MONOTONIC_RAW, ts))
>>>> +        return 0;
>>>> +#endif
>>>> +#ifdef CLOCK_MONOTONIC_COARSE
>>>> +    if (!clock_gettime(CLOCK_MONOTONIC_COARSE, ts))
>>>> +        return 0;
>>>> +#endif
>>
>> So I copied this (with some edits) from igt_core.c but I think I 
>> should actually remove the CLOCK_MONOTONIC_COARSE option. The usage in 
>> intel_gpu_top is not performance sensitive and tick granularity 
>> actually defeats to point of this patch.
>>
>> Okay to keep the r-b if I remove it?
> 
> Sure, okay to keep the R-b.

Thanks, pushed!

Regards,

Tvrtko

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-16  9:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 12:17 [Intel-gfx] [PATCH i-g-t] intel_gpu_top: Use actual period when calculating client busyness Tvrtko Ursulin
2023-03-14 12:17 ` [igt-dev] " Tvrtko Ursulin
2023-03-14 14:42 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2023-03-14 18:25 ` [Intel-gfx] [PATCH i-g-t] " Umesh Nerlige Ramappa
2023-03-14 18:25   ` [igt-dev] " Umesh Nerlige Ramappa
2023-03-15  9:20   ` Tvrtko Ursulin
2023-03-15  9:20     ` [igt-dev] " Tvrtko Ursulin
2023-03-15 19:56     ` Umesh Nerlige Ramappa
2023-03-15 19:56       ` [igt-dev] " Umesh Nerlige Ramappa
2023-03-16  9:04       ` Tvrtko Ursulin
2023-03-16  9:04         ` [igt-dev] " Tvrtko Ursulin
2023-03-15 18:46 ` [igt-dev] ✓ Fi.CI.IGT: success for " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.