diff options
author | Pierre Grandin <grandinp@gmail.com> | 2019-06-04 10:14:17 -0600 |
---|---|---|
committer | Pierre Grandin <grandinp@gmail.com> | 2019-06-04 10:14:17 -0600 |
commit | 92a5169423e470e4d1a5f4237cb2112266998d28 (patch) | |
tree | bee5f13203e0a0d99c8f6962c82deef9fe772b6e /navit/profile.c | |
parent | 5304cda121782db8e1e5e4685ae10780cce36394 (diff) | |
parent | da3e1e0c186dfd6c6566f798811a27d001a7fb1d (diff) | |
download | navit-92a5169423e470e4d1a5f4237cb2112266998d28.tar.gz |
Merge branch 'trunk' into audioaudio
Diffstat (limited to 'navit/profile.c')
-rw-r--r-- | navit/profile.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/navit/profile.c b/navit/profile.c index 564a63096..d1645377f 100644 --- a/navit/profile.c +++ b/navit/profile.c @@ -53,35 +53,33 @@ * parameters as varargs. May be NULL; then no message is printed, and all timers with the * same or higher level are reset. */ -void -profile_timer(int level, const char *module, const char *function, const char *fmt, ...) -{ +void profile_timer(int level, const char *module, const char *function, const char *fmt, ...) { #ifndef _MSC_VER - va_list ap; - static struct timeval last[PROFILE_LEVEL_MAX+1]; - struct timeval curr; - double msec; - char buffer[strlen(module)+20]; + va_list ap; + static struct timeval last[PROFILE_LEVEL_MAX+1]; + struct timeval curr; + double msec; + char buffer[strlen(module)+20]; - if (level < 0) - level=0; - if (level > PROFILE_LEVEL_MAX) - level=PROFILE_LEVEL_MAX; - if (fmt) { - gettimeofday(&curr, NULL); - msec=(curr.tv_usec-last[level].tv_usec)/((double)1000)+ - (curr.tv_sec-last[level].tv_sec)*1000; - - sprintf(buffer, "profile:%s", module); - va_start(ap, fmt); - debug_vprintf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap); - va_end(ap); - debug_printf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 0, " %7.1f ms\n", msec); - gettimeofday(&last[level], NULL); - } else { - gettimeofday(&curr, NULL); - while (level <= PROFILE_LEVEL_MAX) - last[level++]=curr; - } + if (level < 0) + level=0; + if (level > PROFILE_LEVEL_MAX) + level=PROFILE_LEVEL_MAX; + if (fmt) { + gettimeofday(&curr, NULL); + msec=(curr.tv_usec-last[level].tv_usec)/((double)1000)+ + (curr.tv_sec-last[level].tv_sec)*1000; + + sprintf(buffer, "profile:%s", module); + va_start(ap, fmt); + debug_vprintf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 1, fmt, ap); + va_end(ap); + debug_printf(lvl_debug, buffer, strlen(buffer), function, strlen(function), 0, " %7.1f ms\n", msec); + gettimeofday(&last[level], NULL); + } else { + gettimeofday(&curr, NULL); + while (level <= PROFILE_LEVEL_MAX) + last[level++]=curr; + } #endif /*_MSC_VER*/ } |