Skip to content
Permalink
Browse files

Replace time.clock() with time.perf_counter()

.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 c52a023b8a17e4346c66a8fddee69b40b327eae7
Showing with 4 additions and 4 deletions.
  1. +2 −2 include_server/parse_file.py
  2. +2 −2 include_server/statistics.py
@@ -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
@@ -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)
@@ -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

0 comments on commit c52a023

Please sign in to comment.
You can’t perform that action at this time.