From 1d26130452af91635e6c925729d5f053347fc5d2 Mon Sep 17 00:00:00 2001 From: libaoshan Date: Fri, 18 Apr 2025 17:58:48 +0800 Subject: [PATCH] [hitrace for hdc, only support Harmony Next pc] Signed-off-by: libaoshan --- src/common/base.cpp | 6 ++++++ src/common/channel.cpp | 12 ++++++++++++ src/common/file.cpp | 8 ++++++++ src/common/forward.cpp | 2 ++ src/common/session.cpp | 24 ++++++++++++++++++++++++ src/common/session.h | 2 ++ src/common/task.cpp | 4 ++++ src/common/transfer.cpp | 14 ++++++++++++++ src/common/usb.cpp | 10 ++++++++++ src/host/server.cpp | 3 +++ src/host/server_for_client.cpp | 12 ++++++++++++ 11 files changed, 97 insertions(+) diff --git a/src/common/base.cpp b/src/common/base.cpp index 57d08592..0ab7391f 100644 --- a/src/common/base.cpp +++ b/src/common/base.cpp @@ -755,7 +755,9 @@ static void EchoLog(string &buf) // As an uv_write_cb it must keep the same as prototype void SendCallback(uv_write_t *req, int status) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("Base::SendCallback"); +#endif if (status < 0) { constexpr int bufSize = 1024; char buf[bufSize] = { 0 }; @@ -903,7 +905,9 @@ static void EchoLog(string &buf) } int SendToStream(uv_stream_t *handleStream, const uint8_t *buf, const int bufLen) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("Base::SendToStream"); +#endif if (bufLen > static_cast(HDC_BUF_MAX_BYTES)) { return ERR_BUF_ALLOC; } @@ -931,7 +935,9 @@ static void EchoLog(string &buf) int SendToStreamEx(uv_stream_t *handleStream, const uint8_t *buf, const int bufLen, uv_stream_t *handleSend, const void *finishCallback, const void *pWriteReqData) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("Base::SendToStreamEx"); +#endif int ret = ERR_GENERIC; uv_write_t *reqWrite = new uv_write_t(); if (!reqWrite) { diff --git a/src/common/channel.cpp b/src/common/channel.cpp index 09b2854d..8f1453aa 100644 --- a/src/common/channel.cpp +++ b/src/common/channel.cpp @@ -112,7 +112,9 @@ void HdcChannelBase::WorkerPendding() void HdcChannelBase::ReadStream(uv_stream_t *tcp, ssize_t nread, const uv_buf_t *buf) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::ReadStream"); +#endif int size = 0; int indexBuf = 0; int childRet = 0; @@ -286,7 +288,9 @@ void HdcChannelBase::PushAsyncMessage(const uint32_t channelId, const uint8_t me // add commandflag ahead real buf data void HdcChannelBase::SendChannelWithCmd(HChannel hChannel, const uint16_t commandFlag, uint8_t *bufPtr, const int size) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::SendChannelWithCmd"); +#endif if (size < 0) { WRITE_LOG(LOG_WARN, "SendChannelWithCmd size %d", size); return; @@ -313,7 +317,9 @@ void HdcChannelBase::SendChannelWithCmd(HChannel hChannel, const uint16_t comman void HdcChannelBase::SendWithCmd(const uint32_t channelId, const uint16_t commandFlag, uint8_t *bufPtr, const int size) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::SendWithCmd"); +#endif HChannel hChannel = reinterpret_cast(AdminChannel(OP_QUERY_REF, channelId, nullptr)); if (!hChannel) { WRITE_LOG(LOG_FATAL, "SendWithCmd hChannel nullptr channelId:%u", channelId); @@ -331,7 +337,9 @@ void HdcChannelBase::SendWithCmd(const uint32_t channelId, const uint16_t comman void HdcChannelBase::SendChannel(HChannel hChannel, uint8_t *bufPtr, const int size, const uint16_t commandFlag) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::SendChannel"); +#endif uv_stream_t *sendStream = nullptr; int sizeNewBuf = size + DWORD_SERIALIZE_SIZE; auto data = new uint8_t[sizeNewBuf](); @@ -366,7 +374,9 @@ void HdcChannelBase::SendChannel(HChannel hChannel, uint8_t *bufPtr, const int s // works only in current working thread void HdcChannelBase::Send(const uint32_t channelId, uint8_t *bufPtr, const int size) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::Send"); +#endif HChannel hChannel = reinterpret_cast(AdminChannel(OP_QUERY_REF, channelId, nullptr)); if (!hChannel) { WRITE_LOG(LOG_FATAL, "Send hChannel nullptr channelId:%u", channelId); @@ -597,7 +607,9 @@ HChannel HdcChannelBase::AdminChannel(const uint8_t op, const uint32_t channelId void HdcChannelBase::EchoToClient(HChannel hChannel, uint8_t *bufPtr, const int size) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcChannelBase::EchoToClient"); +#endif uv_stream_t *sendStream = nullptr; int sizeNewBuf = size + DWORD_SERIALIZE_SIZE; auto data = new uint8_t[sizeNewBuf](); diff --git a/src/common/file.cpp b/src/common/file.cpp index 48da1c66..97330004 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -39,7 +39,9 @@ bool HdcFile::BeginTransfer(CtxFile *context, const string &command) { int argc = 0; bool ret = false; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcFile::BeginTransfer"); +#endif char **argv = Base::SplitCommandToArgs(command.c_str(), &argc); if (argc < CMD_ARG1_COUNT || argv == nullptr) { LogMsg(MSG_FAIL, "Transfer path split failed"); @@ -309,7 +311,9 @@ bool HdcFile::SetMasterParametersOnDaemon(CtxFile *context, int argc, char **arg void HdcFile::CheckMaster(CtxFile *context) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcFile::CheckMaster"); +#endif if (context->fileModeSync) { string s = SerialStruct::SerializeToString(context->fileMode); SendToAnother(CMD_FILE_MODE, reinterpret_cast(const_cast(s.c_str())), s.size()); @@ -348,7 +352,9 @@ void HdcFile::TransferSummary(CtxFile *context) bool HdcFile::FileModeSync(const uint16_t cmd, uint8_t *payload, const int payloadSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcFile::FileModeSync"); +#endif if (ctxNow.master) { WRITE_LOG(LOG_DEBUG, "FileModeSync master ctxNow.fileModeSync = %d size = %zu", ctxNow.fileModeSync, ctxNow.dirMode.size()); @@ -555,7 +561,9 @@ void HdcFile::TransferNext(CtxFile *context) bool HdcFile::CommandDispatch(const uint16_t command, uint8_t *payload, const int payloadSize) { bool ret = HdcTransferBase::CommandDispatch(command, payload, payloadSize); +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcFile::CommandDispatch"); +#endif switch (command) { case CMD_FILE_INIT: { // initial string s = string(reinterpret_cast(payload), payloadSize); diff --git a/src/common/forward.cpp b/src/common/forward.cpp index 71f670eb..521464b5 100644 --- a/src/common/forward.cpp +++ b/src/common/forward.cpp @@ -236,7 +236,9 @@ void HdcForwardBase::FreeContext(HCtxForward ctxIn, const uint32_t id, bool bNot bool HdcForwardBase::SendToTask(const uint32_t cid, const uint16_t command, uint8_t *bufPtr, const int bufSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcForwardBase::SendToTask"); +#endif bool ret = false; // usually MAX_SIZE_IOBUF*2 from HdcFileDescriptor maxIO if (bufSize > Base::GetMaxBufSizeStable() * BUF_MULTIPLE) { diff --git a/src/common/session.cpp b/src/common/session.cpp index f4e6b4b4..67d87565 100755 --- a/src/common/session.cpp +++ b/src/common/session.cpp @@ -102,7 +102,9 @@ bool HdcSessionBase::TryRemoveTask(HTaskInfo hTask) // remove step1 void HdcSessionBase::BeginRemoveTask(HTaskInfo hTask) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::BeginRemoveTask"); +#endif if (hTask->taskStop || hTask->taskFree) { WRITE_LOG(LOG_WARN, "BeginRemoveTask channelId:%u taskStop:%d taskFree:%d", hTask->channelId, hTask->taskStop, hTask->taskFree); @@ -111,7 +113,9 @@ void HdcSessionBase::BeginRemoveTask(HTaskInfo hTask) WRITE_LOG(LOG_WARN, "BeginRemoveTask taskType:%d channelId:%u", hTask->taskType, hTask->channelId); auto taskClassDeleteRetry = [](uv_timer_t *handle) -> void { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::BeginRemoveTask taskClassDeleteRetry"); +#endif HTaskInfo hTask = (HTaskInfo)handle->data; HdcSessionBase *thisClass = (HdcSessionBase *)hTask->ownerSessionClass; if (hTask->isCleared == false) { @@ -158,7 +162,9 @@ void HdcSessionBase::ClearOwnTasks(HSession hSession, const uint32_t channelIDIn // First case: normal task cleanup process (STOP Remove) // Second: The task is cleaned up, the session ends // Third: The task is cleaned up, and the session is directly over the session. +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::ClearOwnTasks"); +#endif hSession->mapTaskMutex.lock(); map::iterator iter; taskCount = hSession->mapTask->size(); @@ -197,7 +203,9 @@ void HdcSessionBase::ClearSessions() void HdcSessionBase::ReMainLoopForInstanceClear() { // reloop +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::ReMainLoopForInstanceClear"); +#endif auto clearSessionsForFinish = [](uv_idle_t *handle) -> void { HdcSessionBase *thisClass = (HdcSessionBase *)handle->data; if (thisClass->sessionRef > 0) { @@ -625,7 +633,9 @@ void HdcSessionBase::FreeSessionContinue(HSession hSession) void HdcSessionBase::FreeSessionOpeate(uv_timer_t *handle) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::FreeSessionOpeate"); +#endif HSession hSession = (HSession)handle->data; #ifdef HDC_HOST if (hSession->hUSB != nullptr @@ -666,7 +676,9 @@ void HdcSessionBase::FreeSessionOpeate(uv_timer_t *handle) void HdcSessionBase::FreeSession(const uint32_t sessionId) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::FreeSession"); +#endif DispAllLoopStatus("FreeSession-" + std::to_string(sessionId)); Base::AddDeletedSessionId(sessionId); if (threadSessionMain != uv_thread_self()) { @@ -811,7 +823,9 @@ HTaskInfo HdcSessionBase::AdminTask(const uint8_t op, HSession hSession, const u int HdcSessionBase::SendByProtocol(HSession hSession, uint8_t *bufPtr, const int bufLen, bool echo) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::SendByProtocol"); +#endif if (hSession->isDead) { delete[] bufPtr; WRITE_LOG(LOG_WARN, "SendByProtocol session dead error"); @@ -856,7 +870,9 @@ int HdcSessionBase::SendByProtocol(HSession hSession, uint8_t *bufPtr, const int int HdcSessionBase::Send(const uint32_t sessionId, const uint32_t channelId, const uint16_t commandFlag, const uint8_t *data, const int dataSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::Send"); +#endif HSession hSession = AdminSession(OP_QUERY_REF, sessionId, nullptr); if (!hSession) { WRITE_LOG(LOG_WARN, "Send to offline device, drop it, sessionId:%u", sessionId); @@ -919,7 +935,9 @@ int HdcSessionBase::Send(const uint32_t sessionId, const uint32_t channelId, con int HdcSessionBase::DecryptPayload(HSession hSession, PayloadHead *payloadHeadBe, uint8_t *encBuf) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::DecryptPayload"); +#endif PayloadProtect protectBuf = {}; uint16_t headSize = ntohs(payloadHeadBe->headSize); int dataSize = ntohl(payloadHeadBe->dataSize); @@ -945,7 +963,9 @@ int HdcSessionBase::DecryptPayload(HSession hSession, PayloadHead *payloadHeadBe int HdcSessionBase::OnRead(HSession hSession, uint8_t *bufPtr, const int bufLen) { int ret = ERR_GENERIC; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::OnRead"); +#endif if (memcmp(bufPtr, PACKET_FLAG.c_str(), PACKET_FLAG.size())) { WRITE_LOG(LOG_FATAL, "PACKET_FLAG incorrect %x %x", bufPtr[0], bufPtr[1]); return ERR_BUF_CHECK; @@ -979,7 +999,9 @@ int HdcSessionBase::FetchIOBuf(HSession hSession, uint8_t *ioBuf, int read) HdcSessionBase *ptrConnect = (HdcSessionBase *)hSession->classInstance; int indexBuf = 0; int childRet = 0; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::FetchIOBuf"); +#endif if (read < 0) { constexpr int bufSize = 1024; char buf[bufSize] = { 0 }; @@ -1446,7 +1468,9 @@ bool HdcSessionBase::NeedNewTaskInfo(const uint16_t command, bool &masterTask) bool HdcSessionBase::DispatchTaskData(HSession hSession, const uint32_t channelId, const uint16_t command, uint8_t *payload, int payloadSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::DispatchTaskData"); +#endif bool ret = true; HTaskInfo hTaskInfo = nullptr; bool masterTask = false; diff --git a/src/common/session.h b/src/common/session.h index 3e0f898a..1bb444c2 100755 --- a/src/common/session.h +++ b/src/common/session.h @@ -157,7 +157,9 @@ protected: bool TaskCommandDispatch(HTaskInfo hTaskInfo, uint8_t taskType, const uint16_t command, uint8_t *payload, const int payloadSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcSessionBase::TaskCommandDispatch"); +#endif bool ret = true; T *ptrTask = nullptr; if (!hTaskInfo->hasInitial) { diff --git a/src/common/task.cpp b/src/common/task.cpp index 214b463d..519054d8 100644 --- a/src/common/task.cpp +++ b/src/common/task.cpp @@ -48,7 +48,9 @@ bool HdcTaskBase::ReadyForRelease() // Only the Task work thread call is allowed to use only when Workfortask returns FALSE. void HdcTaskBase::TaskFinish() { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTaskBase::TaskFinish"); +#endif uint8_t count = 1; WRITE_LOG(LOG_DEBUG, "HdcTaskBase::TaskFinish notify begin type:%u cid:%u sid:%u", taskInfo->taskType, taskInfo->channelId, taskInfo->sessionId); @@ -59,7 +61,9 @@ void HdcTaskBase::TaskFinish() bool HdcTaskBase::SendToAnother(const uint16_t command, uint8_t *bufPtr, const int size) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTaskBase::SendToAnother"); +#endif if (singalStop) { WRITE_LOG(LOG_FATAL, "TaskFinish singalStop channelId:%u command:%u", taskInfo->channelId, command); return false; diff --git a/src/common/transfer.cpp b/src/common/transfer.cpp index 1dc730d1..9047f944 100644 --- a/src/common/transfer.cpp +++ b/src/common/transfer.cpp @@ -69,7 +69,9 @@ bool HdcTransferBase::ResetCtx(CtxFile *context, bool full) int HdcTransferBase::SimpleFileIO(CtxFile *context, uint64_t index, uint8_t *sendBuf, int bytes) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::SimpleFileIO"); +#endif // The first 8 bytes file offset #ifndef CONFIG_USE_JEMALLOC_DFX_INIF uint8_t *buf = cirbuf.Malloc(); @@ -148,7 +150,9 @@ int HdcTransferBase::SimpleFileIO(CtxFile *context, uint64_t index, uint8_t *sen void HdcTransferBase::OnFileClose(CtxFile *context) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::OnFileClose"); +#endif context->closeReqSubmitted = false; HdcTransferBase *thisClass = (HdcTransferBase *)context->thisClass; if (context->closeNotify) { @@ -193,7 +197,9 @@ bool HdcTransferBase::SendIOPayload(CtxFile *context, uint64_t index, uint8_t *d uint8_t *sendBuf = data - payloadPrefixReserve; bool ret = false; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::SendIOPayload"); +#endif InitTransferPayload(payloadHead, index, context->transferConfig.compressType, dataSize); if (dataSize > 0) { switch (payloadHead.compressType) { @@ -392,7 +398,9 @@ bool HdcTransferBase::IODelayed(uv_fs_t *req) } void HdcTransferBase::OnFileIO(uv_fs_t *req) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::OnFileIO"); +#endif if (IODelayed(req)) { return; } @@ -452,7 +460,9 @@ void HdcTransferBase::RemoveSandboxRootPath(std::string &srcStr, const std::stri void HdcTransferBase::OnFileOpen(uv_fs_t *req) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::OnFileOpen"); +#endif std::unique_ptr uptrReq(req); CtxFile *context = (CtxFile *)req->data; HdcTransferBase *thisClass = (HdcTransferBase *)context->thisClass; @@ -799,7 +809,9 @@ bool HdcTransferBase::RecvIOPayload(CtxFile *context, uint8_t *data, int dataSiz bool ret = false; SerialStruct::ParseFromString(pld, serialString); int clearSize = 0; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::RecvIOPayload"); +#endif if (pld.compressSize > static_cast(dataSize) || pld.uncompressSize > MAX_SIZE_IOBUF) { WRITE_LOG(LOG_FATAL, "compress size is greater than the dataSize. pld.compressSize = %d", pld.compressSize); return false; @@ -850,7 +862,9 @@ bool HdcTransferBase::RecvIOPayload(CtxFile *context, uint8_t *data, int dataSiz bool HdcTransferBase::CommandDispatch(const uint16_t command, uint8_t *payload, const int payloadSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcTransferBase::CommandDispatch"); +#endif bool ret = true; while (true) { if (command == commandBegin) { diff --git a/src/common/usb.cpp b/src/common/usb.cpp index bc74891d..52653813 100644 --- a/src/common/usb.cpp +++ b/src/common/usb.cpp @@ -28,7 +28,9 @@ HdcUSBBase::~HdcUSBBase() void HdcUSBBase::ReadUSB(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcUSBBase::ReadUSB"); +#endif HSession hSession = (HSession)stream->data; HdcSessionBase *hSessionBase = (HdcSessionBase *)hSession->classInstance; CALLSTAT_GUARD(hSession->childLoopStatus, stream->loop, "HdcUSBBase::ReadUSB"); @@ -84,7 +86,9 @@ int HdcUSBBase::SendUSBBlock(HSession hSession, uint8_t *data, const int length) { int childRet = 0; int ret = ERR_IO_FAIL; +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcUSBBase::SendUSBBlock"); +#endif std::lock_guard lock(hSession->hUSB->lockSendUsbBlock); auto header = BuildPacketHeader(hSession->sessionId, USB_OPTION_HEADER, length); do { @@ -112,7 +116,9 @@ int HdcUSBBase::SendUSBBlock(HSession hSession, uint8_t *data, const int length) bool HdcUSBBase::IsUsbPacketHeader(uint8_t *ioBuf, int ioBytes) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcUSBBase::IsUsbPacketHeader"); +#endif USBHead *usbPayloadHeader = reinterpret_cast(ioBuf); uint32_t maybeSize = ntohl(usbPayloadHeader->dataSize); bool isHeader = false; @@ -138,7 +144,9 @@ bool HdcUSBBase::IsUsbPacketHeader(uint8_t *ioBuf, int ioBytes) void HdcUSBBase::PreSendUsbSoftReset(HSession hSession, uint32_t sessionIdOld) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcUSBBase::PreSendUsbSoftReset"); +#endif HUSB hUSB = hSession->hUSB; if (hSession->serverOrDaemon && !hUSB->resetIO) { hUSB->lockSendUsbBlock.lock(); @@ -181,7 +189,9 @@ int HdcUSBBase::CheckPacketOption(HSession hSession, uint8_t *appendData, int da // return value: <0 error; = 0 all finish; >0 need size int HdcUSBBase::SendToHdcStream(HSession hSession, uv_stream_t *stream, uint8_t *appendData, int dataSize) { +#if !defined(HDC_HOST) || define(__OHOS__) StartTraceScope("HdcUSBBase::SendToHdcStream"); +#endif int childRet = 0; HUSB hUSB = hSession->hUSB; if (IsUsbPacketHeader(appendData, dataSize)) { diff --git a/src/host/server.cpp b/src/host/server.cpp index f327e4c7..98cb1951 100644 --- a/src/host/server.cpp +++ b/src/host/server.cpp @@ -688,6 +688,9 @@ bool HdcServer::FetchCommand(HSession hSession, const uint32_t channelId, const void HdcServer::BuildForwardVisableLine(bool fullOrSimble, HForwardInfo hfi, string &echo) { +#ifdef __OHOS__ + StartTraceScope("HdcServer::BuildForwardVisableLine") +#endif string buf; if (fullOrSimble) { buf = Base::StringFormat("%s %s %s\n", hfi->connectKey.c_str(), hfi->taskString.substr(OFFSET).c_str(), diff --git a/src/host/server_for_client.cpp b/src/host/server_for_client.cpp index 99ade4fc..dac47df2 100755 --- a/src/host/server_for_client.cpp +++ b/src/host/server_for_client.cpp @@ -167,6 +167,9 @@ int HdcServerForClient::Initial() void HdcServerForClient::EchoClient(HChannel hChannel, MessageLevel level, const char *msg, ...) { +#ifdef __OHOS__ + StartTraceScope("HdcServerForClient::EchoClient") +#endif string logInfo = ""; switch (level) { case MSG_FAIL: @@ -206,6 +209,9 @@ void HdcServerForClient::SendCommandToClient(const HChannel hChannel, const uint bool HdcServerForClient::SendToDaemon(HChannel hChannel, const uint16_t commandFlag, uint8_t *bufPtr, const int bufSize) { +#ifdef __OHOS__ + StartTraceScope("HdcServerForClient::SendToDaemon") +#endif HDaemonInfo hdi = nullptr; bool ret = false; HdcServer *ptrServer = (HdcServer *)clsServer; @@ -626,6 +632,9 @@ bool HdcServerForClient::TaskCommand(HChannel hChannel, void *formatCommandInput void HdcServerForClient::HandleRemote(HChannel hChannel, string ¶meters, RemoteType flag) { +#ifdef __OHOS__ + StartTraceScope("HdcServerForClient::HandleRemote") +#endif hChannel->remote = flag; int argc = 0; char **argv = Base::SplitCommandToArgs(parameters.c_str(), &argc); @@ -960,6 +969,9 @@ string HdcServerForClient::GetErrorString(uint32_t errorCode) bool HdcServerForClient::CommandMatchDaemonFeature(uint16_t cmdFlag, const HDaemonInfo &hdi) { +#ifdef __OHOS__ + StartTraceScope("HdcServerForClient::CommandMatchDaemonFeature") +#endif string cmdFlagStr = std::to_string(cmdFlag); if (FEATURE_CHECK_SET.find(cmdFlag) == FEATURE_CHECK_SET.end()) { // not need check return true; -- Gitee