eitd: move showProfiling to debug.cpp

Origin commit data
------------------
Commit: ba4a45b35e
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-02-14 (Tue, 14 Feb 2012)
This commit is contained in:
[CST] Focus
2012-02-14 12:45:17 +04:00
parent 78395afb84
commit 26923adf1e
3 changed files with 19 additions and 15 deletions

View File

@@ -23,6 +23,7 @@
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#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;
}