diff --git a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp index 8905064..8377402 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentloader/component_loader.cpp @@ -66,7 +66,7 @@ std::map g_mapDhTypeName = { int32_t ComponentLoader::Init() { - DHTraceStart("COMPONENT_LOAD_START"); + DHTraceStart(COMPONENT_LOAD_START); int32_t ret = ParseConfig(); DHTraceEnd(); @@ -275,7 +275,7 @@ int32_t ComponentLoader::ReleaseHandler(void *&handler) int32_t ComponentLoader::UnInit() { DHLOGI("release all handler"); - DHTraceStart("COMPONENT_RELEASE_START"); + DHTraceStart(COMPONENT_RELEASE_START); int32_t ret = DH_FWK_SUCCESS; for (std::map::iterator iter = compHandlerMap_.begin(); iter != compHandlerMap_.end(); iter++) { diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp index b1e67c2..37db0c7 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_manager.cpp @@ -252,7 +252,7 @@ int32_t ComponentManager::Enable(const std::string &networkId, const std::string } auto compEnable = std::make_shared(); - CompEnableTraceStart(dhType); + DHCompMgrTraceStart(GetAnonyString(networkId), GetAnonyString(dhId), ENABLE_START); auto result = compEnable->Enable(networkId, dhId, param, find->second); if (result != DH_FWK_SUCCESS) { for (int32_t retryCount = 0; retryCount < ENABLE_RETRY_MAX_TIMES; retryCount++) { @@ -288,7 +288,7 @@ int32_t ComponentManager::Disable(const std::string &networkId, const std::strin } auto compDisable = std::make_shared(); - CompDisableTraceStart(dhType); + DHCompMgrTraceStart(GetAnonyString(networkId), GetAnonyString(dhId), DISABLE_START); auto result = compDisable->Disable(networkId, dhId, find->second); if (result != DH_FWK_SUCCESS) { for (int32_t retryCount = 0; retryCount < DISABLE_RETRY_MAX_TIMES; retryCount++) { diff --git a/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp index 42bc9bc..2a1a721 100644 --- a/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/localhardwaremanager/local_hardware_manager.cpp @@ -48,7 +48,10 @@ void LocalHardwareManager::Init() DHLOGE("Initialize %#X failed", dhType); continue; } + + DHQeryTraceStart(dhType); QueryLocalHardware(dhType, hardwareHandler); + DHTraceEnd(); if (!hardwareHandler->IsSupportPlugin()) { DHLOGI("hardwareHandler is not support hot swap plugin, release!"); ComponentLoader::GetInstance().ReleaseHardwareHandler(dhType); diff --git a/utils/include/dh_utils_hitrace.h b/utils/include/dh_utils_hitrace.h index 5e80205..cca8ac8 100644 --- a/utils/include/dh_utils_hitrace.h +++ b/utils/include/dh_utils_hitrace.h @@ -25,8 +25,15 @@ namespace OHOS { namespace DistributedHardware { constexpr uint64_t DHFWK_HITRACE_LABEL = HITRACE_TAG_DISTRIBUTED_HARDWARE_FWK; -void CompEnableTraceStart(const DHType dhType); -void CompDisableTraceStart(const DHType dhType); +const std::string COMPONENT_LOAD_START = "COMPONENT_LOAD_START"; +const std::string COMPONENT_RELEASE_START = "COMPONENT_RELEASE_START"; +const std::string COMPONENT_INIT_START = "COMPONENT_INIT_START"; +const std::string QUERY_START = "QUERY_START"; +const std::string ENABLE_START = "ENABLE_START"; +const std::string DISABLE_START = "DISABLE_START"; + +void DHCompMgrTraceStart(const std::string &anonyNetworkId, const std::string &anonyDHId, const std::string &msg); +void DHQeryTraceStart(const DHType dhType); void DHTraceStart(const std::string &msg); void DHTraceEnd(); } // namespace DistributedHardware diff --git a/utils/src/dh_utils_hitrace.cpp b/utils/src/dh_utils_hitrace.cpp index 841c85b..b1f34cb 100644 --- a/utils/src/dh_utils_hitrace.cpp +++ b/utils/src/dh_utils_hitrace.cpp @@ -19,24 +19,19 @@ namespace OHOS { namespace DistributedHardware { -void CompEnableTraceStart(const DHType dhType) +void DHCompMgrTraceStart(const std::string &anonyNetworkId, const std::string &anonyDHId, const std::string &msg) { - std::string dhTypeStr = "UNKNOWN"; - auto it = DHTypeStrMap.find(dhType); - if (it != DHTypeStrMap.end()) { - dhTypeStr = it->second; - } - StartTrace(DHFWK_HITRACE_LABEL, dhTypeStr + "_ENABLE_START"); + StartTrace(DHFWK_HITRACE_LABEL, anonyNetworkId + "_" + anonyDHId + "_" + msg); } -void CompDisableTraceStart(const DHType dhType) +void DHQeryTraceStart(const DHType dhType) { std::string dhTypeStr = "UNKNOWN"; auto it = DHTypeStrMap.find(dhType); if (it != DHTypeStrMap.end()) { dhTypeStr = it->second; } - StartTrace(DHFWK_HITRACE_LABEL, dhTypeStr + "_DISABLE_START"); + StartTrace(DHFWK_HITRACE_LABEL, dhTypeStr + "_" + QUERY_START); } void DHTraceStart(const std::string &msg)