Adding new macro for HIP using ClPrint

calculates duration of a call

Change-Id: I7cca673f6dabc618ec543e3bd6c5102aa76edc3a
Este commit está contenido en:
Payam
2020-07-03 10:27:48 -04:00
cometido por Payam Ghafari
padre 1e349179e2
commit 47088fea0d
Se han modificado 2 ficheros con 40 adiciones y 1 borrados
+19 -1
Ver fichero
@@ -87,8 +87,26 @@ void log_printf(LogLevel level, const char* file, int line, const char* format,
char message[4096];
vsnprintf(message, sizeof(message), format, ap);
va_end(ap);
uint64_t timeUs = Os::timeNanos() / 1000ULL;
fprintf(stderr, ":%d:%-25s:%-4d: %010lld us: %s\n", level, file, line, timeUs, message);
fprintf(stderr, ":%d:%-25s:%-4d: %010lld us: %s\n", level, file, line, Os::timeNanos() / 1000ULL, message);
}
void log_printf(LogLevel level, const char* file, int line, uint64_t* start, const char* format, ...) {
va_list ap;
va_start(ap, format);
char message[4096];
vsnprintf(message, sizeof(message), format, ap);
va_end(ap);
uint64_t timeUs = Os::timeNanos() / 1000ULL;
if (start == 0 || *start == 0) {
fprintf(stderr, ":%d:%-25s:%-4d: %010lld us: %s\n", level, file, line, timeUs, message);
} else {
fprintf(stderr, ":%d:%-25s:%-4d: %010lld us: %s: duration: %d us\n", level, file, line, timeUs, message,timeUs - *start);
}
if (*start == 0) {
*start = timeUs;
}
}
} // namespace amd