AC_CONFIG_LINKS([
python-lttngust/lttngust/agent.py:python-lttngust/lttngust/agent.py
python-lttngust/lttngust/cmd.py:python-lttngust/lttngust/cmd.py
+ python-lttngust/lttngust/compat.py:python-lttngust/lttngust/compat.py
python-lttngust/lttngust/debug.py:python-lttngust/lttngust/debug.py
python-lttngust/lttngust/loghandler.py:python-lttngust/lttngust/loghandler.py
])
from __future__ import division
import lttngust.debug as dbg
import lttngust.loghandler
+import lttngust.compat
import lttngust.cmd
from io import open
import threading
try:
dbg._pdebug('waiting for registration done (expecting {}, timeout is {} s)'.format(reg_expecting,
cur_timeout))
- t1 = time.clock()
+ t1 = lttngust.compat._clock()
reg_queue.get(timeout=cur_timeout)
- t2 = time.clock()
+ t2 = lttngust.compat._clock()
reg_expecting -= 1
dbg._pdebug('unblocked')
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2020 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+import sys
+import time
+
+
+# Support for deprecation of time.clock().
+# Deprecated since python 3.3 and removed in python 3.8.
+# See PEP 418 for more details.
+def _clock():
+ if sys.version_info > (3,2):
+ clock = time.perf_counter()
+ else:
+ clock = time.clock()
+ return clock
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
from __future__ import unicode_literals, print_function
+import lttngust.compat
import time
import sys
import os
def _pwarning(msg):
fname = inspect.stack()[1][3]
fmt = '[{:.6f}] LTTng-UST warning: {}(): {}'
- print(fmt.format(time.clock(), fname, msg), file=sys.stderr)
+ print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr)
def _pdebug(msg):
fname = inspect.stack()[1][3]
fmt = '[{:.6f}] LTTng-UST debug: {}(): {}'
- print(fmt.format(time.clock(), fname, msg), file=sys.stderr)
+ print(fmt.format(lttngust.compat._clock(), fname, msg), file=sys.stderr)
_pdebug('debug is enabled')
else: