diff options
author | James Prestwood <james.prestwood@intel.com> | 2016-10-12 15:46:00 -0700 |
---|---|---|
committer | Geoff Gustafson <geoff@linux.intel.com> | 2016-10-18 08:07:52 -0700 |
commit | 852a0675845c2059ec165a1c6eae3cdb2580120c (patch) | |
tree | e9b32b3278676b449d1465a0e4405b436d3e7fc6 /src/zjs_common.h | |
parent | 2ecfc3c2857887b0b65a38dd5c6936a2b376aaca (diff) |
[debugging] Print elapsed time since start with DBG_PRINT/ERR_PRINT (#275)
Signed-off-by: James Prestwood <james.prestwood@intel.com>
Diffstat (limited to 'src/zjs_common.h')
-rw-r--r-- | src/zjs_common.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/zjs_common.h b/src/zjs_common.h index b127b3c..60b7b90 100644 --- a/src/zjs_common.h +++ b/src/zjs_common.h @@ -10,11 +10,21 @@ #define PRINT printf #ifdef DEBUG_BUILD + +int zjs_get_sec(void); +int zjs_get_ms(void); + #define DBG_PRINT \ - PRINT("%s:%d %s(): ", __FILE__, __LINE__, __func__); \ + PRINT("[%u.%3.3u][INFO] %s:%d %s(): ", zjs_get_sec(), zjs_get_ms(), __FILE__, __LINE__, __func__); \ PRINT + +#define ERR_PRINT \ + PRINT("[%u.%3.3u][ERROR] %s:%d %s(): ", zjs_get_sec(), zjs_get_ms(), __FILE__, __LINE__, __func__); \ + PRINT + #else #define DBG_PRINT(fmat ...) do {} while(0); +#define ERR_PRINT(fmat ...) do {} while(0); #endif // TODO: We should instead have a macro that changes in debug vs. release build, |