Skip to content

Commit

Permalink
Replace time.clock() with time.perf_counter()
Browse files Browse the repository at this point in the history
.clock() got removed in python 3.8 and was marked as deprecated since 3.3
(python/cpython#13270)
  • Loading branch information
MartB committed Nov 28, 2019
1 parent 1a2cbe6 commit c52a023
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include_server/parse_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def Parse(self, filepath, symbol_table):

assert isinstance(filepath, str)
self.filepath = filepath
parse_file_start_time = time.clock()
parse_file_start_time = time.perf_counter()
statistics.parse_file_counter += 1

includepath_map_index = self.includepath_map.Index
Expand Down Expand Up @@ -338,6 +338,6 @@ def Parse(self, filepath, symbol_table):
expr_includes, next_includes)


statistics.parse_file_total_time += time.clock() - parse_file_start_time
statistics.parse_file_total_time += time.perf_counter() - parse_file_start_time

return (quote_includes, angle_includes, expr_includes, next_includes)
4 changes: 2 additions & 2 deletions include_server/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ def StartTiming():
global start_time, translation_unit_counter
"""Mark the start of a request to find an include closure."""
translation_unit_counter += 1
start_time = time.clock()
start_time = time.perf_counter()


def EndTiming():
"""Mark the end of an include closure calculation."""
global translation_unit_time, min_time, max_time, total_time
translation_unit_time = time.clock() - start_time
translation_unit_time = time.perf_counter() - start_time
min_time = min(translation_unit_time, min_time)
max_time = max(translation_unit_time, max_time)
total_time += translation_unit_time
Expand Down

0 comments on commit c52a023

Please sign in to comment.