2023-06-12 08:36:40 +00:00
|
|
|
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
2021-12-24 08:46:38 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
import("//build/ohos.gni")
|
2023-05-15 11:44:11 +00:00
|
|
|
import("./hiperf.gni")
|
2021-12-24 08:46:38 +00:00
|
|
|
|
2022-09-07 13:20:29 +00:00
|
|
|
declare_args() {
|
2022-12-29 09:20:02 +00:00
|
|
|
hiperf_feature_mingw_uapi_dir =
|
2023-05-15 11:44:11 +00:00
|
|
|
"../../kernel/linux/patches/linux-5.10/prebuilts/usr/include"
|
2022-09-07 13:20:29 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
function_disable_define = []
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
config("hiperf_inner_config") {
|
|
|
|
visibility = [ ":*" ]
|
|
|
|
ldflags = []
|
|
|
|
cflags = code_check_flag
|
|
|
|
defines = function_disable_define
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_code_analyze && is_ohos) {
|
2021-12-24 08:46:38 +00:00
|
|
|
cflags += code_analyze_flag
|
|
|
|
cflags -= [ "-Werror" ]
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (is_mingw) {
|
2021-12-24 08:46:38 +00:00
|
|
|
# lld: error: unable to find library -latomic
|
|
|
|
# lld: error: unable to find library -ldl
|
|
|
|
# lld: error: unable to find library -lrt
|
2021-12-25 09:34:04 +00:00
|
|
|
ldflags += [
|
|
|
|
"-Wl,--whole-archive",
|
|
|
|
"-lpthread",
|
|
|
|
"-Wl,--no-whole-archive",
|
|
|
|
]
|
|
|
|
} else if (is_linux) {
|
|
|
|
ldflags += [
|
|
|
|
"-Wl,--whole-archive",
|
|
|
|
"-lpthread",
|
|
|
|
"-latomic",
|
|
|
|
"-ldl",
|
|
|
|
"-lrt",
|
|
|
|
"-Wl,--no-whole-archive",
|
|
|
|
]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
include_dirs = [ "${hiperf_path}/include" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
# debug link
|
|
|
|
# ldflags += [ "-v"]
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_debug) {
|
2021-12-24 08:46:38 +00:00
|
|
|
defines += [
|
|
|
|
"HIPERF_DEBUG",
|
2021-12-25 09:34:04 +00:00
|
|
|
"HIPERF_DEBUG_PRINTF", # if u want to see printf in the log ?
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_check_time) {
|
|
|
|
defines += [ "HIPERF_DEBUG_TIME" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cflags += [ "-std=c++17" ]
|
|
|
|
defines += [ "is_mingw=${is_mingw}" ]
|
|
|
|
defines += [ "is_linux=${is_linux}" ]
|
|
|
|
defines += [ "is_ohos=${is_ohos}" ]
|
2023-11-27 12:52:12 +00:00
|
|
|
defines += [ "is_emulator=${is_emulator}" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
defines += [ "is_double_framework=${is_double_framework}" ]
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_host) {
|
2021-12-24 08:46:38 +00:00
|
|
|
defines += [ "target_cpu_${host_cpu}" ]
|
|
|
|
} else {
|
|
|
|
defines += [ "target_cpu_${target_cpu}" ]
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (is_mingw) {
|
2021-12-24 08:46:38 +00:00
|
|
|
cflags += [ "-includeMingW64Fix.h" ]
|
2021-12-25 09:34:04 +00:00
|
|
|
defines += [ "WIN32_LEAN_AND_MEAN" ]
|
2022-05-05 01:59:58 +00:00
|
|
|
defines += [ "__LITTLE_ENDIAN_BITFIELD" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
2022-09-07 13:20:29 +00:00
|
|
|
include_dirs += [
|
|
|
|
"${hiperf_path}/include/nonlinux/",
|
|
|
|
hiperf_feature_mingw_uapi_dir,
|
|
|
|
]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_test_coverage && is_ohos) {
|
|
|
|
cflags += [
|
|
|
|
"-fprofile-arcs",
|
|
|
|
"-ftest-coverage",
|
|
|
|
]
|
2021-12-24 08:46:38 +00:00
|
|
|
ldflags += [ "--coverage" ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sources_platform_common = [
|
|
|
|
"./src/perf_file_format.cpp",
|
|
|
|
"./src/command.cpp",
|
|
|
|
"./src/subcommand.cpp",
|
|
|
|
"./src/option.cpp",
|
|
|
|
"./src/utilities.cpp",
|
|
|
|
"./src/symbols_file.cpp",
|
|
|
|
"./src/virtual_runtime.cpp",
|
|
|
|
"./src/virtual_thread.cpp",
|
|
|
|
"./src/perf_file_reader.cpp",
|
|
|
|
"./src/perf_event_record.cpp",
|
|
|
|
"./src/dwarf_encoding.cpp",
|
|
|
|
"./src/subcommand_help.cpp",
|
|
|
|
"./src/subcommand_dump.cpp",
|
|
|
|
"./src/subcommand_report.cpp",
|
|
|
|
"./src/report.cpp",
|
|
|
|
"./src/report_json_file.cpp",
|
2023-06-12 08:36:40 +00:00
|
|
|
"./src/register.cpp",
|
2023-12-01 09:39:33 +00:00
|
|
|
"./src/unique_stack_table.cpp",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
if (is_ohos) {
|
|
|
|
sources_platform_common += [ "./src/callstack.cpp" ]
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_debug) {
|
2021-12-24 08:46:38 +00:00
|
|
|
sources_platform_common += [
|
|
|
|
"./src/debug_logger.cpp",
|
|
|
|
"./src/option_debug.cpp",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
sources_platform_linux = [
|
|
|
|
"./src/perf_events.cpp",
|
|
|
|
"./src/tracked_command.cpp",
|
|
|
|
"./src/ring_buffer.cpp",
|
|
|
|
"./src/perf_file_writer.cpp",
|
|
|
|
"./src/subcommand_stat.cpp",
|
|
|
|
"./src/subcommand_record.cpp",
|
|
|
|
"./src/subcommand_list.cpp",
|
|
|
|
]
|
|
|
|
|
|
|
|
common_deps = [
|
2021-12-25 09:34:04 +00:00
|
|
|
":support_elf",
|
|
|
|
":support_protobuf",
|
2022-02-17 06:47:36 +00:00
|
|
|
"//third_party/bounds_checking_function:libsec_static",
|
2022-02-17 07:41:57 +00:00
|
|
|
"//third_party/zlib:libz",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
common_configs = [
|
|
|
|
":hiperf_inner_config",
|
|
|
|
"//third_party/bounds_checking_function:libsec_public_config",
|
|
|
|
"../../commonlibrary/c_utils/base:utils_config",
|
|
|
|
"//third_party/googletest:gtest_config",
|
|
|
|
]
|
2023-06-12 08:36:40 +00:00
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
if (is_ohos) {
|
2022-02-17 06:47:36 +00:00
|
|
|
common_deps += [ "//third_party/bounds_checking_function:libsec_shared" ]
|
|
|
|
common_deps -= [ "//third_party/bounds_checking_function:libsec_static" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_static) {
|
2021-12-24 08:46:38 +00:00
|
|
|
common_deps -= [ ":support_protobuf" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
config("hiperf_syspara_config") {
|
|
|
|
defines = [ "CONFIG_HAS_SYSPARA" ]
|
|
|
|
}
|
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
config("libunwinder_config") {
|
|
|
|
defines = [ "HAVE_LIBUNWINDER=1" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hiperf_use_libunwinder) {
|
|
|
|
common_configs += [ ":libunwinder_config" ]
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (is_ohos && hiperf_use_syspara) {
|
2021-12-24 08:46:38 +00:00
|
|
|
common_configs += [ ":hiperf_syspara_config" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_source_set("hiperf_platform_common") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2021-12-24 08:46:38 +00:00
|
|
|
use_exceptions = true
|
|
|
|
public_deps = common_deps
|
|
|
|
public_configs = common_configs
|
|
|
|
defines = []
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (is_ohos) {
|
2023-02-01 13:18:57 +00:00
|
|
|
external_deps = [
|
|
|
|
"c_utils:utils",
|
2023-08-26 08:20:03 +00:00
|
|
|
"faultloggerd:libunwinder_static",
|
2023-06-19 02:24:25 +00:00
|
|
|
"hilog:libhilog",
|
2023-05-31 07:44:47 +00:00
|
|
|
"init:libbegetutil",
|
2023-02-01 13:18:57 +00:00
|
|
|
"ipc:ipc_core",
|
|
|
|
"samgr:samgr_proxy",
|
|
|
|
]
|
2023-11-29 09:14:27 +00:00
|
|
|
if (bundle_framework_enable) {
|
|
|
|
external_deps += [
|
|
|
|
"bundle_framework:appexecfwk_base",
|
|
|
|
"bundle_framework:appexecfwk_core",
|
|
|
|
]
|
|
|
|
defines += [ "BUNDLE_FRAMEWORK_ENABLE" ]
|
|
|
|
}
|
2024-03-18 11:20:36 +00:00
|
|
|
if (ability_base_enable) {
|
2024-03-18 11:41:30 +00:00
|
|
|
external_deps += [ "ability_base:extractortool" ]
|
2024-04-10 03:19:46 +00:00
|
|
|
defines += [ "ENABLE_HAP_EXTRACTOR" ]
|
2024-03-18 11:20:36 +00:00
|
|
|
}
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
2023-08-26 08:20:03 +00:00
|
|
|
external_deps = [ "faultloggerd:unwinder_host" ]
|
2021-12-25 09:34:04 +00:00
|
|
|
defines += [ "CONFIG_NO_HILOG" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
sources = sources_platform_common
|
|
|
|
}
|
|
|
|
|
|
|
|
config("platform_linux_config") {
|
2021-12-25 09:34:04 +00:00
|
|
|
defines = [ "SUPPORT_PERF_EVENT" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ohos_source_set("hiperf_platform_linux") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2021-12-24 08:46:38 +00:00
|
|
|
use_exceptions = true
|
|
|
|
public_deps = common_deps
|
|
|
|
public_configs = common_configs
|
|
|
|
|
2023-05-31 07:44:47 +00:00
|
|
|
if (is_ohos) {
|
2023-08-26 08:20:03 +00:00
|
|
|
external_deps = [
|
|
|
|
"faultloggerd:libunwinder_static",
|
2024-03-14 08:29:19 +00:00
|
|
|
"hilog:libhilog",
|
2023-08-26 08:20:03 +00:00
|
|
|
"init:libbegetutil",
|
|
|
|
]
|
|
|
|
} else {
|
|
|
|
external_deps = [ "faultloggerd:unwinder_host" ]
|
2023-05-31 07:44:47 +00:00
|
|
|
}
|
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
public_configs += [ ":platform_linux_config" ]
|
|
|
|
configs = [ "interfaces/innerkits/native:hiperf_client_config" ]
|
|
|
|
|
|
|
|
sources = sources_platform_linux
|
|
|
|
}
|
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
config("libunwind_config") {
|
2023-06-12 08:36:40 +00:00
|
|
|
defines = [ "HAVE_LIBUNWIND=1" ]
|
|
|
|
}
|
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
config("elf_config") {
|
|
|
|
}
|
|
|
|
ohos_source_set("support_elf") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2021-12-25 09:34:04 +00:00
|
|
|
public_configs = common_configs
|
|
|
|
public_configs += [ ":elf_config" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
config("protobuf_config") {
|
|
|
|
defines = [ "HAVE_PROTOBUF=1" ]
|
|
|
|
include_dirs = [
|
|
|
|
"//third_party/protobuf/src",
|
|
|
|
"//third_party/protobuf/src/google",
|
2021-12-25 09:34:04 +00:00
|
|
|
"//third_party/protobuf/src/google/protobuf",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_source_set("support_protobuf") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2021-12-24 08:46:38 +00:00
|
|
|
use_exceptions = true
|
2021-12-25 09:34:04 +00:00
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
#protobuf
|
|
|
|
public_configs = common_configs
|
2021-12-25 09:34:04 +00:00
|
|
|
public_configs += [ ":protobuf_config" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
public_deps = [
|
|
|
|
":proto_file_cpp",
|
2022-02-17 06:47:36 +00:00
|
|
|
"//third_party/bounds_checking_function:libsec_static",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
if (is_ohos) {
|
2024-03-30 07:22:29 +00:00
|
|
|
external_deps = [ "faultloggerd:libunwinder_static" ]
|
2023-08-26 08:20:03 +00:00
|
|
|
} else {
|
|
|
|
external_deps = [ "faultloggerd:unwinder_host" ]
|
|
|
|
}
|
|
|
|
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./src/report_protobuf_file.cpp" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#protobuf {
|
|
|
|
proto_file_defines = [
|
|
|
|
# add your proto file here
|
2021-12-25 09:34:04 +00:00
|
|
|
"report_sample",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
proto_base_dir = "proto"
|
|
|
|
proto_out_dir = "$target_gen_dir" + "/" + proto_base_dir
|
|
|
|
|
|
|
|
proto_file_codegen = []
|
|
|
|
proto_file_sources = []
|
|
|
|
|
|
|
|
foreach(proto_file, proto_file_defines) {
|
|
|
|
proto_file_codegen += [
|
|
|
|
"$proto_out_dir" + "/" + "$proto_file.pb.h",
|
|
|
|
"$proto_out_dir" + "/" + "$proto_file.pb.cc",
|
|
|
|
]
|
2021-12-25 09:34:04 +00:00
|
|
|
proto_file_sources += [ "$proto_base_dir" + "/" + "$proto_file.proto" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# this is so bad , but someone config the protoc's subsystem_name
|
|
|
|
# the better way is build system need provider host tools path or prebuild tools path
|
2023-06-05 11:05:28 +00:00
|
|
|
protoc_subsystem_out_path = "thirdparty/protobuf"
|
2021-12-25 09:34:04 +00:00
|
|
|
|
|
|
|
if (default_toolchain == current_toolchain) {
|
2021-12-24 08:46:38 +00:00
|
|
|
#if target build
|
2021-12-25 09:34:04 +00:00
|
|
|
host_out_path = "/" + get_label_info(host_toolchain, "name")
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
|
|
|
#if host build (for some linke mingw)
|
2021-12-25 09:34:04 +00:00
|
|
|
host_out_path = "/../" + get_label_info(host_toolchain, "name")
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
2021-12-25 09:34:04 +00:00
|
|
|
host_protoc_path =
|
|
|
|
root_out_dir + host_out_path + "/" + protoc_subsystem_out_path + "/protoc"
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
action("hiperf_host_build_proto") {
|
2024-06-19 05:02:28 +00:00
|
|
|
deps = [
|
|
|
|
"//third_party/protobuf:protoc(//build/toolchain/linux:clang_${host_cpu})",
|
|
|
|
]
|
2021-12-24 08:46:38 +00:00
|
|
|
args = []
|
|
|
|
outputs = proto_file_codegen
|
|
|
|
sources = []
|
|
|
|
script = "proto/build_proto.sh"
|
|
|
|
|
|
|
|
args += [ rebase_path(host_protoc_path) ]
|
2021-12-25 09:34:04 +00:00
|
|
|
args += [
|
|
|
|
"--proto_path",
|
|
|
|
rebase_path(proto_base_dir),
|
|
|
|
]
|
|
|
|
args += [
|
|
|
|
"--cpp_out",
|
|
|
|
rebase_path(proto_out_dir),
|
|
|
|
]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
foreach(proto_file_source, proto_file_sources) {
|
|
|
|
#tell gn to check which files as source time
|
|
|
|
sources += [ rebase_path(proto_file_source) ]
|
|
|
|
args += [ rebase_path(proto_file_source) ]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config("proto_file_cpp_config") {
|
2021-12-25 09:34:04 +00:00
|
|
|
include_dirs = [ proto_out_dir ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ohos_source_set("proto_file_cpp") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2021-12-24 08:46:38 +00:00
|
|
|
cflags = []
|
|
|
|
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ ":hiperf_host_build_proto" ]
|
|
|
|
public_deps = [ "//third_party/protobuf:protobuf_lite_static" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
sources = proto_file_codegen
|
|
|
|
public_configs = [ ":proto_file_cpp_config" ]
|
|
|
|
}
|
2021-12-25 09:34:04 +00:00
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
#protobuf }
|
|
|
|
|
|
|
|
ohos_executable("hiperf") {
|
|
|
|
install_enable = true
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./src/main.cpp" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
deps = [
|
2023-01-29 07:05:21 +00:00
|
|
|
":hiperf_etc",
|
2021-12-24 08:46:38 +00:00
|
|
|
":hiperf_platform_common",
|
|
|
|
":hiperf_platform_linux",
|
|
|
|
]
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_static) {
|
2021-12-24 08:46:38 +00:00
|
|
|
static_link = true
|
|
|
|
}
|
|
|
|
|
2021-12-25 09:34:04 +00:00
|
|
|
if (is_linux || is_mingw) {
|
2021-12-24 08:46:38 +00:00
|
|
|
# ld.lld: error: attempted static link of dynamic object hiviewdfx/hilog_native/libhilog.so
|
|
|
|
static_link = true
|
|
|
|
}
|
|
|
|
|
2024-03-10 06:10:44 +00:00
|
|
|
external_deps = [
|
|
|
|
"faultloggerd:libunwinder_static",
|
|
|
|
"hilog:libhilog",
|
|
|
|
]
|
2023-08-26 08:20:03 +00:00
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("hiperf_host") {
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./src/main.cpp" ]
|
|
|
|
deps = [ ":hiperf_platform_common" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
2022-01-14 06:09:16 +00:00
|
|
|
if (use_musl) {
|
|
|
|
static_link = true
|
|
|
|
}
|
2021-12-24 08:46:38 +00:00
|
|
|
|
2023-08-26 08:20:03 +00:00
|
|
|
external_deps = [ "faultloggerd:unwinder_host" ]
|
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
2023-01-29 07:05:21 +00:00
|
|
|
ohos_prebuilt_etc("hiperf.para") {
|
|
|
|
source = "etc/hiperf.para"
|
|
|
|
install_images = [
|
|
|
|
"system",
|
|
|
|
"updater",
|
|
|
|
]
|
|
|
|
module_install_dir = "etc/param"
|
|
|
|
part_name = "hiperf"
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_prebuilt_etc("hiperf.para.dac") {
|
|
|
|
source = "etc/hiperf.para.dac"
|
|
|
|
install_images = [
|
|
|
|
"system",
|
|
|
|
"updater",
|
|
|
|
]
|
|
|
|
module_install_dir = "etc/param"
|
|
|
|
part_name = "hiperf"
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_prebuilt_etc("hiperf.cfg") {
|
|
|
|
source = "etc/hiperf.cfg"
|
|
|
|
relative_install_dir = "init"
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_etc") {
|
|
|
|
deps = [
|
|
|
|
":hiperf.cfg",
|
|
|
|
":hiperf.para",
|
|
|
|
":hiperf.para.dac",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2021-12-24 08:46:38 +00:00
|
|
|
ohos_source_set("hiperf_platform_host") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2023-05-15 11:44:11 +00:00
|
|
|
subsystem_name = "developtools"
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./src/hiperf_libreport.cpp" ]
|
|
|
|
public_deps = [ ":hiperf_platform_common" ]
|
2024-03-30 07:22:29 +00:00
|
|
|
external_deps = [ "faultloggerd:unwinder_host" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ohos_shared_library("hiperf_host_lib") {
|
2024-05-30 14:11:42 +00:00
|
|
|
public_deps = [ ":hiperf_platform_host" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
output_name = "hiperf_report"
|
|
|
|
|
|
|
|
ldflags = [ "-static-libstdc++" ]
|
|
|
|
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_executable("hiperf_host_lib_demo") {
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./src/hiperf_libreport_demo.cpp" ]
|
|
|
|
deps = [ ":hiperf_host_lib" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
include_dirs = [ "${hiperf_path}/include" ]
|
|
|
|
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_copy("hiperf_host_python") {
|
2024-05-30 14:11:42 +00:00
|
|
|
sources = [ "./script" ]
|
|
|
|
outputs = [ target_out_dir + "/host/" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
|
|
|
|
module_source_dir = target_out_dir + "/$target_name"
|
|
|
|
module_install_name = ""
|
|
|
|
subsystem_name = "developtools"
|
|
|
|
part_name = "hiperf"
|
|
|
|
}
|
|
|
|
|
|
|
|
ohos_source_set("hiperf_code_analyze") {
|
2022-03-07 03:41:42 +00:00
|
|
|
part_name = "hiperf"
|
2021-12-24 08:46:38 +00:00
|
|
|
deps = [
|
|
|
|
":hiperf_platform_common",
|
|
|
|
":hiperf_platform_linux",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_target") {
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_host) {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ ":hiperf(${host_toolchain})" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ ":hiperf" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_test_target") {
|
|
|
|
testonly = true
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ "test:hiperf_test" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_target_all") {
|
2022-12-07 07:50:13 +00:00
|
|
|
if (!is_emulator) {
|
|
|
|
if (is_double_framework) {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ ":hiperf_target" ]
|
2022-12-07 07:50:13 +00:00
|
|
|
} else {
|
2023-04-17 12:44:03 +00:00
|
|
|
deps = []
|
|
|
|
if (!use_libfuzzer) {
|
|
|
|
deps += [
|
2024-06-19 05:03:37 +00:00
|
|
|
":hiperf_host(//build/toolchain/linux:clang_${host_cpu})", # host_linux
|
|
|
|
":hiperf_host_lib(//build/toolchain/linux:clang_${host_cpu})", # host_linux
|
2024-06-12 02:10:20 +00:00
|
|
|
":hiperf_host_lib_demo(//build/toolchain/linux:clang_${host_cpu})", # host_linux
|
2023-04-17 12:44:03 +00:00
|
|
|
":hiperf_host_python",
|
|
|
|
]
|
2024-05-30 13:06:20 +00:00
|
|
|
if (!is_tsan) {
|
|
|
|
deps += [
|
|
|
|
":hiperf_host(//build/toolchain/mingw:mingw_x86_64)", # host mingw
|
|
|
|
":hiperf_host_lib(//build/toolchain/mingw:mingw_x86_64)", # host_mingw
|
|
|
|
]
|
|
|
|
}
|
2023-04-17 12:44:03 +00:00
|
|
|
}
|
|
|
|
deps += [
|
2022-12-07 07:50:13 +00:00
|
|
|
":hiperf_target",
|
|
|
|
"interfaces/innerkits/native:hiperf_client", # c++ api
|
|
|
|
]
|
|
|
|
if (is_ohos) {
|
|
|
|
deps += [ "interfaces/kits/js/napi:hiperf_client_napi" ] # js api
|
|
|
|
}
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
2022-12-07 07:52:12 +00:00
|
|
|
}
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_demo") {
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_host) {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ "demo/cpp:hiperf_demo(${host_toolchain})" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ "demo/cpp:hiperf_demo" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_example_cmd") {
|
2021-12-25 09:34:04 +00:00
|
|
|
if (hiperf_target_host) {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ "demo/cpp:hiperf_example_cmd(${host_toolchain})" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ "demo/cpp:hiperf_example_cmd" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
group("hiperf_all") {
|
|
|
|
testonly = true
|
|
|
|
if (hiperf_code_analyze) {
|
2024-05-30 14:11:42 +00:00
|
|
|
deps = [ ":hiperf_code_analyze" ]
|
2021-12-24 08:46:38 +00:00
|
|
|
} else {
|
|
|
|
deps = [
|
|
|
|
":hiperf_example_cmd",
|
2021-12-25 09:34:04 +00:00
|
|
|
":hiperf_target_all",
|
2021-12-24 08:46:38 +00:00
|
|
|
]
|
2021-12-25 09:34:04 +00:00
|
|
|
if (!is_double_framework) {
|
2021-12-24 08:46:38 +00:00
|
|
|
deps += [
|
2021-12-25 09:34:04 +00:00
|
|
|
":hiperf_demo",
|
2021-12-24 08:46:38 +00:00
|
|
|
":hiperf_test_target",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|