diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn index c306687b1ecd23d8a76840ff44fd014b0843b3cb..cb350838b8fb7e8ef5e2dc34517b83116382bde8 100644 --- a/interfaces/innerkits/ipc_core/BUILD.gn +++ b/interfaces/innerkits/ipc_core/BUILD.gn @@ -74,7 +74,7 @@ ohos_shared_library("ipc_core") { "access_token:libaccesstoken_sdk", "c_utils:utils", "dsoftbus:softbus_client", - "hitrace_native:libhitrace", + "hitrace_native:libhitracechain", "hiviewdfx_hilog_native:libhilog", ] diff --git a/interfaces/innerkits/ipc_single/BUILD.gn b/interfaces/innerkits/ipc_single/BUILD.gn index efe9dcbffa17ca8e365ead1ebfe31a75ef1f0265..de33cdbf9964130398aacf6b5b9ee29e41a0b5f9 100644 --- a/interfaces/innerkits/ipc_single/BUILD.gn +++ b/interfaces/innerkits/ipc_single/BUILD.gn @@ -59,7 +59,7 @@ ohos_shared_library("ipc_single") { external_deps = [ "c_utils:utils", - "hitrace_native:libhitrace", + "hitrace_native:libhitracechain", "hiviewdfx_hilog_native:libhilog", ] diff --git a/ipc/native/src/mock/include/dbinder_base_invoker.h b/ipc/native/src/mock/include/dbinder_base_invoker.h index f439460c6ed75950680f373264de905ea8221d21..ca7fd8e2eb4b4b4269d3aba21ad713531fb03cbf 100644 --- a/ipc/native/src/mock/include/dbinder_base_invoker.h +++ b/ipc/native/src/mock/include/dbinder_base_invoker.h @@ -701,7 +701,7 @@ int DBinderBaseInvoker::SendRequest(int32_t handle, uint32_t code, MessagePar int userWaitTime = option.GetWaitTime(); MessageParcel &newData = const_cast(data); size_t oldWritePosition = newData.GetWritePosition(); - HiTraceId traceId = HiTrace::GetId(); + HiTraceId traceId = HiTraceChain::GetId(); // set client send trace point if trace is enabled HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); std::shared_ptr session = WriteTransaction(BC_TRANSACTION, flags, handle, 0, code, data, seqNumber, 0); diff --git a/ipc/native/src/mock/source/binder_invoker.cpp b/ipc/native/src/mock/source/binder_invoker.cpp index b0b1d86a33c02d865b29afecf1447d435267d2bd..8aa98bdca238d1f259facf1821b7b98f60759c7a 100644 --- a/ipc/native/src/mock/source/binder_invoker.cpp +++ b/ipc/native/src/mock/source/binder_invoker.cpp @@ -100,7 +100,7 @@ int BinderInvoker::SendRequest(int handle, uint32_t code, MessageParcel &data, M ZLOGD(LABEL, "%{public}s: handle=%d ,flags:%u", __func__, handle, flags); MessageParcel &newData = const_cast(data); size_t oldWritePosition = newData.GetWritePosition(); - HiTraceId traceId = HiTrace::GetId(); + HiTraceId traceId = HiTraceChain::GetId(); // set client send trace point if trace is enabled HiTraceId childId = HitraceInvoker::TraceClientSend(handle, code, newData, flags, traceId); if (!WriteTransaction(BC_TRANSACTION, flags, handle, code, data, nullptr)) { diff --git a/ipc/native/src/mock/source/hitrace_invoker.cpp b/ipc/native/src/mock/source/hitrace_invoker.cpp index 587a3926d8dd124266af16d6cf45cf3d9c4dc9e9..4f7f7c3771366c3fabb900c2351577d4be2933e9 100644 --- a/ipc/native/src/mock/source/hitrace_invoker.cpp +++ b/ipc/native/src/mock/source/hitrace_invoker.cpp @@ -20,9 +20,7 @@ #include "hilog/log_c.h" #include "hilog/log_cpp.h" -#include "hitrace/hitrace.h" -#include "hitrace/hitracec.h" -#include "hitrace/hitraceid.h" +#include "hitrace/trace.h" #include "ipc_debug.h" #include "log_tags.h" #include "parcel.h" @@ -45,7 +43,7 @@ HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel HiTraceId childId = traceId; bool isClientTraced = IsClientTraced(handle, flags, traceId); if (isClientTraced) { - childId = HiTrace::CreateSpan(); + childId = HiTraceChain::CreateSpan(); // add childid to parcel data uint8_t idBytes[HITRACE_ID_LEN]; size_t idLen = (size_t)(childId.ToBytes(idBytes, HITRACE_ID_LEN)); @@ -70,7 +68,8 @@ HiTraceId HitraceInvoker::TraceClientSend(int32_t handle, uint32_t code, Parcel return childId; } // tracepoint: CS(Client Send) - HiTrace::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", + HiTraceChain::Tracepoint(HITRACE_TP_CS, childId, "%s handle=%d,code=%u", + (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code); flags |= TF_HITRACE; } @@ -87,9 +86,9 @@ void HitraceInvoker::TraceClientReceieve(int32_t handle, uint32_t code, uint32_t if (isClientTraced) { if (!(flags & TF_ONE_WAY)) { // restore thread trace id - HiTrace::SetId(traceId); + HiTraceChain::SetId(traceId); // tracepoint: CR(Client Receive) - HiTrace::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code); + HiTraceChain::Tracepoint(HITRACE_TP_CR, childId, "%s handle=%d,code=%u", "SYNC", handle, code); } } } @@ -123,9 +122,10 @@ bool HitraceInvoker::TraceServerReceieve(int32_t handle, uint32_t code, Parcel & return isServerTraced; } HiTraceId traceId(idBytes, sizeof(HiTraceIdStruct)); - HiTrace::SetId(traceId); + HiTraceChain::SetId(traceId); // tracepoint: SR(Server Receive) - HiTrace::Tracepoint(HITRACE_TP_SR, traceId, "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", + HiTraceChain::Tracepoint(HITRACE_TP_SR, traceId, + "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code); } @@ -138,9 +138,9 @@ void HitraceInvoker::TraceServerSend(int32_t handle, uint32_t code, bool isServe { if (isServerTraced) { // tracepoint: SS(Server Send) - HiTrace::Tracepoint(HITRACE_TP_SS, HiTrace::GetId(), "%s handle=%d,code=%u", + HiTraceChain::Tracepoint(HITRACE_TP_SS, HiTraceChain::GetId(), "%s handle=%d,code=%u", (flags & TF_ONE_WAY) ? "ASYNC" : "SYNC", handle, code); } - HiTrace::ClearId(); + HiTraceChain::ClearId(); } } // namespace OHOS diff --git a/ipc/native/test/unittest/common/BUILD.gn b/ipc/native/test/unittest/common/BUILD.gn index 264ae709a25c731a7c4a953ee38841a723323f01..1425172e1602325d22e98ffd25a64f8d80e1012e 100644 --- a/ipc/native/test/unittest/common/BUILD.gn +++ b/ipc/native/test/unittest/common/BUILD.gn @@ -88,7 +88,7 @@ ohos_unittest("IPCHiTraceUnitTest") { external_deps = [ "c_utils:utils", - "hitrace_native:libhitrace", + "hitrace_native:libhitracechain", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", "samgr:samgr_proxy", diff --git a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp index 49a3d2c4a5e25a8fea33dcdf0ff3f02199acc620..8b008f5139e9d6b7514d37594b973564af33e1c8 100644 --- a/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp +++ b/ipc/native/test/unittest/common/ipc_hitrace_unittest.cpp @@ -154,9 +154,9 @@ static std::string PrintTagLog(const std::string &tag) HWTEST_F(BinderTraceTest, Sync001, TestSize.Level1) { - HiTraceId getId = HiTrace::GetId(); + HiTraceId getId = HiTraceChain::GetId(); EXPECT_EQ(0, getId.IsValid()); - HiTraceId traceId = HiTrace::Begin("ipc hitrace", 0); + HiTraceId traceId = HiTraceChain::Begin("ipc hitrace", 0); std::string chainId = HitraceLongToString(traceId.GetChainId()); EXPECT_NE(0UL, chainId.size()); IPCTestHelper helper; @@ -185,10 +185,10 @@ HWTEST_F(BinderTraceTest, Sync001, TestSize.Level1) HiLog::Info(LOG_LABEL, "Got Stub node\n"); } - getId = HiTrace::GetId(); + getId = HiTraceChain::GetId(); EXPECT_EQ(1, getId.IsValid()); - HiTrace::End(traceId); - getId = HiTrace::GetId(); + HiTraceChain::End(traceId); + getId = HiTraceChain::GetId(); EXPECT_EQ(0, getId.IsValid()); std::string remainLogMsgs = BinderTraceGetRemainLog(logTag); EXPECT_EQ(0, BinderTraceCheckLog(remainLogMsgs, "HITRACE_TP_CS", chainId)); @@ -207,9 +207,9 @@ HWTEST_F(BinderTraceTest, Sync002, TestSize.Level1) "\\[[a-f0-9]{1,16}, [a-f0-9]{1,16}, 0\\]