Add time record

Signed-off-by: wangzhen <wangzhen416@huawei.com>
Change-Id: Ia3ded948d8b6b3c8292fa3f808efe6a4ea3ae333
This commit is contained in:
wangzhen
2025-09-04 15:49:32 +08:00
parent a66a45bc7e
commit fcc26559cf
3 changed files with 24 additions and 14 deletions
@@ -192,7 +192,7 @@ ErrCode BundleMgrHelper::GetSandboxExtAbilityInfos(const Want &want, int32_t app
return ERR_APPEXECFWK_SANDBOX_INSTALL_INTERNAL_ERROR;
}
RecordCostTimeUtil("GetSandboxExtAbilityInfos");
RecordCostTimeUtil timeRecord("GetSandboxExtAbilityInfos");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
return bundleMgr->GetSandboxExtAbilityInfos(want, appIndex, flags, userId, extensionInfos);
}
@@ -490,7 +490,7 @@ bool BundleMgrHelper::QueryAbilityInfo(const Want &want, AbilityInfo &abilityInf
AAFwk::Want newWant = want;
newWant.RemoveAllFd();
RecordCostTimeUtil("QueryAbilityInfoWithWant");
RecordCostTimeUtil timeRecord("QueryAbilityInfoWithWant");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
auto ret = bundleMgr->QueryAbilityInfo(newWant, abilityInfo);
SetAbilityProcessEmpty(abilityInfo);
@@ -508,7 +508,7 @@ bool BundleMgrHelper::QueryAbilityInfo(const Want &want, int32_t flags, int32_t
AAFwk::Want newWant = want;
newWant.RemoveAllFd();
RecordCostTimeUtil("QueryAbilityInfoWithFlags");
RecordCostTimeUtil timeRecord("QueryAbilityInfoWithFlags");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
auto ret = bundleMgr->QueryAbilityInfo(newWant, flags, userId, abilityInfo);
SetAbilityProcessEmpty(abilityInfo);
@@ -594,7 +594,7 @@ bool BundleMgrHelper::QueryExtensionAbilityInfos(const Want &want, const int32_t
AAFwk::Want newWant = want;
newWant.RemoveAllFd();
RecordCostTimeUtil("QueryExtensionAbilityInfos");
RecordCostTimeUtil timeRecord("QueryExtensionAbilityInfos");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
return bundleMgr->QueryExtensionAbilityInfos(newWant, flag, userId, extensionInfos);
}
@@ -623,7 +623,7 @@ bool BundleMgrHelper::GetApplicationInfo(
return false;
}
RecordCostTimeUtil("GetApplicationInfoWithFlag");
RecordCostTimeUtil timeRecord("GetApplicationInfoWithFlag");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
return bundleMgr->GetApplicationInfo(appName, flag, userId, appInfo);
}
@@ -638,7 +638,7 @@ bool BundleMgrHelper::GetApplicationInfo(
return false;
}
RecordCostTimeUtil("GetApplicationInfoWithFlags");
RecordCostTimeUtil timeRecord("GetApplicationInfoWithFlags");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
return bundleMgr->GetApplicationInfo(appName, flags, userId, appInfo);
}
@@ -657,7 +657,7 @@ bool BundleMgrHelper::GetApplicationInfoWithAppIndex(
return false;
}
RecordCostTimeUtil("GetApplicationInfoWithAppIndex");
RecordCostTimeUtil timeRecord("GetApplicationInfoWithAppIndex");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
BundleInfo bundleInfo;
if (appIndex == 0) {
@@ -757,7 +757,7 @@ bool BundleMgrHelper::QueryAbilityInfo(
AAFwk::Want newWant = want;
newWant.RemoveAllFd();
RecordCostTimeUtil("QueryAbilityInfoWithCallback");
RecordCostTimeUtil timeRecord("QueryAbilityInfoWithCallback");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
auto ret = bundleMgr->QueryAbilityInfo(newWant, flags, userId, abilityInfo, callBack);
SetAbilityProcessEmpty(abilityInfo);
@@ -791,7 +791,7 @@ bool BundleMgrHelper::ImplicitQueryInfos(const Want &want, int32_t flags, int32_
AAFwk::Want newWant = want;
newWant.RemoveAllFd();
RecordCostTimeUtil("ImplicitQueryInfos");
RecordCostTimeUtil timeRecord("ImplicitQueryInfos");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
bool ret = bundleMgr->ImplicitQueryInfos(newWant, flags, userId, withDefault, abilityInfos,
extensionInfos, findDefaultApp);
@@ -952,7 +952,7 @@ ErrCode BundleMgrHelper::QueryCloneAbilityInfo(const ElementName &element, int32
return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
}
RecordCostTimeUtil("QueryCloneAbilityInfo");
RecordCostTimeUtil timeRecord("QueryCloneAbilityInfo");
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
auto ret = bundleMgr->QueryCloneAbilityInfo(element, flags, appCloneIndex, abilityInfo, userId);
SetAbilityProcessEmpty(abilityInfo);
@@ -421,6 +421,7 @@ void AppExitReasonDataManager::InnerDeleteAppExitReason(const std::string &keyNa
int32_t AppExitReasonDataManager::AddAbilityRecoverInfo(uint32_t accessTokenId,
const std::string &moduleName, const std::string &abilityName, const int &sessionId)
{
AAFwk::RecordCostTimeUtil timeRecord("AddAbilityRecoverInfo");
TAG_LOGI(AAFwkTag::ABILITYMGR,
"AddAbilityRecoverInfo tokenId %{private}u module %{public}s ability %{public}s id %{public}d ",
accessTokenId, moduleName.c_str(), abilityName.c_str(), sessionId);
@@ -471,13 +472,12 @@ int32_t AppExitReasonDataManager::AddAbilityRecoverInfo(uint32_t accessTokenId,
return ERR_INVALID_OPERATION;
}
InnerAddSessionId(sessionId, accessTokenId);
TAG_LOGI(AAFwkTag::ABILITYMGR, "AddAbilityRecoverInfo finish");
return ERR_OK;
}
int32_t AppExitReasonDataManager::DeleteAllRecoverInfoByTokenId(uint32_t tokenId)
{
AAFwk::RecordCostTimeUtil timeRecord("DeleteAllRecoverInfoByTokenId");
TAG_LOGI(AAFwkTag::ABILITYMGR, "tokenId: %{private}u", tokenId);
{
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
@@ -514,6 +514,7 @@ int32_t AppExitReasonDataManager::DeleteAllRecoverInfoByTokenId(uint32_t tokenId
int32_t AppExitReasonDataManager::DeleteAbilityRecoverInfoBySessionId(const int32_t sessionId)
{
AAFwk::RecordCostTimeUtil timeRecord("DeleteAbilityRecoverInfoBySessionId");
TAG_LOGI(AAFwkTag::ABILITYMGR, "sessionId %{public}d", sessionId);
{
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
@@ -561,6 +562,7 @@ int32_t AppExitReasonDataManager::DeleteAbilityRecoverInfoBySessionId(const int3
int32_t AppExitReasonDataManager::DeleteAbilityRecoverInfo(
uint32_t accessTokenId, const std::string &moduleName, const std::string &abilityName)
{
AAFwk::RecordCostTimeUtil timeRecord("DeleteAbilityRecoverInfo");
TAG_LOGI(AAFwkTag::ABILITYMGR, "tokenId %{private}u module %{public}s ability %{public}s ",
accessTokenId, moduleName.c_str(), abilityName.c_str());
{
@@ -610,6 +612,7 @@ int32_t AppExitReasonDataManager::DeleteAbilityRecoverInfo(
int32_t AppExitReasonDataManager::GetAbilityRecoverInfo(
uint32_t accessTokenId, const std::string &moduleName, const std::string &abilityName, bool &hasRecoverInfo)
{
AAFwk::RecordCostTimeUtil timeRecord("GetAbilityRecoverInfo");
TAG_LOGI(AAFwkTag::ABILITYMGR, "tokenId %{private}u module %{public}s abillity %{public}s",
accessTokenId, moduleName.c_str(), abilityName.c_str());
hasRecoverInfo = false;
@@ -651,6 +654,7 @@ int32_t AppExitReasonDataManager::GetAbilityRecoverInfo(
uint32_t AppExitReasonDataManager::GetTokenIdBySessionID(const int32_t sessionId)
{
AAFwk::RecordCostTimeUtil timeRecord("GetTokenIdBySessionID");
if (kvStorePtr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "null kvStorePtr_");
return ERR_NO_INIT;
@@ -706,6 +710,7 @@ bool AppExitReasonDataManager::GetUIExtensionAbilityExitReason(const std::string
AAFwk::ExitReason &exitReason, AppExecFwk::RunningProcessInfo &processInfo, int64_t &time_stamp,
bool &withKillMsg)
{
AAFwk::RecordCostTimeUtil timeRecord("GetUIExtensionAbilityExitReason");
TAG_LOGD(AAFwkTag::ABILITYMGR, "called");
{
std::lock_guard<std::mutex> lock(kvStorePtrMutex_);
@@ -739,6 +744,7 @@ bool AppExitReasonDataManager::GetUIExtensionAbilityExitReason(const std::string
void AppExitReasonDataManager::UpdateAbilityRecoverInfo(uint32_t accessTokenId,
const std::vector<std::string> &recoverInfoList, const std::vector<int> &sessionIdList)
{
AAFwk::RecordCostTimeUtil timeRecord("UpdateAbilityRecoverInfo");
if (kvStorePtr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "null kvStorePtr_");
return;
@@ -822,6 +828,7 @@ void AppExitReasonDataManager::ConvertAccessTokenIdFromValue(const DistributedKv
void AppExitReasonDataManager::InnerDeleteAbilityRecoverInfo(uint32_t accessTokenId)
{
AAFwk::RecordCostTimeUtil timeRecord("InnerDeleteAbilityRecoverInfo");
if (kvStorePtr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "null kvStorePtr_");
return;
@@ -841,6 +848,8 @@ void AppExitReasonDataManager::InnerDeleteAbilityRecoverInfo(uint32_t accessToke
void AppExitReasonDataManager::InnerAddSessionId(const int sessionId, uint32_t accessTokenId)
{
AAFwk::RecordCostTimeUtil timeRecord("InnerAddSessionId");
TAG_LOGI(AAFwkTag::ABILITYMGR, "InnerAddSessionId begin");
if (kvStorePtr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "null kvStorePtr_");
return;
@@ -861,6 +870,7 @@ void AppExitReasonDataManager::InnerAddSessionId(const int sessionId, uint32_t a
void AppExitReasonDataManager::InnerDeleteSessionId(const int sessionId)
{
AAFwk::RecordCostTimeUtil timeRecord("InnerDeleteSessionId");
if (kvStorePtr_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "null kvStorePtr_");
return;
@@ -118,7 +118,7 @@ int32_t AbilityEcologicalRuleMgrServiceClient::EvaluateResolveInfos(const AAFwk:
const vector<AppExecFwk::ExtensionAbilityInfo> &extInfos)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
RecordCostTimeUtil("EvaluateResolveInfos");
RecordCostTimeUtil timeRecord("EvaluateResolveInfos");
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "want: %{private}s, callerInfo: %{public}s, type: %{public}d",
want.ToString().c_str(), callerInfo.ToString().c_str(), type);
if (!CheckConnectService()) {
@@ -131,7 +131,7 @@ int32_t AbilityEcologicalRuleMgrServiceClient::QueryStartExperience(const OHOS::
const AbilityCallerInfo &callerInfo, AbilityExperienceRule &rule)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
RecordCostTimeUtil("QueryStartExperience");
RecordCostTimeUtil timeRecord("QueryStartExperience");
TAG_LOGD(AAFwkTag::ECOLOGICAL_RULE, "callerInfo: %{public}s, want: %{private}s", callerInfo.ToString().c_str(),
want.ToString().c_str());