From 6bac26920fd4bf1a9747d40d419ffa713bee8c01 Mon Sep 17 00:00:00 2001 From: wuzhaomin Date: Tue, 13 Aug 2024 10:31:22 +0800 Subject: [PATCH] Added the __check_offcpu_pid function to too_cmd.py --- common/tool_cmd.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/tool_cmd.py b/common/tool_cmd.py index 4bbd202..835bce7 100644 --- a/common/tool_cmd.py +++ b/common/tool_cmd.py @@ -34,6 +34,14 @@ class ToolCmd: raise argparse.ArgumentTypeError("should set to -1 or existed process id") return val + def __check_offcpu_pid(self, val): + try: + ival = int(val) + except ValueError: + raise argparse.ArgumentTypeError("must be an integer") + + return ival + def args_help(self): #共享可选参数wpath ipath opath parent_parser = argparse.ArgumentParser(add_help=False) -- Gitee