summaryrefslogtreecommitdiff
path: root/simpleperf/cmd_record_test.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2021-02-11 13:14:54 -0800
committerYabin Cui <yabinc@google.com>2021-02-12 12:10:44 -0800
commita89a374a357a915b4ea5083c32a3edd7097e1239 (patch)
tree5c9aee34c609b0c27555822783cbb55f6a75f86d /simpleperf/cmd_record_test.cpp
parente5ad5804b3a25a0cbf9ea0750c66870b3e4b867e (diff)
downloadextras-a89a374a357a915b4ea5083c32a3edd7097e1239.tar.gz
simpleperf: add record filter options to record and monitor cmd.
The options support filtering records based on: process id, thread id, process name regex, thread name regex, and user id. Bug: 159157424 Test: run simpleperf_unit_test Test: run simpleperf manually Change-Id: Ife919d81cbe7672b5431dcdf60492956de2059a9
Diffstat (limited to 'simpleperf/cmd_record_test.cpp')
-rw-r--r--simpleperf/cmd_record_test.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index cb9f739d..217959d2 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -1095,3 +1095,12 @@ TEST(record_cmd, kprobe_option) {
ASSERT_TRUE(RunRecordCmd({"-e", "kprobes:do_sys_open"}));
ASSERT_TRUE(RunRecordCmd({"--group", "kprobes:do_sys_open"}));
}
+
+TEST(record_cmd, record_filter_options) {
+ ASSERT_TRUE(
+ RunRecordCmd({"--exclude-pid", "1,2", "--exclude-tid", "3,4", "--exclude-process-name",
+ "processA", "--exclude-thread-name", "threadA", "--exclude-uid", "5,6"}));
+ ASSERT_TRUE(
+ RunRecordCmd({"--include-pid", "1,2", "--include-tid", "3,4", "--include-process-name",
+ "processB", "--include-thread-name", "threadB", "--include-uid", "5,6"}));
+}