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

Using the PID only isn't really informative.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7706>
This commit is contained in:
Samuel Pitoiset
2020-11-20 09:19:55 +01:00
parent 15e1b530f6
commit 8d7f78ccf8
2 changed files with 14 additions and 6 deletions

View File

@@ -557,8 +557,8 @@ RADV driver environment variables
Enables DCC,FMASK,CMASK,HTILE in situations where the driver supports it Enables DCC,FMASK,CMASK,HTILE in situations where the driver supports it
but normally does not deem it beneficial. but normally does not deem it beneficial.
``hang`` ``hang``
enable GPU hangs detection and dump a report to $HOME/radv_dumps_<pid> enable GPU hangs detection and dump a report to
if a GPU hang is detected $HOME/radv_dumps_<pid>_<time> if a GPU hang is detected
``img`` ``img``
Print image info Print image info
``info`` ``info``

View File

@@ -616,11 +616,19 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_cmdbuf *cs)
fprintf(stderr, "radv: GPU hang detected...\n"); fprintf(stderr, "radv: GPU hang detected...\n");
/* Create a directory into $HOME/radv_dumps_<pid> to save various /* Create a directory into $HOME/radv_dumps_<pid>_<time> to save
* debugging info about that GPU hang. * various debugging info about that GPU hang.
*/ */
snprintf(dump_dir, sizeof(dump_dir), "%s/"RADV_DUMP_DIR"_%d", struct tm *timep, result;
debug_get_option("HOME", "."), getpid()); 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) { if (mkdir(dump_dir, 0774) && errno != EEXIST) {
fprintf(stderr, "radv: can't create directory '%s' (%i).\n", fprintf(stderr, "radv: can't create directory '%s' (%i).\n",
dump_dir, errno); dump_dir, errno);