From 9c417a61969b8e8bb9986f0a6c90bada0432d9cd Mon Sep 17 00:00:00 2001 From: tenglei Date: Wed, 17 Jul 2024 16:53:40 +0800 Subject: [PATCH] Adding judgment conditions in set_offcpu_parameter function --- category/get_perf_info.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/category/get_perf_info.py b/category/get_perf_info.py index 19db24e..8b3adc6 100644 --- a/category/get_perf_info.py +++ b/category/get_perf_info.py @@ -200,9 +200,14 @@ class OffCPU(): self.offcputime_svg_file = '{}{}'.format(Config.get_output_path(),'offcputime.out.svg') self.offcputime_svg_errfile = '{}{}'.format(Config.get_output_path(),'offcputime.out.svg.err.tmp') - self.__enable = GlobalCall.get_json_value("Getting.Application.OffCPU.enable" , 0, Config.get_json_dict()) - self.__pid = GlobalCall.get_json_value("Getting.Application.OffCPU.pid", convert_str(''), Config.get_json_dict()) - self.offcpu_duration = GlobalCall.get_json_value("Getting.Application.OffCPU.duration", 15, Config.get_json_dict()) + if len(offcpu_args) == 0: + self.__enable = GlobalCall.get_json_value("Getting.Application.OffCPU.enable" , 0, Config.get_json_dict()) + self.__pid = GlobalCall.get_json_value("Getting.Application.OffCPU.pid", convert_str(''), Config.get_json_dict()) + self.offcpu_duration = GlobalCall.get_json_value("Getting.Application.OffCPU.duration", 15, Config.get_json_dict()) + else: + self.__enable = int(offcpu_args['offcpu_enable']) + self.__pid = convert_str(offcpu_args['offcpu_pid']) + self.offcpu_duration = int(offcpu_args['offcpu_duration']) def __check_offcpu_command(self): if not Command.cmd_exists(self.offcputime_tool): -- Gitee