diff --git a/src/eitd/debug.cpp b/src/eitd/debug.cpp index 4269a3100..5c80c9ffc 100644 --- a/src/eitd/debug.cpp +++ b/src/eitd/debug.cpp @@ -23,6 +23,7 @@ #include #include #include +#include "debug.h" bool sections_debug; @@ -33,3 +34,17 @@ void printdate_ms(FILE *f) { /* use strftime for that? */ fprintf(f, "%02d:%02d:%02d.%03ld ", tm->tm_hour, tm->tm_min, tm->tm_sec, now.tv_usec/1000); } + +static int64_t last_profile_call; + +void showProfiling( std::string text ) +{ + struct timeval tv; + + gettimeofday( &tv, NULL ); + int64_t now = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); + + int64_t tmp = now - last_profile_call; + printf("--> '%s' %lld.%03lld\n", text.c_str(), tmp / 1000LL, tmp % 1000LL); + last_profile_call = now; +} diff --git a/src/eitd/debug.h b/src/eitd/debug.h index ca4bec645..76814b79f 100644 --- a/src/eitd/debug.h +++ b/src/eitd/debug.h @@ -26,7 +26,9 @@ #include - +#include +#include +#include extern bool sections_debug; @@ -35,6 +37,7 @@ extern bool sections_debug; #define xprintf(fmt, args...) do { printdate_ms(stderr); fprintf(stderr, fmt, ## args); } while (0) void printdate_ms(FILE* f); +void showProfiling( std::string text ); #endif /* __sectionsd__debug_h__ */ diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 97d057df8..392aa4dc1 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -240,20 +240,6 @@ inline bool waitForTimeset(void) return true; } -static int64_t last_profile_call; - -void showProfiling( std::string text ) -{ - struct timeval tv; - - gettimeofday( &tv, NULL ); - int64_t now = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); - - int64_t tmp = now - last_profile_call; - printf("--> '%s' %lld.%03lld\n", text.c_str(), tmp / 1000LL, tmp % 1000LL); - last_profile_call = now; -} - static const SIevent nullEvt; // Null-Event // Wir verwalten die events in SmartPointers