kernel_profiling.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2011-2018 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __KERNEL_PROFILING_H__
  17. #define __KERNEL_PROFILING_H__
  18. #ifdef __KERNEL_CPU__
  19. # include "util/util_profiling.h"
  20. #endif
  21. CCL_NAMESPACE_BEGIN
  22. #ifdef __KERNEL_CPU__
  23. # define PROFILING_INIT(kg, event) ProfilingHelper profiling_helper(&kg->profiler, event)
  24. # define PROFILING_EVENT(event) profiling_helper.set_event(event)
  25. # define PROFILING_SHADER(shader) \
  26. if ((shader) != SHADER_NONE) { \
  27. profiling_helper.set_shader((shader)&SHADER_MASK); \
  28. }
  29. # define PROFILING_OBJECT(object) \
  30. if ((object) != PRIM_NONE) { \
  31. profiling_helper.set_object(object); \
  32. }
  33. #else
  34. # define PROFILING_INIT(kg, event)
  35. # define PROFILING_EVENT(event)
  36. # define PROFILING_SHADER(shader)
  37. # define PROFILING_OBJECT(object)
  38. #endif /* __KERNEL_CPU__ */
  39. CCL_NAMESPACE_END
  40. #endif /* __KERNEL_PROFILING_H__ */