/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/time_graph.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-03-03 20:07:43 UTC
  • mfrom: (7291.1.1 no-time-clock)
  • Revision ID: breezy.the.bot@gmail.com-20190303200743-izfqes3gul967pwe
Use time.perf_counter, which is replacing time.clock.

time.clock is going away in Python 3.8.

Also, rename osutils.timer_func to perf_counter for consistency.

Merged from https://code.launchpad.net/~jelmer/brz/no-time-clock/+merge/363892

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
    branch,
9
9
    commands,
10
10
    graph,
 
11
    osutils,
11
12
    ui,
12
13
    trace,
13
14
    _known_graph_py,
24
25
trace.enable_default_logging()
25
26
ui.ui_factory = text.TextUIFactory()
26
27
 
27
 
begin = time.clock()
 
28
begin = osutils.perf_counter()
28
29
if len(args) >= 1:
29
30
    b = branch.Branch.open(args[0])
30
31
else:
33
34
    g = b.repository.get_graph()
34
35
    parent_map = dict(p for p in g.iter_ancestry([b.last_revision()])
35
36
                      if p[1] is not None)
36
 
end = time.clock()
 
37
end = osutils.perf_counter()
37
38
 
38
39
print('Found %d nodes, loaded in %.3fs' % (len(parent_map), end - begin))
39
40
 
73
74
    graph._counters[1] = 0
74
75
    graph._counters[2] = 0
75
76
 
76
 
    begin = time.clock()
 
77
    begin = osutils.perf_counter()
77
78
    g = graph_klass(parent_map)
78
79
    if opts.lsprof is not None:
79
80
        heads = commands.apply_lsprofiled(opts.lsprof, all_heads_comp, g, comb)
80
81
    else:
81
82
        heads = all_heads_comp(g, comb)
82
 
    end = time.clock()
 
83
    end = osutils.perf_counter()
83
84
    return dict(elapsed=(end - begin), graph=g, heads=heads)
84
85
 
85
86
def report(name, g):