def main():
    request, module, function = parse_args_or_die()
    pattern = timing.get_pattern()
    profile = timing.Profile()
    capture = False
    for line in sys.stdin:
        line = line.strip()
        match = pattern.match(line)
        if match is None:
            continue
        trace = timing.parse_match(match)
        if (trace.request == request and trace.module == module
            and trace.function == function and trace.start):
            capture = True
        if capture:
            profile.add_trace(trace)
        if (trace.request == request and trace.module == module
            and trace.function == function and not trace.start):
            capture = False
    key = lambda t: '%s:%s' % (t.request, t.module)
    results = profile.group_results(key)
    timing.display_results(results, total=True, sort='total')
    key = lambda t: t.module
    results = profile.group_results(key)
    timing.display_results(results, total=True, sort='total')
Esempio n. 2
0
def main():
    request = parse_args_or_die()
    pattern = timing.get_pattern()
    profile = timing.Profile()
    for line in sys.stdin:
        line = line.strip()
        match = pattern.match(line)
        if match is None:
            continue
        trace = timing.parse_match(match)
        if trace.request != request:
            continue
        profile.add_trace(trace)
    results = profile.group_results(lambda t: '%s.%s' % (t.module, t.function))
    timing.display_results(results, avg=True, sort='avg')
    results = profile.group_results(lambda t: t.module)
    timing.display_results(results, total=True, sort='total')