1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

New function log_clock.

* common/logging.c (log_clock): New.
* g10/gpg.c (set_debug): Print clock debug flag.
* g10/options.h (DBG_CLOCK_VALUE, DBG_CLOCK): New.
--

To actually use log_clock you need to enable the code in
logginc.c:log_check() and link against librt.  --debug 4096 may then
be used to enable it at runtime.
This commit is contained in:
Werner Koch 2013-01-07 16:51:24 +01:00
parent fb31462e7e
commit 0baedfd25a
5 changed files with 43 additions and 2 deletions

View file

@ -857,6 +857,33 @@ log_printhex (const char *text, const void *buffer, size_t length)
}
void
log_clock (const char *string)
{
#if 0
static unsigned long long initial;
struct timespec tv;
unsigned long long now;
if (clock_gettime (CLOCK_REALTIME, &tv))
{
log_debug ("error getting the realtime clock value\n");
return;
}
now = tv.tv_sec * 1000000000ull;
now += tv.tv_nsec;
if (!initial)
initial = now;
log_debug ("[%llu] %s", now - initial, string);
#else
/* You need to link with -ltr to enable the above code. */
log_debug ("[not enabled in the source] %s", string);
#endif
}
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
void
bug_at( const char *file, int line, const char *func )