-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new clock() using internal Python API
- Loading branch information
Showing
3 changed files
with
12 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
""" CPU-time returning clock() function which works from within njit-ted code """ | ||
""" CPU-time returning clock() function which works from within njit-ted code, | ||
no time unit guaranteed, returned value only for relative time measurements """ | ||
import ctypes | ||
import platform | ||
|
||
if platform.system() == "Windows": | ||
from ctypes.util import find_msvcrt | ||
|
||
__LIB = find_msvcrt() | ||
if __LIB is None: | ||
__LIB = "msvcrt.dll" | ||
else: | ||
from ctypes.util import find_library | ||
|
||
__LIB = find_library("c") | ||
|
||
clock = ctypes.CDLL(__LIB).clock | ||
clock = ctypes.pythonapi._PyTime_GetSystemClock | ||
clock.argtypes = [] | ||
clock.restype = ctypes.c_int64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
# pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring | ||
import os | ||
|
||
import pytest | ||
from PyMPDATA_examples.Olesik_et_al_2022 import wall_time | ||
|
||
|
||
@pytest.mark.xfail(condition=os.name == "nt") | ||
def test_wall_time(): | ||
wall_time.test_wall_time() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters