anv: Add a performance warning helper
This acts identically to anv_finishme except that it only dumps out these nice log messages if you run with INTEL_DEBUG=perf. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
@@ -230,6 +230,8 @@ VkResult __vk_errorf(VkResult error, const char *file, int line, const char *for
|
|||||||
|
|
||||||
void __anv_finishme(const char *file, int line, const char *format, ...)
|
void __anv_finishme(const char *file, int line, const char *format, ...)
|
||||||
anv_printflike(3, 4);
|
anv_printflike(3, 4);
|
||||||
|
void __anv_perf_warn(const char *file, int line, const char *format, ...)
|
||||||
|
anv_printflike(3, 4);
|
||||||
void anv_loge(const char *format, ...) anv_printflike(1, 2);
|
void anv_loge(const char *format, ...) anv_printflike(1, 2);
|
||||||
void anv_loge_v(const char *format, va_list va);
|
void anv_loge_v(const char *format, va_list va);
|
||||||
|
|
||||||
@@ -245,6 +247,18 @@ void anv_loge_v(const char *format, va_list va);
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print a perf warning message. Set INTEL_DEBUG=perf to see these.
|
||||||
|
*/
|
||||||
|
#define anv_perf_warn(format, ...) \
|
||||||
|
do { \
|
||||||
|
static bool reported = false; \
|
||||||
|
if (!reported && unlikely(INTEL_DEBUG & DEBUG_PERF)) { \
|
||||||
|
__anv_perf_warn(__FILE__, __LINE__, format, ##__VA_ARGS__); \
|
||||||
|
reported = true; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* A non-fatal assert. Useful for debugging. */
|
/* A non-fatal assert. Useful for debugging. */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define anv_assert(x) ({ \
|
#define anv_assert(x) ({ \
|
||||||
|
@@ -64,6 +64,19 @@ __anv_finishme(const char *file, int line, const char *format, ...)
|
|||||||
fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
|
fprintf(stderr, "%s:%d: FINISHME: %s\n", file, line, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void anv_printflike(3, 4)
|
||||||
|
__anv_perf_warn(const char *file, int line, const char *format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char buffer[256];
|
||||||
|
|
||||||
|
va_start(ap, format);
|
||||||
|
vsnprintf(buffer, sizeof(buffer), format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
fprintf(stderr, "%s:%d: PERF: %s\n", file, line, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
__vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
|
__vk_errorf(VkResult error, const char *file, int line, const char *format, ...)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user