From fda08b69a8b8097622203d9f9dc88dc2780867fb Mon Sep 17 00:00:00 2001 From: lixiaoyong1 Date: Thu, 12 Dec 2024 05:55:57 -0500 Subject: [PATCH] Optimize function __check_perf_cmdline --- common/tool_cmd.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/common/tool_cmd.py b/common/tool_cmd.py index e5db9cd..6c6fc54 100644 --- a/common/tool_cmd.py +++ b/common/tool_cmd.py @@ -19,14 +19,13 @@ class ToolCmd: # start add for perf/offcpu command line parser check def __check_perf_cmdline(self, args): error_msg = [] - if args.perf_enable_type: - if not args.perf_pid: - error_msg = "need to specify --pid option" - return error_msg - if not args.perf_enable_type: - if args.perf_pid or args.perf_duration: - error_msg = "need to specify --perf option" - return error_msg + if args.perf_enable_type and not args.perf_pid: + error_msg = "need to specify --pid option" + elif args.perf_pid and not args.perf_enable_type: + error_msg = "need to specify --perf option" + elif args.perf_duration and not args.perf_enable_type: + error_msg = "need to specify --perf option" + return error_msg def __check_offcpu_cmdline(self, args): -- Gitee