新增HiSmartPerf Performance Mode

Signed-off-by: s30035957 <sunwei158@huawei.com>
This commit is contained in:
s30035957 2024-05-31 14:46:05 +08:00
parent fafced73b1
commit 3813c28e3c
4 changed files with 29 additions and 20 deletions

View File

@ -50,7 +50,8 @@
"window_manager",
"image_framework",
"ffrt",
"storage_service"
"storage_service",
"soc_perf"
],
"third_party": [
"bounds_checking_function",

View File

@ -81,6 +81,7 @@ ohos_executable("SP_daemon") {
"init:libbegetutil",
"window_manager:libdm",
"window_manager:libwm",
"soc_perf:socperf_client",
]
defines = [
"HI_LOG_ENABLE",

View File

@ -31,25 +31,26 @@ public:
const std::string smartPerfMsg = "OpenHarmony performance testing tool SmartPerf command-line version\n"
"Usage: SP_daemon [options] [arguments]\n\n"
"options:\n"
" -N set the collection times(default value is 0) range[1,2147483647], for example: -N 10 \n"
" -PKG set package name, must add, for example: -PKG ohos.samples.ecg \n"
" -c get device CPU frequency and CPU usage, process CPU usage and CPU load .. \n"
" -g get device GPU frequency and GPU load \n"
" -f get app refresh fps(frames per second) and fps jitters and refreshrate \n"
" -profilerfps get refresh fps and timestamp \n"
" -sections set collection time period(using with profilerfps)\n"
" -t get remaining battery power and temperature.. \n"
" -p get battery power consumption and voltage \n"
" -r get process memory and total memory \n"
" -snapshot get screen capture\n"
" -net get uplink and downlink traffic\n"
" -start collection start command \n"
" -stop collection stop command \n"
" -VIEW set layler, for example: -VIEW DisplayNode \n"
" -screen get screen resolution \n"
" -OUT set csv output path.\n"
" -d get device DDR information \n"
" -m get other memory \n"
" -N set the collection times(default value is 0) range[1,2147483647], for example: -N 10 \n"
" -PKG set package name, must add, for example: -PKG ohos.samples.ecg \n"
" -c get device CPU frequency and CPU usage, process CPU usage and CPU load .. \n"
" -g get device GPU frequency and GPU load \n"
" -f get app refresh fps(frames per second) and fps jitters and refreshrate \n"
" -profilerfps get refresh fps and timestamp \n"
" -sections set collection time period(using with profilerfps)\n"
" -t get remaining battery power and temperature.. \n"
" -p get battery power consumption and voltage \n"
" -r get process memory and total memory \n"
" -snapshot get screen capture\n"
" -net get uplink and downlink traffic\n"
" -start collection start command \n"
" -stop collection stop command \n"
" -VIEW set layler, for example: -VIEW DisplayNode \n"
" -screen get screen resolution \n"
" -OUT set csv output path.\n"
" -d get device DDR information \n"
" -m get other memory \n"
" -performancemode set HiSmartPerf performance mode\n"
"example:\n"
"SP_daemon -N 20 -c -g -t -p -r -m -net -snapshot -d \n"
"SP_daemon -N 20 -PKG ohos.samples.ecg -c -g -t -p -f -r -m -net -snapshot -d \n"

View File

@ -24,6 +24,7 @@
#include "include/sp_log.h"
#include "include/common.h"
#include "parameters.h"
#include "socperf_client.h"
static std::string GetOptions(const std::vector<std::string> &argv)
@ -72,6 +73,7 @@ static bool g_checkCmdParam(std::vector<std::string> &argv, std::string &errorIn
keys.insert("screen");
keys.insert("sections");
keys.insert("deviceinfo");
keys.insert("performancemode");
for (auto a : OHOS::SmartPerf::COMMAND_MAP) {
keys.insert(a.first.substr(1)); // No prefix required '-'
}
@ -140,6 +142,10 @@ int main(int argc, char *argv[])
} else if (argc > 1 && strcmp(argv[1], "-deviceinfo") == 0) {
std::cout << OHOS::SmartPerf::SPUtils::GetDeviceInfoMap() << std::endl;
return 0;
} else if (argc > 1 && strcmp(argv[1], "-performancemode") == 0) {
int performanceModeId = 10020;
OHOS::SOCPERF::SocPerfClient::GetInstance().PerfRequest(performanceModeId, "");
return 0;
}
OHOS::SmartPerf::SmartPerfCommand cmd(vec);
std::cout << cmd.ExecCommand() << std::endl;