From b6d9595d2599af8bc7247db799e652935fb83047 Mon Sep 17 00:00:00 2001 From: xuyong Date: Sun, 9 Oct 2022 14:56:22 +0800 Subject: [PATCH] Rename HiTrace to HiTraceChain Signed-off-by: xuyong --- interfaces/innerkits/ipc_core/BUILD.gn | 2 +- interfaces/innerkits/ipc_single/BUILD.gn | 2 +- .../src/mock/include/dbinder_base_invoker.h | 2 +- ipc/native/src/mock/source/binder_invoker.cpp | 2 +- .../src/mock/source/hitrace_invoker.cpp | 22 +++---- ipc/native/test/unittest/common/BUILD.gn | 2 +- .../unittest/common/ipc_hitrace_unittest.cpp | 60 +++++++++---------- .../src/dbinder_distributed_test.cpp | 2 +- .../src/dbinder_test_service_skeleton.cpp | 2 +- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn index c306687..cb35083 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 efe9dcb..de33cdb 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 f439460..ca7fd8e 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 b0b1d86..8aa98bd 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 587a392..4f7f7c3 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 264ae70..1425172 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 49a3d2c..8b008f5 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\\]