Module: Mesa
Branch: master
Commit: 8d7f78ccf8f2079492f3b135f4a374e45942e7fc
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8d7f78ccf8f2079492f3b135f4a374e45942e7fc

Author: Samuel Pitoiset <[email protected]>
Date:   Fri Nov 20 09:19:55 2020 +0100

radv: append a time string to the hang report dump directory

Using the PID only isn't really informative.

Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7706>

---

 docs/envvars.rst            |  4 ++--
 src/amd/vulkan/radv_debug.c | 16 ++++++++++++----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/docs/envvars.rst b/docs/envvars.rst
index e0c73ea4500..b91e682ec16 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -557,8 +557,8 @@ RADV driver environment variables
       Enables DCC,FMASK,CMASK,HTILE in situations where the driver supports it
       but normally does not deem it beneficial.
    ``hang``
-      enable GPU hangs detection and dump a report to $HOME/radv_dumps_<pid>
-      if a GPU hang is detected
+      enable GPU hangs detection and dump a report to
+      $HOME/radv_dumps_<pid>_<time> if a GPU hang is detected
    ``img``
       Print image info
    ``info``
diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index cfd1cb76dcc..ee8dc036362 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -616,11 +616,19 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct 
radeon_cmdbuf *cs)
 
        fprintf(stderr, "radv: GPU hang detected...\n");
 
-       /* Create a directory into $HOME/radv_dumps_<pid> to save various
-        * debugging info about that GPU hang.
+       /* Create a directory into $HOME/radv_dumps_<pid>_<time> to save
+        * various debugging info about that GPU hang.
         */
-       snprintf(dump_dir, sizeof(dump_dir), "%s/"RADV_DUMP_DIR"_%d",
-                debug_get_option("HOME", "."), getpid());
+       struct tm *timep, result;
+       time_t raw_time;
+       char buf_time[128];
+
+       time(&raw_time);
+       timep = localtime_r(&raw_time, &result);
+       strftime(buf_time, sizeof(buf_time), "%Y.%m.%d_%H.%M.%S", timep);
+
+       snprintf(dump_dir, sizeof(dump_dir), "%s/"RADV_DUMP_DIR"_%d_%s",
+                debug_get_option("HOME", "."), getpid(), buf_time);
        if (mkdir(dump_dir, 0774) && errno != EEXIST) {
                fprintf(stderr, "radv: can't create directory '%s' (%i).\n",
                        dump_dir, errno);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to