1 From c52a023b8a17e4346c66a8fddee69b40b327eae7 Mon Sep 17 00:00:00 2001
2 From: MartB <mart.b@outlook.de>
3 Date: Thu, 28 Nov 2019 21:00:59 +0100
4 Subject: [PATCH] Replace time.clock() with time.perf_counter()
5
6 .clock() got removed in python 3.8 and was marked as deprecated since 3.3
7 (https://github.com/python/cpython/pull/13270)
8 ---
9 include_server/parse_file.py | 4 ++--
10 include_server/statistics.py | 4 ++--
11 2 files changed, 4 insertions(+), 4 deletions(-)
12
13 diff --git a/include_server/parse_file.py b/include_server/parse_file.py
14 index d1dcc74..f5d78b7 100755
15 --- a/include_server/parse_file.py
16 +++ b/include_server/parse_file.py
17 @@ -272,7 +272,7 @@ def Parse(self, filepath, symbol_table):
18
19 assert isinstance(filepath, str)
20 self.filepath = filepath
21 - parse_file_start_time = time.clock()
22 + parse_file_start_time = time.perf_counter()
23 statistics.parse_file_counter += 1
24
25 includepath_map_index = self.includepath_map.Index
26 @@ -338,6 +338,6 @@ def Parse(self, filepath, symbol_table):
27 expr_includes, next_includes)
28
29
30 - statistics.parse_file_total_time += time.clock() - parse_file_start_time
31 + statistics.parse_file_total_time += time.perf_counter() - parse_file_start_time
32
33 return (quote_includes, angle_includes, expr_includes, next_includes)
34 diff --git a/include_server/statistics.py b/include_server/statistics.py
35 index 9677af3..7bc9cb8 100755
36 --- a/include_server/statistics.py
37 +++ b/include_server/statistics.py
38 @@ -62,13 +62,13 @@ def StartTiming():
39 global start_time, translation_unit_counter
40 """Mark the start of a request to find an include closure."""
41 translation_unit_counter += 1
42 - start_time = time.clock()
43 + start_time = time.perf_counter()
44
45
46 def EndTiming():
47 """Mark the end of an include closure calculation."""
48 global translation_unit_time, min_time, max_time, total_time
49 - translation_unit_time = time.clock() - start_time
50 + translation_unit_time = time.perf_counter() - start_time
51 min_time = min(translation_unit_time, min_time)
52 max_time = max(translation_unit_time, max_time)
53 total_time += translation_unit_time
|