Skip to content

Commit a9e8d17

Browse files
committed
Remove monotonic lib as it's unused on Python 3+
1 parent 02d0071 commit a9e8d17

File tree

4 files changed

+2
-210
lines changed

4 files changed

+2
-210
lines changed

THIRD_PARTY_NOTICES.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,6 @@ Distributed under the following license(s):
3535
* [The Apache License, Version 2.0 License](https://opensource.org/license/apache-2-0/)
3636

3737

38-
## [time.monotonic](newrelic/common/_monotonic.c)
39-
40-
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Python Software Foundation; All Rights Reserved
41-
42-
Distributed under the following license(s):
43-
44-
* [Python Software Foundation](https://docs.python.org/3/license.html)
45-
46-
4738
## [urllib3](https://pypi.org/project/urllib3)
4839

4940
Copyright (c) 2008-2019 Andrey Petrov and contributors (see CONTRIBUTORS.txt)

newrelic/common/_monotonic.c

Lines changed: 0 additions & 155 deletions
This file was deleted.

newrelic/common/stopwatch.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,9 @@
2020

2121
import time
2222

23-
try:
24-
# Python 3.3 and later implements PEP 418. Use the
25-
# performance counter it provides which is monotonically
26-
# increasing.
23+
default_timer = time.perf_counter
24+
timer_implementation = "time.perf_counter()"
2725

28-
default_timer = time.perf_counter
29-
timer_implementation = "time.perf_counter()"
30-
31-
except AttributeError:
32-
try:
33-
# Next try our own bundled back port of the monotonic()
34-
# function. Python 3.3 does on Windows use a different
35-
# clock for the performance counter, but the standard
36-
# monotonic clock should suit our requirements okay.
37-
38-
from newrelic.common._monotonic import monotonic as default_timer
39-
40-
default_timer()
41-
timer_implementation = "_monotonic.monotonic()"
42-
43-
except (ImportError, NotImplementedError, OSError):
44-
# If neither of the above, fallback to using the default
45-
# timer from the timeit module. This will use the best
46-
# resolution clock available on a particular platform,
47-
# albeit that it isn't monotonically increasing.
48-
49-
import timeit
50-
51-
default_timer = timeit.default_timer
52-
timer_implementation = "timeit.default_timer()"
5326

5427
# A timer class which deals with remembering the start time based on
5528
# wall clock time and duration based on a monotonic clock where

setup.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,6 @@ def build_extension(self, ext):
191191
kwargs["scripts"] = ["scripts/newrelic-admin"]
192192

193193

194-
def with_librt():
195-
try:
196-
if sys.platform.startswith("linux"):
197-
import ctypes.util
198-
199-
return ctypes.util.find_library("rt")
200-
except Exception:
201-
pass
202-
203-
204194
def run_setup(with_extensions):
205195
def _run_setup():
206196
# Create a local copy of kwargs, if there is no c compiler run_setup
@@ -209,15 +199,8 @@ def _run_setup():
209199
kwargs_tmp = dict(kwargs)
210200

211201
if with_extensions:
212-
monotonic_libraries = []
213-
if with_librt():
214-
monotonic_libraries = ["rt"]
215-
216202
kwargs_tmp["ext_modules"] = [
217203
Extension("newrelic.packages.wrapt._wrappers", ["newrelic/packages/wrapt/_wrappers.c"]),
218-
Extension(
219-
"newrelic.common._monotonic", ["newrelic/common/_monotonic.c"], libraries=monotonic_libraries
220-
),
221204
Extension("newrelic.core._thread_utilization", ["newrelic/core/_thread_utilization.c"]),
222205
]
223206
kwargs_tmp["cmdclass"] = dict(build_ext=optional_build_ext)

0 commit comments

Comments
 (0)