def list_timed(args): bt_formatter = get_backtrace_formatter(args) time_range = get_time_range(args) with get_trace_reader(args) as reader: timed_traces = prof.get_timed_traces(reader.get_traces(), time_range) if args.sort: if args.sort == 'duration': order = -1 elif args.sort == 'time': order = 1 timed_traces = sorted(timed_traces, key=lambda timed: order * getattr(timed, args.sort)) for timed in timed_traces: t = timed.trace print '0x%016x %-15s %2d %20s %7s %-20s %s%s' % ( t.thread.ptr, t.thread.name, t.cpu, trace.format_time(t.time), trace.format_duration(timed.duration), t.name, trace.Trace.format_data(t), bt_formatter(t.backtrace))