仅分析用户定义函数pstats

2024-04-29 13:37:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试使用pstats模块中的Stats():

    p = Profile()
    p.runcall(wrangle_file,input_filename="test.csv",output_file="solution.csv",metrics=True)
    stats = Stats(p)
    stats.strip_dirs()
    stats.sort_stats('cumulative')
    stats.print_stats()

但是,当我打印统计数据时,我也得到了对库函数的调用。有没有一种方法可以过滤这些函数来打印对函数的调用?在


Tags: 模块csv函数testinputoutputstatsfilename