Esempio n. 1
0
def mem_analys(args):
    mallocs = {}

    node_filters = []
    if args.min_count:
        node_filters.append(memory_analyzer.filter_min_count(args.min_count))
    if args.min_hits:
        if args.min_hits.endswith('%'):
            min_percent = parse_percentage(args.min_hits)
            node_filters.append(
                memory_analyzer.filter_min_bt_percentage(min_percent))
        else:
            min_count = int(args.min_hits)
            node_filters.append(memory_analyzer.filter_min_bt_count(min_count))

    with get_trace_reader(args) as reader:
        memory_analyzer.process_records(mallocs, reader.get_traces())
        memory_analyzer.show_results(
            mallocs,
            node_filters=node_filters,
            sorter=args.sort,
            group_by=args.group_by,
            show_backtrace=args.backtrace,
            symbol_resolver=symbol_resolver(args),
            src_addr_formatter=src_addr_formatter(args),
            max_levels=args.max_levels)
Esempio n. 2
0
def mem_analys(args):
    mallocs = {}

    node_filters = []
    if args.min_count:
        node_filters.append(memory_analyzer.filter_min_count(args.min_count))
    if args.min_hits:
        if args.min_hits.endswith('%'):
            min_percent = parse_percentage(args.min_hits)
            node_filters.append(memory_analyzer.filter_min_bt_percentage(min_percent))
        else:
            min_count = int(args.min_hits)
            node_filters.append(memory_analyzer.filter_min_bt_count(min_count))

    with get_trace_reader(args) as reader:
        memory_analyzer.process_records(mallocs, reader.get_traces())
        memory_analyzer.show_results(mallocs,
            node_filters=node_filters,
            sorter=args.sort,
            group_by=args.group_by,
            show_backtrace=args.backtrace,
            symbol_resolver=symbol_resolver(args),
            src_addr_formatter=src_addr_formatter(args),
            max_levels=args.max_levels)