mirror of
https://gitee.com/openharmony/developtools_profiler
synced 2025-02-11 05:17:20 +00:00
fix some smartperf bug
Signed-off-by: zhaohui <zhaohui70@huawei.com>
This commit is contained in:
parent
3e0b23840d
commit
8a869aeef6
@ -43,6 +43,7 @@ std::map<std::string, std::string> RAM::getRamInfo()
|
||||
cmdGrep.str("");
|
||||
cmdGrep << "/proc/" << processId << "/smaps_rollup";
|
||||
std::string cmdRam = cmdGrep.str();
|
||||
std::cout << "RAM EXEC" << cmdRam << std::endl;
|
||||
std::ifstream infile(cmdRam.c_str(), std::ios::in);
|
||||
if (!infile) {
|
||||
return ramInfo;
|
||||
|
@ -35,14 +35,16 @@ SmartPerfCommand::SmartPerfCommand(int argc, char *argv[])
|
||||
}
|
||||
if (argc == TWO_PARAM) {
|
||||
auto iterator = commandHelpMap.begin();
|
||||
while (iterator != commandHelpMap.end() && (strcmp(argv[1], iterator->second.c_str()) == 0)) {
|
||||
if (iterator->first == CommandHelp::HELP) {
|
||||
std::cout << SmartPerf_MSG << std::endl;
|
||||
break;
|
||||
}
|
||||
if (iterator->first == CommandHelp::VERSION) {
|
||||
std::cout << SmartPerf_VERSION << std::endl;
|
||||
break;
|
||||
while (iterator != commandHelpMap.end()) {
|
||||
if (strcmp(argv[1], iterator->second.c_str()) == 0) {
|
||||
if (iterator->first == CommandHelp::HELP) {
|
||||
std::cout << SmartPerf_MSG << std::endl;
|
||||
break;
|
||||
}
|
||||
if (iterator->first == CommandHelp::VERSION) {
|
||||
std::cout << SmartPerf_VERSION << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++iterator;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ bool SPUtils::LoadCmd(const std::string &cmd, std::string &result)
|
||||
result = buf;
|
||||
}
|
||||
if (pclose(fd) == -1) {
|
||||
result += "pclose failed";
|
||||
std::cout << "" << std::endl;
|
||||
}
|
||||
// remove '' \n\r
|
||||
ReplaceString(result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user