diff options
| -rw-r--r-- | man/intel_gpu_top.rst | 10 | ||||
| -rw-r--r-- | tools/intel_gpu_top.c | 19 |
2 files changed, 27 insertions, 2 deletions
diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst index 44a54a5f2..20204fdcf 100644 --- a/man/intel_gpu_top.rst +++ b/man/intel_gpu_top.rst @@ -9,7 +9,7 @@ Display a top-like summary of Intel GPU usage :Author: IGT Developers <igt-dev@lists.freedesktop.org> :Date: 2023-01-27 :Version: |PACKAGE_STRING| -:Copyright: 2009,2011,2012,2016,2018,2019,2020,2023 Intel Corporation +:Copyright: 2009,2011,2012,2016,2018,2019,2020,2023,2025 Intel Corporation :Manual section: |MANUAL_SECTION| :Manual group: |MANUAL_GROUP| @@ -58,6 +58,14 @@ OPTIONS -m Default to showing all memory regions separately. +-n <number> + Specify application running time as <number - 1> * <refresh period>. + Passing 0 (default) or negative number will run it in infinite loop + until user breaks with q or Ctrl-C or sends a signal. With options + -c, -J or -l it will print info <number> times. + + + RUNTIME CONTROL =============== diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 1bd88ba7c..fd6ad7b5e 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -1065,6 +1065,11 @@ usage(const char *appname) "\t[-d <device>] Device filter, please check manual page for more details.\n" "\t[-p] Default to showing physical engines instead of classes.\n" "\t[-m] Default to showing all memory regions.\n" + "\t[-n <number>] Specify running time as <number - 1> * <refresh period>.\n" + "\t Passing 0 (default) or negative number will run it in\n" + "\t infinite loop until user breaks with q or Ctrl-C or sends\n" + "\t a signal. With options -c, -J or -l it will print info\n" + "\t <number> times.\n" "\n", appname, DEFAULT_PERIOD_MS); printf("To access interactive help, press 'h' while the application is running.\n"); @@ -2617,9 +2622,10 @@ int main(int argc, char **argv) struct igt_device_card card; char *codename = NULL; struct timespec ts; + long iteration_count = 0; /* Parse options */ - while ((ch = getopt(argc, argv, "o:s:d:mpcJLlh")) != -1) { + while ((ch = getopt(argc, argv, "o:s:d:n:mpcJLlh")) != -1) { switch (ch) { case 'o': output_path = optarg; @@ -2630,6 +2636,11 @@ int main(int argc, char **argv) case 'd': opt_device = strdup(optarg); break; + case 'n': + iteration_count = atol(optarg); + if (iteration_count < 0) + iteration_count = 0; + break; case 'p': physical_engines = true; break; @@ -2857,6 +2868,12 @@ int main(int argc, char **argv) if (disp_clients != iclients.clients) free_display_clients(disp_clients); + if (iteration_count > 0) { + --iteration_count; + if (!iteration_count) + stop_top = true; + } + if (stop_top) break; |
