mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-01 01:00:10 +01:00
intel/mda: If MDA_PREFIX=timestamp use the actual timestamp as a prefix
Acked-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29146>
This commit is contained in:
parent
c21494576e
commit
a1d66c18c9
2 changed files with 17 additions and 0 deletions
|
|
@ -894,6 +894,7 @@ Intel driver environment variables
|
|||
.. envvar:: MDA_PREFIX
|
||||
|
||||
Prefix added to the mda.tar filenames generated when using INTEL_DEBUG=mda.
|
||||
If set to ``timestamp`` it will generate the current time/date as prefix.
|
||||
|
||||
Anvil(ANV) driver environment variables
|
||||
---------------------------------------
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct debug_archiver
|
||||
|
|
@ -54,6 +55,21 @@ debug_archiver_open(void *mem_ctx, const char *name, const char *info)
|
|||
}
|
||||
|
||||
if (prefix) {
|
||||
if (!strcmp(prefix, "timestamp")) {
|
||||
time_t now = time(NULL);
|
||||
struct tm *tm_info = localtime(&now);
|
||||
|
||||
if (tm_info) {
|
||||
prefix = ralloc_asprintf(da, "%04d%02d%02d-%02d%02d%02d",
|
||||
tm_info->tm_year + 1900,
|
||||
tm_info->tm_mon + 1,
|
||||
tm_info->tm_mday,
|
||||
tm_info->tm_hour,
|
||||
tm_info->tm_min,
|
||||
tm_info->tm_sec);
|
||||
}
|
||||
}
|
||||
|
||||
/* Prefix shouldn't have any `/` characters. */
|
||||
if (strchr(prefix, '/')) {
|
||||
char *safe_prefix = ralloc_strdup(da, prefix);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue