资源简介
用于将通过cat /sys/kernel/debug/tracing/trace命令获取的log文件,进行解析,和统计,分类:哪一号中断,在哪一号CPU上运行,总共运行时间多久,最大单次处理时间,最小单次处理时间,平均处理时间,相同中断发生在同一个CPU上面的最小间隔等。
代码片段和文件信息
#!/usr/bin/env python
import sys
import os
#
# Useage: ./interrupt_time_analyze.py file_to_analyze
#
num_args = len(sys.argv)
print “##################################“
print “You input %d args“ % num_args
for arg_idx in range(num_args):
print “argv[%d] = %s“ % (arg_idx sys.argv[arg_idx])
print “##################################“
if num_args < 2:
print ““
print “Usage: %s file_to_analyze“ % sys.argv[0]
print ““
os._exit(-1)
all_level_skip_count = 0
level_0_skip_count = 0
level_1_skip_count = 0
level_2_skip_count = 0
name_line_count = 0
ret_line_count = 0
database_dict = {}
#
# prase file by file
#
for arg_idx in range(1 num_args 1):
input_file = sys.argv[arg_idx]
print ““
print “#################################“
print “ analyzing \“%s\““ % i
评论
共有 条评论