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
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``

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");
/* 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);