Adding new macro for HIP using ClPrint

calculates duration of a call

Change-Id: I7cca673f6dabc618ec543e3bd6c5102aa76edc3a
Этот коммит содержится в:
Payam authored and Payam Ghafari committed 2020-07-15 09:40:59 -04:00
1 родитель 1e349179e2
Коммит 47088fea0d
2 files changed
+40 -1

No files matched your search

+19 -1
Просмотреть файл
@@ -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