diff --git a/include/subcommand_stat.h b/include/subcommand_stat.h index c6fd88f2d5a016a658feaf1e2ccb7bcfd6a3cafe..84744b5d97db68ddb1dcc37a793b7a2e3508a92e 100644 --- a/include/subcommand_stat.h +++ b/include/subcommand_stat.h @@ -107,6 +107,7 @@ private: int checkAppMs_ = DEFAULT_CHECK_APP_MS; std::vector selectPids_; std::vector selectTids_; + std::vector inputPidTidArgs_ = {}; bool perCpus_ {false}; bool perThreads_ {false}; bool verboseReport_ {false}; diff --git a/src/subcommand_record.cpp b/src/subcommand_record.cpp index fc542412e71bcaad420ca39962ca4927ce6f67e8..f15feea46f3a5495c906198a33139f405a1ab627 100644 --- a/src/subcommand_record.cpp +++ b/src/subcommand_record.cpp @@ -419,6 +419,9 @@ bool SubCommandRecord::CheckSelectCpuPidOption() } } } + if (!IsExistDebugByPid(selectTids_)) { + return false; + } return true; } diff --git a/src/subcommand_stat.cpp b/src/subcommand_stat.cpp index 0fb4b032e8fa20b0b79bd57be3243f98ba0bd2f5..b12e319fc9f5981532ce3f1e8883e4ded682d483 100644 --- a/src/subcommand_stat.cpp +++ b/src/subcommand_stat.cpp @@ -109,13 +109,12 @@ bool SubCommandStat::ParseOption(std::vector &args) HLOGD("get option -p failed"); return false; } - if (!IsExistDebugByPid(selectPids_)) { - return false; - } + inputPidTidArgs_ = selectPids_; if (!Option::GetOptionValue(args, "-t", selectTids_)) { HLOGD("get option -t failed"); return false; } + inputPidTidArgs_.insert(inputPidTidArgs_.end(), selectTids_.begin(), selectTids_.end()); if (!Option::GetOptionValue(args, "--restart", restart_)) { HLOGD("get option --restart failed"); return false; @@ -668,6 +667,9 @@ bool SubCommandStat::OnSubCommand(std::vector &args) HLOGV("CheckOptionPidAndApp() failed"); return false; } + if (!IsExistDebugByPid(inputPidTidArgs_)) { + return false; + } SetPerfEvent(); if (!PrepairEvents()) { HLOGV("PrepairEvents() failed");