diff --git a/category/get_cpu_info.py b/category/get_cpu_info.py index 3268dff9e7ae511262bb1a09e2aac5e9fcf77dae..0e8137e9d5172ac1f26ef36f5ea95fada9cab6a0 100644 --- a/category/get_cpu_info.py +++ b/category/get_cpu_info.py @@ -115,6 +115,24 @@ class CPUInfo: # should not arrive here Logger().debug("Getting.Common.CPU.duration: {}".format(e)) duration = 15 + + # 该命令并不包含cache-misses,cache-references + # 若要同时采集,则需考虑将默认event和这两个事件逐一列出进行采集 + # 由于添加了-ddd,且对这两个事件暂无明显的分析需求,故暂不列入这两个事件。 + perf_stat_command = "perf stat -a -ddd sleep {} 2> {}".format(duration, perf_stat_file) + Logger().debug("perf_stat_command : {}".format(perf_stat_command)) + Command.private_cmd_run(perf_stat_command, True) + try: + perf_stat_txt = FileOperation.readfile(perf_stat_file) + cmd_result = "".join(["perf stat -a -ddd", '\n', perf_stat_txt]) + res_perf_stat = FileOperation.wrap_output_format(cmd_name_top, cmd_result, '-') + except Exception as e: + Logger().debug("read perf stat content error: {}".format(e)) + res_perf_stat = '' + else: + res_perf_stat = '' + + return res_perf_stat @GlobalCall.monitor_info_thread_pool.threaded_pool def __get_top_info(self, interval , times):