当前位置: 首页>>代码示例>>Python>>正文


Python Executor.get_reports_dir方法代码示例

本文整理汇总了Python中executor.Executor.get_reports_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Executor.get_reports_dir方法的具体用法?Python Executor.get_reports_dir怎么用?Python Executor.get_reports_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在executor.Executor的用法示例。


在下文中一共展示了Executor.get_reports_dir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from executor import Executor [as 别名]
# 或者: from executor.Executor import get_reports_dir [as 别名]
def main():
    # parse command line
    option = parse_cmdline()
    filtered_devices_id = option.devices
    is_list_devices = int(option.list_devices)
    filtered_cases_id = option.cases
    is_list_cases = int(option.list_cases)
    case_file = option.case_file
    executable = option.executable
    
    # check command line
    if is_list_devices:
        list_devices(is_list_devices)
        return
    if is_list_cases:
        list_cases(is_list_cases)
        return
    if not os.path.isfile(executable):
        print "Error: " + executable + " doesn't exist."
        return
 
    # parse cases 
    all_cases = CaseSet()
    if (case_file != ""):
        all_cases.parse_xml(os.path.join(os.path.dirname(__file__), case_file))
    else:
        all_cases.parse_xml_dir(os.path.join(os.path.dirname(__file__), "..", "cases"))
    filtered_case_set = {}
    if filtered_cases_id:
        for c in filtered_cases_id:
            if c in all_cases.keys():
                filtered_case_set[c] = all_cases[c]
            else:
                print "Warning: " + c + " is not an legal case ID."
    else:
        filtered_case_set = all_cases
    
    # parse devices
    all_devices = DeviceSet()
    all_devices.parse_xml(os.path.join(os.path.dirname(__file__), "..", "devices", "devices.xml"))
    filtered_device_set = {}
    for d in filtered_devices_id:
        if d in all_devices.keys():
            filtered_device_set[d] = all_devices[d]
        else:
            print "Warning: " + d + " is not an legal device ID."
    
    # execute profiling
    e = Executor(executable, filtered_device_set, filtered_case_set, duplicate=10)
    try:
        logfiles = e.run()
    except (KeyboardInterrupt):
        print "KeyboardInterrupt in run.main()"
        sys.exit()
    
    # analyze log
    for case_id in logfiles.keys():
        for device_id in logfiles[case_id].keys():
            case = all_cases[case_id]
            root_node = case.get_root_node() 
            coeff     = case.get_mcps_norm_coeff()
            interest_nodes = option.interest_nodes
            ana = Analyzer(root_node, coeff, interest_nodes)
            if len(logfiles[case_id][device_id]) > 0:
                ana.run(logfiles[case_id][device_id])
    print "Finished! \nSee profile logs here: "
    for dir in e.get_reports_dir():
        print "\t./" + dir
开发者ID:xjsXjtu,项目名称:mini_profiler,代码行数:70,代码来源:run.py


注:本文中的executor.Executor.get_reports_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。