加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BUILD.gn 8.17 KB
一键复制 编辑 原始数据 按行查看 历史
太帅太烦恼 提交于 2024-04-29 16:11 . FFRT对接Taskpool
# Copyright (c) 2023 Huawei Device Co., Ltd.
# 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")
import("ffrt.gni")
defines = []
config("ffrt_config") {
visibility = [ ":*" ]
include_dirs = [
"interfaces/kits",
"interfaces/inner_api",
]
ffrt_defaults_cflags = [
"-g",
"-D_FORTIFY_SOURCE=2",
"-O2",
"-fPIC",
"-Wno-unused-variable",
"-Wno-unused-function",
"-Wno-unused-value",
"-Wno-unused-private-field",
"-Wno-shadow",
"-Wno-float-equal",
"-Wno-unused-parameter",
"-DOHOS_STANDARD_SYSTEM",
"-DTASKSTAT_LOG_ENABLE=0",
"-DIDLE_WORKER_DESTRUCT",
"-DOHOS_THREAD_STACK_DUMP",
"-DUSE_OHOS_QOS",
"-DFFRT_IO_TASK_SCHEDULER",
"-DFFRT_PTHREAD_ENABLE",
"-DFFRT_OH_WATCHDOG_ENABLE",
]
cflags = ffrt_defaults_cflags
cflags_cc = ffrt_defaults_cflags
cflags_cc += [ "-std=c++17" ]
ffrt_debug_defines = [
"FFRT_LOG_LEVEL=3",
"FFRT_BBOX_ENABLE",
"FFRT_OH_EVENT_RECORD",
"FFRT_CO_BACKTRACE_OH_ENABLE",
"FFRT_OH_TRACE_ENABLE",
"FFRT_TRACE_LEVEL=1",
"ASYNC_STACKTRACE",
]
#ffrt_release_defines = [
# "FFRT_LOG_LEVEL=0",
# "FFRT_RELEASE",
#]
defines += ffrt_debug_defines
if (is_asan) {
defines += [ "ASAN_MODE" ]
}
if (target_cpu == "arm") {
defines += [ "APP_USE_ARM" ]
}
if (is_ohos) {
defines += [ "FFRT_TASK_LOCAL_ENABLE" ]
}
#defines += ffrt_release_defines
defines += [ "FFRT_HITRACE_ENABLE" ]
}
config("ffrt_inner_config") {
include_dirs = [
"src",
"src/dfx/log",
"src/dfx/trace",
"src/sched",
]
if (is_ohos && is_clang && (target_cpu == "arm" || target_cpu == "arm64")) {
cflags = [
"-flto=thin",
"-fsplit-lto-unit",
]
}
}
ohos_shared_library("libffrt") {
if (ffrt_support_enable) {
public_configs = [ ":ffrt_config" ]
configs = [ ":ffrt_inner_config" ]
ldflags = [ "-Wl,-z,nodelete" ]
sources = [
"src/core/entity.cpp",
"src/core/task.cpp",
"src/core/task_io.cpp",
"src/core/version_ctx.cpp",
"src/dfx/bbox/bbox.cpp",
"src/dfx/bbox/fault_logger_fd_manager.cpp",
"src/dfx/dump/dump.cpp",
"src/dfx/log/ffrt_log.cpp",
"src/dfx/trace/ffrt_trace.cpp",
"src/dfx/watchdog/watchdog.cpp",
"src/dfx/watchdog/watchdog_util.cpp",
"src/dm/dependence_manager.cpp",
"src/dm/sdependence_manager.cpp",
"src/eu/co2_context.c",
"src/eu/co_routine.cpp",
"src/eu/co_routine_factory.cpp",
"src/eu/cpu_monitor.cpp",
"src/eu/cpu_worker.cpp",
"src/eu/cpuworker_manager.cpp",
"src/eu/execute_unit.cpp",
"src/eu/loop.cpp",
"src/eu/loop_api.cpp",
"src/eu/osattr_manager.cpp",
"src/eu/qos_convert.cpp",
"src/eu/qos_interface.cpp",
"src/eu/rtg_ioctl.cpp",
"src/eu/rtg_perf_ctrl.cpp",
"src/eu/scpu_monitor.cpp",
"src/eu/scpuworker_manager.cpp",
"src/eu/sexecute_unit.cpp",
"src/eu/worker_manager.cpp",
"src/eu/worker_thread.cpp",
"src/ipc/ipc.cpp",
"src/queue/queue_monitor.cpp",
"src/queue/serial_handler.cpp",
"src/queue/serial_queue.cpp",
"src/queue/serial_queue_api.cpp",
"src/queue/serial_task.cpp",
"src/sched/deadline.cpp",
"src/sched/execute_ctx.cpp",
"src/sched/frame_interval.cpp",
"src/sched/interval.cpp",
"src/sched/load_tracking.cpp",
"src/sched/multi_workgroup.cpp",
"src/sched/qos.cpp",
"src/sched/sched_deadline.cpp",
"src/sched/scheduler.cpp",
"src/sched/task_manager.cpp",
"src/sched/task_state.cpp",
"src/sync/condition_variable.cpp",
"src/sync/delayed_worker.cpp",
"src/sync/io_poller.cpp",
"src/sync/mutex.cpp",
"src/sync/perf_counter.cpp",
"src/sync/poller.cpp",
"src/sync/poller_api.cpp",
"src/sync/sleep.cpp",
"src/sync/sync.cpp",
"src/sync/thread.cpp",
"src/sync/timer_api.cpp",
"src/sync/wait_queue.cpp",
"src/tm/cpu_task.cpp",
"src/tm/scpu_task.cpp",
"src/tm/task_factory.cpp",
"src/util/graph_check.cpp",
"src/util/init.cpp",
"src/util/spmc_queue.cpp",
"src/util/worker_monitor.cpp",
]
external_deps = [
"bounds_checking_function:libsec_shared",
"c_utils:utils",
"eventhandler:libeventhandler",
"faultloggerd:libasync_stack",
"faultloggerd:libbacktrace_local",
"faultloggerd:libdfx_dumpcatcher",
"faultloggerd:libfaultloggerd",
"hilog:libhilog",
"hisysevent:libhisysevent",
"hitrace:libhitracechain",
"libunwind:libunwind",
]
if (ffrt_profiler_enable && !is_emulator) {
external_deps += [
"hiprofiler:libffrt_profiler",
"init:libbegetutil",
]
defines = [ "FFRT_PROFILER" ]
}
output_extension = "so"
part_name = "ffrt"
subsystem_name = "resourceschedule"
install_images = [
"system",
"updater",
]
innerapi_tags = [
"chipsetsdk",
"sasdk",
]
}
}
ohos_shared_library("ffrt_ndk") {
output_name = "ffrt"
configs = [
":ffrt_config",
":ffrt_inner_config",
]
sources = [
"src/core/entity.cpp",
"src/core/task.cpp",
"src/core/task_io.cpp",
"src/core/version_ctx.cpp",
"src/dfx/bbox/bbox.cpp",
"src/dfx/bbox/fault_logger_fd_manager.cpp",
"src/dfx/dump/dump.cpp",
"src/dfx/log/ffrt_log.cpp",
"src/dfx/trace/ffrt_trace.cpp",
"src/dfx/watchdog/watchdog.cpp",
"src/dfx/watchdog/watchdog_util.cpp",
"src/dm/dependence_manager.cpp",
"src/dm/sdependence_manager.cpp",
"src/eu/co2_context.c",
"src/eu/co_routine.cpp",
"src/eu/co_routine_factory.cpp",
"src/eu/cpu_monitor.cpp",
"src/eu/cpu_worker.cpp",
"src/eu/cpuworker_manager.cpp",
"src/eu/execute_unit.cpp",
"src/eu/loop.cpp",
"src/eu/loop_api.cpp",
"src/eu/osattr_manager.cpp",
"src/eu/qos_convert.cpp",
"src/eu/qos_interface.cpp",
"src/eu/rtg_ioctl.cpp",
"src/eu/rtg_perf_ctrl.cpp",
"src/eu/scpu_monitor.cpp",
"src/eu/scpuworker_manager.cpp",
"src/eu/sexecute_unit.cpp",
"src/eu/worker_manager.cpp",
"src/eu/worker_thread.cpp",
"src/ipc/ipc.cpp",
"src/queue/queue_monitor.cpp",
"src/queue/serial_handler.cpp",
"src/queue/serial_queue.cpp",
"src/queue/serial_queue_api.cpp",
"src/queue/serial_task.cpp",
"src/sched/deadline.cpp",
"src/sched/execute_ctx.cpp",
"src/sched/frame_interval.cpp",
"src/sched/interval.cpp",
"src/sched/load_tracking.cpp",
"src/sched/multi_workgroup.cpp",
"src/sched/qos.cpp",
"src/sched/sched_deadline.cpp",
"src/sched/scheduler.cpp",
"src/sched/task_manager.cpp",
"src/sched/task_state.cpp",
"src/sync/condition_variable.cpp",
"src/sync/delayed_worker.cpp",
"src/sync/io_poller.cpp",
"src/sync/mutex.cpp",
"src/sync/perf_counter.cpp",
"src/sync/poller.cpp",
"src/sync/poller_api.cpp",
"src/sync/sleep.cpp",
"src/sync/sync.cpp",
"src/sync/thread.cpp",
"src/sync/timer_api.cpp",
"src/sync/wait_queue.cpp",
"src/tm/cpu_task.cpp",
"src/tm/scpu_task.cpp",
"src/tm/task_factory.cpp",
"src/util/graph_check.cpp",
"src/util/init.cpp",
"src/util/spmc_queue.cpp",
"src/util/worker_monitor.cpp",
]
external_deps = [
"bounds_checking_function:libsec_shared",
"c_utils:utils",
"eventhandler:libeventhandler",
"faultloggerd:libasync_stack",
"faultloggerd:libbacktrace_local",
"faultloggerd:libdfx_dumpcatcher",
"faultloggerd:libfaultloggerd",
"hilog:libhilog",
"hisysevent:libhisysevent",
"hitrace:libhitracechain",
"libunwind:libunwind",
]
part_name = "ffrt"
subsystem_name = "resourceschedule"
innerapi_tags = [ "ndk" ]
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化