code optimization

Signed-off-by: yuyanqinghw <yuyanqing539@huawei.com>
This commit is contained in:
yuyanqinghw 2024-03-18 19:20:36 +08:00
parent 3dcfdc5b0f
commit 1964f8c072
3 changed files with 16 additions and 11 deletions

View File

@ -195,7 +195,6 @@ ohos_source_set("hiperf_platform_common") {
if (is_ohos) {
external_deps = [
"ability_base:extractortool",
"c_utils:utils",
"faultloggerd:libunwinder_static",
"hilog:libhilog",
@ -210,6 +209,11 @@ ohos_source_set("hiperf_platform_common") {
]
defines += [ "BUNDLE_FRAMEWORK_ENABLE" ]
}
if (ability_base_enable) {
external_deps += [
"ability_base:extractortool",
]
}
} else {
external_deps = [ "faultloggerd:unwinder_host" ]
defines += [ "CONFIG_NO_HILOG" ]

View File

@ -32,10 +32,15 @@ declare_args() {
hiperf_code_analyze = false
hiperf_use_syspara = true
bundle_framework_enable = false
ability_base_enable = false
if (defined(global_parts_info) &&
defined(global_parts_info.bundlemanager_bundle_framework)) {
bundle_framework_enable = true
}
if (defined(global_parts_info) &&
defined(global_parts_info.ability_ability_base)) {
ability_base_enable = true
}
}
code_check_flag = []

View File

@ -1248,20 +1248,16 @@ std::unique_ptr<SymbolsFile> SymbolsFile::LoadSymbolsFromSaved(
symbolsFile->textExecVaddrFileOffset_ = symbolFileStruct.textExecVaddrFileOffset_;
symbolsFile->buildId_ = symbolFileStruct.buildId_;
for (auto &symbolStruct : symbolFileStruct.symbolStructs_) {
if (isHapSymbolFile) {
symbolsFile->symbolsMap_.insert(std::make_pair(
symbolStruct.vaddr_, // should use pc. or fileVaddr.
DfxSymbol(symbolStruct.vaddr_,
symbolStruct.len_,
symbolStruct.symbolName_,
symbolFileStruct.filePath_)
));
symbolsFile->SetBoolValue(true);
}
symbolsFile->symbols_.emplace_back(symbolStruct.vaddr_, symbolStruct.len_,
symbolStruct.symbolName_, symbolFileStruct.filePath_);
}
symbolsFile->AdjustSymbols(); // reorder
if (isHapSymbolFile) {
for (const auto& symbol : symbolsFile->symbols_) {
symbolsFile->symbolsMap_.emplace(symbol.funcVaddr_, symbol);
}
symbolsFile->SetBoolValue(true);
}
symbolsFile->debugInfoLoadResult_ = true;
symbolsFile->symbolsLoaded_ = true; // all ready LoadFrom perf.data
HLOGV("load %zu symbol from SymbolFileStruct for file '%s'", symbolsFile->symbols_.size(),