Skip to content

Commit 0ff46d6

Browse files
committed
Added line profiling and coverage support.
1 parent 36a0806 commit 0ff46d6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
plugins = Cython.Coverage
3+
source = raysect
4+
omit = *tests*

setup.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use_cython = True
99
force = False
1010
profile = False
11+
line_profile = False
1112

1213
if "--skip-cython" in sys.argv:
1314
use_cython = False
@@ -21,6 +22,10 @@
2122
profile = True
2223
del sys.argv[sys.argv.index("--profile")]
2324

25+
if "--line-profile" in sys.argv:
26+
line_profile = True
27+
del sys.argv[sys.argv.index("--line-profile")]
28+
2429
source_paths = ['raysect', 'demos']
2530
compilation_includes = [".", numpy.get_include()]
2631
compilation_args = []
@@ -30,6 +35,11 @@
3035
}
3136
setup_path = path.dirname(path.abspath(__file__))
3237

38+
if line_profile:
39+
compilation_args.append("-DCYTHON_TRACE=1")
40+
compilation_args.append("-DCYTHON_TRACE_NOGIL=1")
41+
cython_directives["linetrace"] = True
42+
3343
if use_cython:
3444

3545
from Cython.Build import cythonize

0 commit comments

Comments
 (0)