diff options
-rw-r--r-- | intern/cycles/integrator/path_trace_work_cpu.cpp | 13 | ||||
-rw-r--r-- | intern/cycles/util/profiling.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/util/profiling.h | 2 |
3 files changed, 15 insertions, 5 deletions
diff --git a/intern/cycles/integrator/path_trace_work_cpu.cpp b/intern/cycles/integrator/path_trace_work_cpu.cpp index 530e60d6750..2f6c3cf5aca 100644 --- a/intern/cycles/integrator/path_trace_work_cpu.cpp +++ b/intern/cycles/integrator/path_trace_work_cpu.cpp @@ -78,8 +78,10 @@ void PathTraceWorkCPU::render_samples(RenderStatistics &statistics, const int64_t image_height = effective_buffer_params_.height; const int64_t total_pixels_num = image_width * image_height; - for (CPUKernelThreadGlobals &kernel_globals : kernel_thread_globals_) { - kernel_globals.start_profiling(); + if (device_->profiler.active()) { + for (CPUKernelThreadGlobals &kernel_globals : kernel_thread_globals_) { + kernel_globals.start_profiling(); + } } tbb::task_arena local_arena = local_tbb_arena_create(device_); @@ -108,9 +110,10 @@ void PathTraceWorkCPU::render_samples(RenderStatistics &statistics, render_samples_full_pipeline(kernel_globals, work_tile, samples_num); }); }); - - for (CPUKernelThreadGlobals &kernel_globals : kernel_thread_globals_) { - kernel_globals.stop_profiling(); + if (device_->profiler.active()) { + for (CPUKernelThreadGlobals &kernel_globals : kernel_thread_globals_) { + kernel_globals.stop_profiling(); + } } statistics.occupancy = 1.0f; diff --git a/intern/cycles/util/profiling.cpp b/intern/cycles/util/profiling.cpp index 55b35b7320f..d6df1b0b807 100644 --- a/intern/cycles/util/profiling.cpp +++ b/intern/cycles/util/profiling.cpp @@ -171,4 +171,9 @@ bool Profiler::get_object(int object, uint64_t &samples, uint64_t &hits) return true; } +bool Profiler::active() const +{ + return (worker != nullptr); +} + CCL_NAMESPACE_END diff --git a/intern/cycles/util/profiling.h b/intern/cycles/util/profiling.h index b30aac90879..4ced1d90371 100644 --- a/intern/cycles/util/profiling.h +++ b/intern/cycles/util/profiling.h @@ -96,6 +96,8 @@ class Profiler { bool get_shader(int shader, uint64_t &samples, uint64_t &hits); bool get_object(int object, uint64_t &samples, uint64_t &hits); + bool active() const; + protected: void run(); |