diff --git a/host/smartperf/client/client_command/cpu_info.cpp b/host/smartperf/client/client_command/cpu_info.cpp index 45091f591a7e10287245e7afcf29e3c3e597e631..f4d8d32352f61fffdeb4adc4979e6369beb90b09 100644 --- a/host/smartperf/client/client_command/cpu_info.cpp +++ b/host/smartperf/client/client_command/cpu_info.cpp @@ -64,7 +64,7 @@ std::map CPUInfo::ItemData() return result; } -void CPUInfo::CalculateCPIInfo(const std::string line, double &cpi_total, size_t &cpi_count) +void CPUInfo::CalculateCPIInfo(const std::string line, double &cpiTotal, size_t &cpiCount) { auto trim = [](std::string& s) { s.erase(0, s.find_first_not_of(" \t")); @@ -78,8 +78,8 @@ void CPUInfo::CalculateCPIInfo(const std::string line, double &cpi_total, size_t if (cpi_pos != std::string::npos) { size_t number_end = comment.find(" ", 0); std::string cpi_str = comment.substr(0, number_end); - cpi_total += SPUtilesTye::StringToSometype(cpi_str); - ++cpi_count; + cpiTotal += SPUtilesTye::StringToSometype(cpi_str); + ++cpiCount; } } } diff --git a/host/smartperf/client/client_command/include/argument_parser.h b/host/smartperf/client/client_command/include/argument_parser.h index d2765082bc969af52fc0eb276c2f93ebd11f4cac..4d80357cf4045e5c0e0fe00a38120f8649a2bec4 100644 --- a/host/smartperf/client/client_command/include/argument_parser.h +++ b/host/smartperf/client/client_command/include/argument_parser.h @@ -113,7 +113,7 @@ private: {"-fl", {ArgumentParser::ArgType::INT, "set fps"}}, {"-ftl", {ArgumentParser::ArgType::INT, "set frameTime"}}, {"-lockfreq", {ArgumentParser::ArgType::BOOL}}, - {"-nav", {ArgumentParser::ArgType::BOOL}}, + {"-nav", {ArgumentParser::ArgType::BOOL, "get page navigation information"}}, {"-SESSIONID", {ArgumentParser::ArgType::STRING, "session id"}}, // UDP diff --git a/host/smartperf/client/client_command/include/common.h b/host/smartperf/client/client_command/include/common.h index 6e6e8d081408a52d24b4e683c6d351589ccaf818..35e31b6d6e26d96c5f6249d75e2f5720dffe6294 100644 --- a/host/smartperf/client/client_command/include/common.h +++ b/host/smartperf/client/client_command/include/common.h @@ -146,39 +146,20 @@ const std::unordered_map COMMAND_MAP = { { std::string("-N"), CommandType::CT_N }, { std::string("-PKG"), CommandType::CT_PKG }, { std::string("-PID"), CommandType::CT_PID }, - { std::string("-OUT"), CommandType::CT_OUT }, - { std::string("-c"), CommandType::CT_C }, { std::string("-CPU"), CommandType::CT_C }, - { std::string("-g"), CommandType::CT_G }, { std::string("-GPU"), CommandType::CT_G }, - { std::string("-f"), CommandType::CT_F }, { std::string("-FPS"), CommandType::CT_F }, { std::string("-LOW_POWER"), CommandType::CT_F }, - { std::string("-fds"), CommandType::CT_FDS }, - { std::string("-FDS"), CommandType::CT_FDS }, - { std::string("-t"), CommandType::CT_T }, { std::string("-TEMP"), CommandType::CT_T }, - { std::string("-p"), CommandType::CT_P }, { std::string("-POWER"), CommandType::CT_P }, - { std::string("-print"), CommandType::CT_PRINT }, - { std::string("-r"), CommandType::CT_R }, { std::string("-RAM"), CommandType::CT_R }, { std::string("-TRACE"), CommandType::CT_TRACE }, - { std::string("-threads"), CommandType::CT_THREADS }, - { std::string("-snapshot"), CommandType::CT_SNAPSHOT }, { std::string("-SCREEN"), CommandType::CT_SNAPSHOT }, - { std::string("-d"), CommandType::CT_D }, { std::string("-DDR"), CommandType::CT_D }, { std::string("-INTERVAL"), CommandType::CT_INTERVAL }, { std::string("-SESSIONID"), CommandType::CT_SESSIONID }, - { std::string("-net"), CommandType::CT_NET }, { std::string("-NET"), CommandType::CT_NET }, - { std::string("-VIEW"), CommandType::CT_VIEW }, - { std::string("-fl"), CommandType::CT_FL }, - { std::string("-ftl"), CommandType::CT_FTL }, - { std::string("-gc"), CommandType::CT_GC }, { std::string("-GPU_COUNTER"), CommandType::CT_GC }, - { std::string("-nav"), CommandType::CT_NAV }, { std::string("-o"), CommandType::CT_O }, { std::string("-lockfreq"), CommandType::CT_LF }, { std::string("-aischedule"), CommandType::CT_AS }, @@ -196,7 +177,6 @@ const std::unordered_map COMMAND_MAP_REVERSE = { { CommandType::CT_C, std::string("-c") }, { CommandType::CT_G, std::string("-g") }, { CommandType::CT_F, std::string("-f") }, - { CommandType::CT_FDS, std::string("-fds") }, { CommandType::CT_T, std::string("-t") }, { CommandType::CT_P, std::string("-p") }, { CommandType::CT_PRINT, std::string("-print") }, @@ -222,6 +202,29 @@ const std::unordered_map COMMAND_MAP_REVERSE = { { CommandType::CT_HCI, std::string("-HCI") }, }; +const std::unordered_map COMMAND_SHELL_MAP = { + { std::string("-N"), CommandType::CT_N }, + { std::string("-PKG"), CommandType::CT_PKG }, + { std::string("-PID"), CommandType::CT_PID }, + { std::string("-threads"), CommandType::CT_THREADS }, + { std::string("-c"), CommandType::CT_C }, + { std::string("-ci"), CommandType::CT_CI }, + { std::string("-g"), CommandType::CT_G }, + { std::string("-gc"), CommandType::CT_GC }, + { std::string("-f"), CommandType::CT_F }, + { std::string("-t"), CommandType::CT_T }, + { std::string("-p"), CommandType::CT_P }, + { std::string("-print"), CommandType::CT_PRINT }, + { std::string("-r"), CommandType::CT_R }, + { std::string("-snapshot"), CommandType::CT_SNAPSHOT }, + { std::string("-net"), CommandType::CT_NET }, + { std::string("-VIEW"), CommandType::CT_VIEW }, + { std::string("-OUT"), CommandType::CT_OUT }, + { std::string("-d"), CommandType::CT_D }, + { std::string("-fl"), CommandType::CT_FL }, + { std::string("-ftl"), CommandType::CT_FTL }, + { std::string("-nav"), CommandType::CT_NAV }, +}; const std::unordered_map COMMAND_HELP_MAP = { { CommandHelp::HELP, std::string("--help") }, diff --git a/host/smartperf/client/client_command/include/cpu_info.h b/host/smartperf/client/client_command/include/cpu_info.h index 53e9c378a74003a923d2f4d2d4e0eb81271134d8..428ce835a70873a3cac777cc2180d2333dfc50bc 100644 --- a/host/smartperf/client/client_command/include/cpu_info.h +++ b/host/smartperf/client/client_command/include/cpu_info.h @@ -41,7 +41,7 @@ public: void Start(); void Stop(); private: - void CalculateCPIInfo(const std::string line, double &cpi_total, size_t &cpi_count); + void CalculateCPIInfo(const std::string line, double &cpiTotal, size_t &cpiCount); std::vector pids_; std::thread th_; std::string hiperfCmd_ = "/bin/hiperf stat -e " + SPUtils::GetProductName() + "-instructions," + diff --git a/host/smartperf/client/client_command/include/smartperf_command.h b/host/smartperf/client/client_command/include/smartperf_command.h index 6e0f0685035c1cde64669ce96082c101c12474da..ff1b6f371f28dc6aa1d6a3db940fd49e252f9821 100644 --- a/host/smartperf/client/client_command/include/smartperf_command.h +++ b/host/smartperf/client/client_command/include/smartperf_command.h @@ -38,11 +38,10 @@ public: " -PID set process pid, must add, for example: -PID 3568 \n" " -threads get threads, must add -PID or -PKG for example: \n" "\t\t -threads -PID 3568 or -threads -PKG ohos.samples.ecg \n" - " -fds get file descriptor, must add -PID or -PKG for example: \n" - "\t\t -fds -PID 3568 or -fds -PKG ohos.samples.ecg \n" " -c get device CPU frequency and CPU usage, process CPU usage and CPU load .. \n" " -ci get cpu instructions and cycles \n" " -g get device GPU frequency and GPU load \n" + " -gc get gpu counter default frequency is 50 \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" @@ -51,6 +50,7 @@ public: " -print start mode print log \n" " -r get process memory and total memory \n" " -snapshot get screen capture\n" + " -nav get page navigation information\n" " -net get uplink and downlink traffic\n" " -start collection start command \n" " -stop collection stop command \n" @@ -62,7 +62,6 @@ public: " -server start a process to listen to the socket message of the start and stop commands \n" " -clear clear the process ID \n" " -ohtestfps used by the vilidator to obtain the fps, the collection times can be set \n" - " -editorServer start a process to listen to the socket message of the editor \n" " -recordcapacity get the battery level difference \n" " --version get version \n" " --help get help \n" @@ -72,7 +71,7 @@ public: " fpsohtest used by the vilidator to obtain the fps \n" "example1:\n" "SP_daemon -N 20 -c -g -t -p -r -net -snapshot -d \n" - "SP_daemon -N 20 -PKG ohos.samples.ecg -c -g -t -p -f -r -net -snapshot -d \n" + "SP_daemon -N 20 -PKG ohos.samples.ecg -c -g -t -p -f -r -net -snapshot -d -nav -gc \n" "SP_daemon -start -c \n" "SP_daemon -stop \n" "example2: These parameters need to be used separately \n" @@ -81,7 +80,6 @@ public: "SP_daemon -server \n" "SP_daemon -clear \n" "SP_daemon -ohtestfps 10 \n" - "SP_daemon -editorServer \n" "SP_daemon -recordcapacity \n" "example3: These parameters need to be used separately \n" "SP_daemon -editor responseTime ohos.samples.ecg app name \n" diff --git a/host/smartperf/client/client_command/include/sp_utils.h b/host/smartperf/client/client_command/include/sp_utils.h index 3e3a571728d18e9d6a2b883278bef013b01390be..8d759d5693a53d1c8db8a684ac7baf5dfb982485 100644 --- a/host/smartperf/client/client_command/include/sp_utils.h +++ b/host/smartperf/client/client_command/include/sp_utils.h @@ -148,6 +148,9 @@ bool VeriyKey(std::set& keys, std::map& m bool VerifyValueStr(std::map& mapInfo, std::string& errorInfo); bool IntegerValueVerification(std::set &keys, std::map &mapInfo, std::string &errorInfo); +bool RemSpaceAndTraPara(std::vector& outParam, std::map& mapInfo, + std::string &errorInfo); +bool IsInvalidInputfromComParam(const std::string& param, std::string &errorInfo); bool IsHmKernel(); std::string GetCpuNum(); void GetCurrentTime(int prevTime); diff --git a/host/smartperf/client/client_command/include/task_manager.h b/host/smartperf/client/client_command/include/task_manager.h index 1b5e7a7ff95aa2bec6de6f6cf8dba607bcab26f7..40e403f95c960d2d4215710f39718e9167af99c2 100644 --- a/host/smartperf/client/client_command/include/task_manager.h +++ b/host/smartperf/client/client_command/include/task_manager.h @@ -71,7 +71,7 @@ private: void MainLoop(); void GpuCounterProcess(const ArgumentParser::ArgValue& value); void SpecialKeyProcess(const std::string specKey); - + void HandleCommandType(CommandType cmdType, const ArgumentParser::ArgValue& val); ThreadPool threadPool_ {4}; int32_t collectCount_ {-1}; std::atomic_bool running_ {false}; diff --git a/host/smartperf/client/client_command/smartperf_main.cpp b/host/smartperf/client/client_command/smartperf_main.cpp index f2ccb73da140ce580512bccca9dcef988616d211..beaeeab3a96a93bd8f21af46ca0d860b0c194db2 100644 --- a/host/smartperf/client/client_command/smartperf_main.cpp +++ b/host/smartperf/client/client_command/smartperf_main.cpp @@ -95,7 +95,7 @@ static bool g_checkCmdParam(std::vector &argv, std::string &errorIn ) { keys.insert(argv[1].substr(1).c_str()); } - for (auto& a : OHOS::SmartPerf::COMMAND_MAP) { + for (auto& a : OHOS::SmartPerf::COMMAND_SHELL_MAP) { keys.insert(a.first.substr(1)); // No prefix required '-' } @@ -104,6 +104,8 @@ static bool g_checkCmdParam(std::vector &argv, std::string &errorIn keys.erase("f2"); keys.erase("fl"); keys.erase("ftl"); + keys.erase("editorServer"); + keys.erase("deviceServer"); return OHOS::SmartPerf::SPUtils::VeriyParameter(keys, str, errorInfo); } diff --git a/host/smartperf/client/client_command/sp_task.cpp b/host/smartperf/client/client_command/sp_task.cpp index 6152de17ba2de78058ab93ec0eac154dffc9b6bb..a6eba5784187bdd4dcf5d05b90c15936039f0140 100644 --- a/host/smartperf/client/client_command/sp_task.cpp +++ b/host/smartperf/client/client_command/sp_task.cpp @@ -54,6 +54,14 @@ std::vector ParseCommandArgs(std::string &command) return args; } +void PushCommandArgs(std::vector& configVec, std::vector& commandArgs, size_t& index) +{ + if (COMMAND_MAP.end() != COMMAND_MAP.find(commandArgs[index]) || + COMMAND_SHELL_MAP.end() != COMMAND_SHELL_MAP.find(commandArgs[index])) { + configVec.push_back(commandArgs[index]); + } +} + // init::-SESSIONID 12345678 -INTERVAL 1000 -PKG ohos.samples.ecg -c -g -t -p -f -r -fl 30 static ExceptionMsg ParseToTask(std::string command, TaskInfo &taskInfo) { @@ -88,9 +96,7 @@ static ExceptionMsg ParseToTask(std::string command, TaskInfo &taskInfo) if (args[i] == COMMAND_MAP_REVERSE.at(CommandType::CT_F)) { // 判断用户设置是否有-f isFPS = true; } - if (COMMAND_MAP.end() != COMMAND_MAP.find(args[i])) { - configs.push_back(args[i]); - } + PushCommandArgs(configs, args, i); } } if (snf.isEffective && (!isFPS)) { @@ -339,6 +345,9 @@ bool SPTask::CheckTcpParam(const std::string& str, std::string &errorInfo) for (auto& a : COMMAND_MAP) { keys.insert(a.first.substr(1)); // 不需要前面的'-' } + for (auto& a : COMMAND_SHELL_MAP) { + keys.insert(a.first.substr(1)); + } bool isValid = SPUtils::VeriyParameter(keys, params, errorInfo); if (isValid) { LOGD("Init parameter validation successful"); diff --git a/host/smartperf/client/client_command/sp_utils.cpp b/host/smartperf/client/client_command/sp_utils.cpp index b1fe62e4c0aac6f7e33f87d513f0f9d7aae95f26..08b5ba2a2c298a3cb1fc14a65a8333d9a768e7b4 100644 --- a/host/smartperf/client/client_command/sp_utils.cpp +++ b/host/smartperf/client/client_command/sp_utils.cpp @@ -517,12 +517,39 @@ bool SPUtils::IntegerVerification(const std::string& str, std::string& errorInfo bool SPUtils::VeriyParameter(std::set &keys, const std::string& param, std::string &errorInfo) { - std::string keyParam; - std::string valueParm; std::vector out; - std::vector subOut; std::map mapInfo; + if (!IsInvalidInputfromComParam(param, errorInfo)) { + LOGE("%s", errorInfo.c_str()); + return false; + } + + SPUtils::StrSplit(param, "-", out); + if (!RemSpaceAndTraPara(out, mapInfo, errorInfo)) { + LOGE("%s", errorInfo.c_str()); + return false; + } + + if (!VeriyKey(keys, mapInfo, errorInfo)) { + LOGE("%s", errorInfo.c_str()); + return false; + } + + if (!VerifyValueStr(mapInfo, errorInfo)) { + LOGE("%s", errorInfo.c_str()); + return false; + } + + if (!IntegerValueVerification(keys, mapInfo, errorInfo)) { + LOGE("%s", errorInfo.c_str()); + return false; + } + return true; +} + +bool SPUtils::IsInvalidInputfromComParam(const std::string& param, std::string &errorInfo) +{ if (param.empty()) { errorInfo = "The parameter cannot be empty"; return false; @@ -532,9 +559,34 @@ bool SPUtils::VeriyParameter(std::set &keys, const std::string& par LOGE("-PKG and -PID cannot be used together with"); return false; } - SPUtils::StrSplit(param, "-", out); + const size_t paramLength = 1; + if (param.length() == paramLength && param[0] == '-') { + errorInfo = "invalid parameter -- '" + param + "'"; + return false; + } + std::string commandShell = ""; + for (const auto& a : COMMAND_SHELL_MAP) { + commandShell = a.first.substr(1); + } + if (commandShell.empty()) { + LOGE("commandShell is NULL!"); + return false; + } + if (param.find("--") != std::string::npos && param.find(commandShell)) { + errorInfo = "invalid parameter -- '" + param + "'"; + return false; + } + return true; +} + +bool SPUtils::RemSpaceAndTraPara(std::vector& outParam, std::map& mapInfo, + std::string &errorInfo) +{ + std::string keyParam; + std::string valueParm; + std::vector subOut; - for (auto it = out.begin(); it != out.end(); ++it) { // Parsing keys and values + for (auto it = outParam.begin(); it != outParam.end(); ++it) { // Parsing keys and values subOut.clear(); SPUtils::StrSplit(*it, " ", subOut); if (mapInfo.end() != mapInfo.find(subOut[0])) { @@ -554,21 +606,6 @@ bool SPUtils::VeriyParameter(std::set &keys, const std::string& par mapInfo[keyParam] = ""; } } - - if (!VeriyKey(keys, mapInfo, errorInfo)) { - LOGE("%s", errorInfo.c_str()); - return false; - } - - if (!VerifyValueStr(mapInfo, errorInfo)) { - LOGE("%s", errorInfo.c_str()); - return false; - } - - if (!IntegerValueVerification(keys, mapInfo, errorInfo)) { - LOGE("%s", errorInfo.c_str()); - return false; - } return true; } diff --git a/host/smartperf/client/client_command/task_manager.cpp b/host/smartperf/client/client_command/task_manager.cpp index ba3112ff88c476e9a63e3473b0f4cbcb0c688267..a4190df4ee5a6b6ec1b122ff48123cbe60dcd979 100644 --- a/host/smartperf/client/client_command/task_manager.cpp +++ b/host/smartperf/client/client_command/task_manager.cpp @@ -116,38 +116,13 @@ void TaskManager::AddTask(const std::unordered_mapsecond) { - case CommandType::CT_N: { - collectCount_ = std::get(val); - continue; - } - case CommandType::CT_PKG: - case CommandType::CT_PID: { - GetProcessInfo(iter->second, val); - continue; - } - case CommandType::CT_PRINT: { - printDataInfo_ = true; - continue; - } - case CommandType::CT_VIEW: { - FPS::GetInstance().SetLayerName(std::get(val)); - continue; - } - case CommandType::CT_OUT: { - SetFilePath(std::get(val)); - continue; - } - case CommandType::CT_GC: { - GpuCounterProcess(val); - break; - } - default: - break; - } + HandleCommandType(iter->second, val); SpProfiler* pro = SpProfilerFactory::GetCmdProfilerItem(iter->second, true); if (pro == nullptr) { @@ -162,6 +137,39 @@ void TaskManager::AddTask(const std::unordered_map(val); + break; + } + case CommandType::CT_PKG: + case CommandType::CT_PID: { + GetProcessInfo(cmdType, val); + break; + } + case CommandType::CT_PRINT: { + printDataInfo_ = true; + break; + } + case CommandType::CT_VIEW: { + FPS::GetInstance().SetLayerName(std::get(val)); + break; + } + case CommandType::CT_OUT: { + SetFilePath(std::get(val)); + break; + } + case CommandType::CT_GC: { + GpuCounterProcess(val); + break; + } + default: + break; + } +} + void TaskManager::AddTask(const std::string& argv) { LOGD("AddTask argv (%s)", argv.c_str()); diff --git a/host/smartperf/client/client_command/test/BUILD.gn b/host/smartperf/client/client_command/test/BUILD.gn index 370e943a4843f145178131b9f142eff6c46b3d17..4cc849b961ccac032be9250463e3d23a20cd813e 100644 --- a/host/smartperf/client/client_command/test/BUILD.gn +++ b/host/smartperf/client/client_command/test/BUILD.gn @@ -67,7 +67,6 @@ ohos_unittest("sp_daemon_ut") { "unittest/ddr_test.cpp", "unittest/dubai_test.cpp", "unittest/editor_command_test.cpp", - "unittest/filedescriptor_test.cpp", "unittest/fps_test.cpp", "unittest/gpuCounter_test.cpp", "unittest/parse_click_complete_trace_test.cpp", diff --git a/host/smartperf/client/client_command/test/unittest/filedescriptor_test.cpp b/host/smartperf/client/client_command/test/unittest/filedescriptor_test.cpp deleted file mode 100644 index e5a52da6f317db6fb74f6b4a7fbb4e7cb02d88e1..0000000000000000000000000000000000000000 --- a/host/smartperf/client/client_command/test/unittest/filedescriptor_test.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ - -#include -#include -#include -#include "FileDescriptor.h" -#include "sp_utils.h" -using namespace testing::ext; -using namespace std; - -namespace OHOS { -namespace SmartPerf { -class SPdaemonFdsTest : public testing::Test { -public: - static void SetUpTestCase() {} - static void TearDownTestCase() {} - - void SetUp() {} - void TearDown() {} -}; - -static bool VerifResult(const std::string &result) -{ - int fdTotalInt = 0; - std::regex fdTotalRegex(R"(fdTotal=(\d+))"); - std::smatch match; - std::string::const_iterator searchStart(result.cbegin()); - while (std::regex_search(searchStart, result.cend(), match, fdTotalRegex)) { - std::cout << "Match found: " << match.str(0) << std::endl; - std::string fdTotalStr = match.str(1); - fdTotalInt = std::stoi(fdTotalStr); - std::cout << "fdTotalInt as integer: " << fdTotalInt << std::endl; - searchStart = match.suffix().first; - } - return fdTotalInt > 0; -} - -/** - * @tc.name: FdsTestCase01 - * @tc.desc: Test Fds by packagename - * @tc.type: FUNC - */ -HWTEST_F(SPdaemonFdsTest, FdsTestCase01, TestSize.Level1) -{ - std::string cmd = "SP_daemon -N 1 -PKG ohos.samples.ecg -fds"; - std::string result = ""; - bool flag = false; - bool ret = SPUtils::LoadCmd(cmd, result); - std::string::size_type strOne = result.find("command exec finished!"); - if ((strOne != result.npos)) { - flag = true; - } - EXPECT_EQ(ret, true); - EXPECT_TRUE(flag); -} - -/** - * @tc.name: FdsTestCase03 - * @tc.desc: Test Fds by pid not exit - * @tc.type: FUNC - */ -HWTEST_F(SPdaemonFdsTest, FdsTestCase03, TestSize.Level1) -{ - std::string cmd = "SP_daemon -N 1 -fds -PID 88888888"; // 88888888 is not exit - std::string result = ""; - bool ret = SPUtils::LoadCmd(cmd, result); - EXPECT_EQ(ret, true); - ret = VerifResult(result); - EXPECT_EQ(ret, false); -} - -/** - * @tc.name: FdsTestCase04 - * @tc.desc: Test Fds - * @tc.type: FUNC - */ -HWTEST_F(SPdaemonFdsTest, FdsTestCase04, TestSize.Level1) -{ - FileDescriptor &fdsInstance = FileDescriptor::GetInstance(); - std::string packName = "init"; - fdsInstance.SetPackageName(packName); - fdsInstance.SetProcessId("1"); - std::map fdsItemData = fdsInstance.ItemData(); - std::string fdTotal = fdsItemData["fdTotal"]; - std::string fds = fdsItemData["fds"]; - EXPECT_EQ(fdTotal.empty(), false); - EXPECT_EQ(fds.empty(), false); -} -} // namespace OHOS -} // namespace SmartPerf \ No newline at end of file