diff --git a/app/src/main/cpp/GPIOControl.cpp b/app/src/main/cpp/GPIOControl.cpp index 2906e04e..e1dfbd5d 100644 --- a/app/src/main/cpp/GPIOControl.cpp +++ b/app/src/main/cpp/GPIOControl.cpp @@ -26,7 +26,9 @@ std::mutex GpioControl::m_locker; std::vector GpioControl::m_items; bool GpioControl::m_cameraPowerStatus = false; -#if 0 +#define ENABLE_GPIO_TRACING + +#ifdef ENABLE_GPIO_TRACING class GpioDebugLogger { public: @@ -38,6 +40,14 @@ public: CreateEmptyFile(m_path + ".enter"); } + GpioDebugLogger(int cmd) + { + m_startTime = GetMicroTimeStamp(); + m_path = std::string("/sdcard/com.xypower.mpapp/tmp/") + std::to_string(cmd) + std::string("_") + std::to_string(m_startTime) + "_get"; + + CreateEmptyFile(m_path + ".enter"); + } + ~GpioDebugLogger() { uint64_t ts = (GetMicroTimeStamp() - m_startTime); @@ -85,7 +95,7 @@ size_t GpioControl::turnOnImpl(const IOT_PARAM& param) if (oldRef == 0/* || param.cmd != CMD_SET_3V3_PWR_EN*/) { -#if 0 +#ifdef ENABLE_GPIO_TRACING GpioDebugLogger logger(param.cmd, param.value); #endif fd = open(GPIO_NODE_MP, O_RDONLY); @@ -114,7 +124,7 @@ void GpioControl::setInt(int cmd, int value) // param.cmd = cmd; // param.value = value; -#if 0 +#ifdef ENABLE_GPIO_TRACING GpioDebugLogger logger(cmd, value); #endif int fd = open(GPIO_NODE_MP, O_RDONLY); @@ -132,6 +142,9 @@ void GpioControl::setInt(int cmd, int value) int GpioControl::getInt(int cmd) { +#ifdef ENABLE_GPIO_TRACING + GpioDebugLogger logger(cmd); +#endif int fd = open(GPIO_NODE_MP, O_RDONLY); // LOGE("get_int fd=%d,cmd=%d\r\n",fd, cmd); if( fd > 0 )