summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-08-24 00:33:20 +0200
committerSven Gothel <[email protected]>2020-08-24 00:33:20 +0200
commit790e705aa16f47effd1db6e58a84123b9e357c9f (patch)
tree6d2c8415de2fa45c58f30caed3698381adb38df1 /api
parent7462f48d8699b0d4d6cd9393e2a3b8d271054f78 (diff)
dbt_debug: Add prefix "[%'9d] " using elapsed time for all *_PRINT methods, allowing to conveniently track time (deltas)
Diffstat (limited to 'api')
-rw-r--r--api/direct_bt/dbt_debug.hpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/api/direct_bt/dbt_debug.hpp b/api/direct_bt/dbt_debug.hpp
index 4aa8ed47..ce826405 100644
--- a/api/direct_bt/dbt_debug.hpp
+++ b/api/direct_bt/dbt_debug.hpp
@@ -23,26 +23,26 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#ifndef DBT_DEBUG_HPP_
+#define DBT_DEBUG_HPP_
+
+#include <cstdint>
+#include <cinttypes>
#include <cstring>
#include <string>
-#include <cstdint>
#include <cstdio>
-#include <vector>
-#include <memory>
-
extern "C" {
#include <errno.h>
}
-#ifndef DBT_DEBUG_HPP_
-#define DBT_DEBUG_HPP_
+#include "DBTEnv.hpp"
// #define PERF_PRINT_ON 1
// #define VERBOSE_ON 1
#ifdef VERBOSE_ON
- #define DBG_PRINT(...) { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
+ #define DBG_PRINT(...) { fprintf(stderr, "[%'9" PRIu64 "] Debug: ", direct_bt::DBTEnv::getElapsedMillisecond()); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
#else
#define DBG_PRINT(...)
#endif
@@ -57,11 +57,11 @@ extern "C" {
#define PERF_TS_TD(m)
#endif
-#define ERR_PRINT(...) { fprintf(stderr, "Error @ %s:%d: ", __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "; last errno %d %s\n", errno, strerror(errno)); fflush(stderr); }
+#define ERR_PRINT(...) { fprintf(stderr, "[%'9" PRIu64 "] Error @ %s:%d: ", direct_bt::DBTEnv::getElapsedMillisecond(), __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "; last errno %d %s\n", errno, strerror(errno)); fflush(stderr); }
-#define WARN_PRINT(...) { fprintf(stderr, "Warning @ %s:%d: ", __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
+#define WARN_PRINT(...) { fprintf(stderr, "[%'9" PRIu64 "] Warning @ %s:%d: ", direct_bt::DBTEnv::getElapsedMillisecond(), __FILE__, __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
-#define INFO_PRINT(...) { fprintf(stderr, "INFO: "); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
+#define INFO_PRINT(...) { fprintf(stderr, "[%'9" PRIu64 "] Info: ", direct_bt::DBTEnv::getElapsedMillisecond()); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
template<class ListElemType>
inline void printSharedPtrList(std::string prefix, std::vector<std::shared_ptr<ListElemType>> & list) {