!216 merge master into master

new mode

Created-by: hongjianfeng
Commit-by: hongjianfeng
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)



### 二、建议测试周期和提测地址  
  建议测试完成时间:xxxx.xx.xx  
  投产上线时间:xxxx.xx.xx  
  提测地址:CI环境/压测环境  
  测试账号:  

### 三、变更内容
  * 3.1 关联PR列表

  * 3.2 数据库和部署说明  
    1. 常规更新 
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"

  * 3.4 其他技术优化内容(做了什么,变更了什么)
    - 重构了 xxxx 代码
    - xxxx 算法优化


  * 3.5 废弃通知(什么字段、方法弃用?)



  * 3.6  后向不兼容变更(是否有无法向后兼容的变更?)


  
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
  自测测试结论:


### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
  检查点:

| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx  | 否          | 需要       | 不需要           |
|      |            |          |               |

  接口测试:

  性能测试:

  并发测试:

  其他:



See merge request: openharmony/resourceschedule_soc_perf!216
This commit is contained in:
openharmony_ci
2026-05-09 11:02:32 +08:00
3 changed files with 39 additions and 4 deletions
@@ -63,6 +63,7 @@ public:
void ClearAllAliveRequest();
void SubmitStatisticsTask(std::function<void()> func, ffrt::task_attr& taskAttr, ffrt::task_handle& timer);
void CancelStatisticsTask(ffrt::task_handle& timer);
void SetPerformanceModeStatus(bool enable);
public:
int32_t thermalLvl_ = DEFAULT_THERMAL_LVL;
@@ -74,6 +75,7 @@ private:
bool powerLimitBoost_ = false;
bool thermalLimitBoost_ = false;
bool weakInteractionStatus_ = true;
bool performanceModeStatus_ = false;
int boostResCnt = 0;
private:
@@ -102,6 +104,7 @@ private:
std::shared_ptr<ResAction> resAction, std::shared_ptr<ResStatus> resStatus);
void DoWeakInteraction(std::shared_ptr<Actions> actions, int32_t onOff, int32_t actionType);
void WeakInteraction();
int32_t GetModeCmdId(int32_t cmdId);
};
} // namespace SOCPERF
} // namespace OHOS
+4
View File
@@ -446,6 +446,10 @@ void SocPerf::RequestDeviceMode(const std::string& mode, bool status)
socperfThreadWrap_->SetWeakInteractionStatus(status);
return;
}
const std::string PERFORMANCE_MODE_STR = "powerStatus:perfMode";
if (mode == PERFORMANCE_MODE_STR) {
socperfThreadWrap_->SetPerformanceModeStatus(status);
}
auto iter = socPerfConfig_.sceneResourceInfo_.find(modeType);
if (iter == socPerfConfig_.sceneResourceInfo_.end()) {
SOC_PERF_LOGD("No matching device mode found.");
+32 -4
View File
@@ -26,6 +26,11 @@
namespace OHOS {
namespace SOCPERF {
namespace {
constexpr int32_t PERF_REQUEST_CMD_ID_WEAK_INTERACTION = 9101;
constexpr int32_t PERF_REQUEST_CMD_ID_WEAK_INTERACTION_PERFORMANCE_MODE = 39101;
}
SocPerfThreadWrap::SocPerfThreadWrap() : socperfQueue_("socperf", ffrt::queue_attr().qos(ffrt::qos_user_interactive))
{
}
@@ -175,6 +180,27 @@ void SocPerfThreadWrap::InitResStatus()
ReportToRssExe(qosIdToRssEx, valueToRssEx, endTimeToRssEx);
}
void SocPerfThreadWrap::SetPerformanceModeStatus(bool enable)
{
std::function<void()>&& performanceModeFunc = [this, enable]() {
std::string trace_str("SetPerformanceModeStatus");
trace_str.append("[").append(enable ? "true" : "false").append("]");
StartTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF, trace_str.c_str());
performanceModeStatus_ = enable;
SOC_PERF_LOGI("SetPerformanceModeStatus is %{public}d.", enable);
FinishTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF);
};
socperfQueue_.submit(performanceModeFunc);
}
int32_t SocPerfThreadWrap::GetModeCmdId(int32_t cmdId)
{
if (cmdId == PERF_REQUEST_CMD_ID_WEAK_INTERACTION && performanceModeStatus_) {
return PERF_REQUEST_CMD_ID_WEAK_INTERACTION_PERFORMANCE_MODE;
}
return cmdId;
}
void SocPerfThreadWrap::SetWeakInteractionStatus(bool enable)
{
std::function<void()>&& weakInteractionFunc = [this, enable]() {
@@ -197,11 +223,12 @@ void SocPerfThreadWrap::WeakInteraction()
interAction->status = BOOST_END_STATUS;
std::function<void()>&& updateLimitStatusFunc = [this, i]() {
socPerfConfig_.interAction_[i]->status = WEAK_INTERACTION_STATUS;
int32_t cmdId = GetModeCmdId(socPerfConfig_.interAction_[i]->cmdId);
DoWeakInteraction(
socPerfConfig_.configPerfActionsInfo_[DEFAULT_CONFIG_MODE][socPerfConfig_.interAction_[i]->cmdId],
socPerfConfig_.configPerfActionsInfo_[DEFAULT_CONFIG_MODE][cmdId],
EVENT_ON, socPerfConfig_.interAction_[i]->actionType);
std::string trace_str("WeakInteraction");
trace_str.append(",cmdId[").append(std::to_string(socPerfConfig_.interAction_[i]->cmdId)).append("]");
trace_str.append(",cmdId[").append(std::to_string(cmdId)).append("]");
trace_str.append(",onOff[").append(std::to_string(EVENT_ON)).append("]");
StartTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF, trace_str.c_str());
FinishTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF);
@@ -211,11 +238,12 @@ void SocPerfThreadWrap::WeakInteraction()
interAction->timerTask = socperfQueue_.submit_h(updateLimitStatusFunc, taskAttr);
} else if ((!weakInteractionStatus_ || boostResCnt != 0) && interAction->status == WEAK_INTERACTION_STATUS) {
interAction->status = BOOST_STATUS;
int32_t cmdId = GetModeCmdId(interAction->cmdId);
DoWeakInteraction(
socPerfConfig_.configPerfActionsInfo_[DEFAULT_CONFIG_MODE][interAction->cmdId],
socPerfConfig_.configPerfActionsInfo_[DEFAULT_CONFIG_MODE][cmdId],
EVENT_OFF, interAction->actionType);
std::string trace_str("WeakInteraction");
trace_str.append(",cmdId[").append(std::to_string(interAction->cmdId)).append("]");
trace_str.append(",cmdId[").append(std::to_string(cmdId)).append("]");
trace_str.append(",onOff[").append(std::to_string(EVENT_OFF)).append("]");
StartTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF, trace_str.c_str());
FinishTraceEx(HITRACE_LEVEL_INFO, HITRACE_TAG_SOCPERF);