File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -302,10 +302,18 @@ def avx_default():
302302 NUMBA_NUM_THREADS = _readenv ("NUMBA_NUM_THREADS" , int ,
303303 NUMBA_DEFAULT_NUM_THREADS )
304304
305+ # Profiling support
306+
307+ # Indicates if profiler is detected. Only VTune can be detected for now
308+ RUNNING_UNDER_PROFILER = 'VS_PROFILER' in os .environ
309+
310+ # Enables jit events in LLVM in order to support profiling of dynamic code
311+ ENABLE_PROFILING = _readenv ("NUMBA_ENABLE_PROFILING" , int , int (RUNNING_UNDER_PROFILER ))
312+
305313 # Debug Info
306314
307315 # The default value for the `debug` flag
308- DEBUGINFO_DEFAULT = _readenv ("NUMBA_DEBUGINFO" , int , 0 )
316+ DEBUGINFO_DEFAULT = _readenv ("NUMBA_DEBUGINFO" , int , ENABLE_PROFILING )
309317 CUDA_DEBUGINFO_DEFAULT = _readenv ("NUMBA_CUDA_DEBUGINFO" , int , 0 )
310318
311319 # Inject the configuration values into the module globals
Original file line number Diff line number Diff line change @@ -612,6 +612,9 @@ def _init(self, llvm_module):
612612 tm = target .create_target_machine (** tm_options )
613613 engine = ll .create_mcjit_compiler (llvm_module , tm )
614614
615+ if config .ENABLE_PROFILING :
616+ engine .enable_jit_events ()
617+
615618 self ._tm = tm
616619 self ._engine = JitEngine (engine )
617620 self ._target_data = engine .target_data
You can’t perform that action at this time.
0 commit comments