summaryrefslogtreecommitdiff
path: root/navit/profile.c
diff options
context:
space:
mode:
Diffstat (limited to 'navit/profile.c')
-rw-r--r--navit/profile.c54
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*/
}