diff --git a/bundle.json b/bundle.json index b0c965533cc7f43f8a787416156061815a64bb28..cedfa33a0140fb0b82126753e002dc73b40b8026 100644 --- a/bundle.json +++ b/bundle.json @@ -52,7 +52,8 @@ "os_account", "runtime_core", "rust_libc", - "samgr" + "samgr", + "qos_manager" ], "third_party": [] }, diff --git a/interfaces/kits/hyperaio/BUILD.gn b/interfaces/kits/hyperaio/BUILD.gn index 93b6f3c965b738c34d705d97f27326570d488aa6..517e4afc248a1d6aa9eddfebde350f5b138cda38 100644 --- a/interfaces/kits/hyperaio/BUILD.gn +++ b/interfaces/kits/hyperaio/BUILD.gn @@ -61,7 +61,10 @@ ohos_shared_library("HyperAio") { "hitrace:hitrace_meter", ] if (file_api_feature_hyperaio) { - external_deps += [ "liburing:liburing" ] + external_deps += [ + "liburing:liburing", + "qos_manager:qos" + ] } install_images = [ "system" ] part_name = "file_api" diff --git a/interfaces/kits/hyperaio/src/hyperaio.cpp b/interfaces/kits/hyperaio/src/hyperaio.cpp index 1f5dc006db5daa9b77efbde83ea1972fc9105c87..b4679698f053a43a4aadda5fbe4fa042959884df 100644 --- a/interfaces/kits/hyperaio/src/hyperaio.cpp +++ b/interfaces/kits/hyperaio/src/hyperaio.cpp @@ -23,6 +23,7 @@ #include "ipc_skeleton.h" #ifdef HYPERAIO_USE_LIBURING #include "liburing.h" +#include "qos.h" #endif namespace OHOS { namespace HyperAio { @@ -55,7 +56,7 @@ static bool HasAccessIouringPermission() static bool ValidateReqNum(uint32_t reqNum) { - return reqNum > 0 && reqNum <= URING_QUEUE_SIZE - 1; + return reqNum > 0 && reqNum <= URING_QUEUE_SIZE; } uint32_t HyperAio::SupportIouring() @@ -99,7 +100,10 @@ int32_t HyperAio::CtxInit(ProcessIoResultCallBack *callBack) if (pImpl_ == nullptr) { pImpl_ = std::make_shared(); } - + int32_t ret = OHOS::QOS::SetThreaQos(OHOS::QOS::QosLevel::QOS_USER_INTERACTIVE); + if (ret < 0) { + HILOGE("Harvest SetThreadQos failed ret = %{public}d", ret); + } int32_t ret = io_uring_queue_init(URING_QUEUE_SIZE, &pImpl_->uring_, 0); if (ret < 0) { HILOGE("init io_uring failed, ret = %{public}d", ret); @@ -259,7 +263,10 @@ void HyperAio::HarvestRes() HILOGI("pImpl is null"); return; } - + int32_t ret = OHOS::QOS::SetThreaQos(OHOS::QOS::QosLevel::QOS_USER_INTERACTIVE); + if (ret < 0) { + HILOGE("Harvest SetThreadQos failed ret = %{public}d", ret); + } while (!stopThread_.load()) { struct io_uring_cqe *cqe; int32_t ret = io_uring_wait_cqe(&pImpl_->uring_, &cqe);