验证中...
Languages: C/C++
Categories: Android 组件
Latest update 2019-12-03 14:11
打印log信息,并宏控制使能
Raw Copy
#include <android/log.h>
// 设置标签
#define LOG_TAG "arc-dms"
// 设置调用函数
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
// 设置使能
#define PRINT_DATA_INFO_FOR_DEBUG true
#define PRINT_CALL_STACK_FOR_DEBUG true
// 设置函数范围
#ifdef PRINT_CALL_STACK_FOR_DEBUG
#define TRACE_PRINT_ENTER_FUNC_INFO LOGI("%s\n", __FUNCTION__, __LINE__);
#define TRACE_PRINT_EXIT_FUNC_INFO LOGI("%s\n", __FUNCTION__, __LINE__);
#else
#define TRACE_PRINT_ENTER_FUNC_INFO
#define TRACE_PRINT_EXIT_FUNC_INFO
#endif
获取当前时间(单位:ms)
Raw Copy
long GetCurrentTime()
{
struct timeval tv{};
gettimeofday(&tv, nullptr);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}

Comment list( 0 )

Sign in for post a comment

Help Search