mirror of https://github.com/nirenjan/libx52.git
Squashed 'lib/pinelog/' changes from 321d9aa..bdee493
bdee493 Add preprocessor definition to disable traces 5b2686a Fix pinelog builds on MacOS 48bd049 Merge commit '9fa1a428a45eabff0122e199a687068f0e6280dd' into daemon 68d5aae Update README to include destructor attribute git-subtree-dir: lib/pinelog git-subtree-split: bdee493f0357eb0f3f6d4b792140de78999c828ereverse-scroll
parent
9fa1a428a4
commit
8db1be2ba8
|
@ -129,6 +129,7 @@ a Git submodule or subtree.
|
|||
The default build of Pinelog uses an autotools generated `config.h` file, which
|
||||
includes checks for the following GCC attributes. If you don't care about these,
|
||||
then either create a dummy config.h which includes the macros
|
||||
`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR` and `HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the
|
||||
`AX_GCC_FUNC_ATTRIBUTE` macro to check for the `constructor` and `format`
|
||||
attributes in your application's `configure.ac` file.
|
||||
`HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR`, `HAVE_FUNC_ATTRIBUTE_DESTRUCTOR` and
|
||||
`HAVE_FUNC_ATTRIBUTE_FORMAT`, or use the `AX_GCC_FUNC_ATTRIBUTE` macro to check
|
||||
for the `constructor`, `destructor` and `format` attributes in your
|
||||
application's `configure.ac` file.
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
|
||||
#define BENCH_COUNT 100000
|
||||
|
@ -36,7 +37,7 @@ static void print_time_difference(const char *type, struct timespec *ts)
|
|||
tp_usec = timeper / 1000;
|
||||
tp_nsec = timeper % 1000;
|
||||
|
||||
printf("# %s %lu.%03lu\u03BCs/log (Total %lu.%09lds)\n",
|
||||
printf("# %s %"PRIu64".%03"PRIu64"\u03BCs/log (Total %lu.%09lds)\n",
|
||||
type, tp_usec, tp_nsec, ret.tv_sec, ret.tv_nsec);
|
||||
}
|
||||
|
||||
|
|
|
@ -165,11 +165,16 @@ void pinelog_log_message(int level, const char *file, int line, const char *fmt,
|
|||
} \
|
||||
} while(0)
|
||||
|
||||
/* PINELOG_DISABLE_TRACE allows all traces to be compiled out */
|
||||
#ifndef PINELOG_DISABLE_TRACE
|
||||
#define PINELOG_TRACE(fmt, ...) do { \
|
||||
if (PINELOG_LVL_TRACE <= pinelog_get_level()) { \
|
||||
pinelog_log_message(PINELOG_LVL_TRACE, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
#define PINELOG_TRACE(fmt, ...) do { } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue