godot_voxel/util/profiling.h

41 lines
1.1 KiB
C
Raw Normal View History

2020-08-29 23:20:51 +01:00
#ifndef VOXEL_PROFILING_H
#define VOXEL_PROFILING_H
#if defined(TRACY_ENABLE)
#include <thirdparty/tracy/Tracy.hpp>
#include <thirdparty/tracy/common/TracySystem.hpp>
#define VOXEL_PROFILER_ENABLED
#define VOXEL_PROFILE_SCOPE() ZoneScoped
#define VOXEL_PROFILE_SCOPE_NAMED(name) ZoneScopedN(name)
#define VOXEL_PROFILE_MARK_FRAME() FrameMark
#define VOXEL_PROFILE_SET_THREAD_NAME(name) tracy::SetThreadName(name)
2021-05-29 15:07:40 +01:00
#define VOXEL_PROFILE_PLOT(name, number) TracyPlot(name, number)
2020-08-29 23:20:51 +01:00
#else
2020-08-29 23:20:51 +01:00
#define VOXEL_PROFILE_SCOPE()
// Name must be static const char* (usually string litteral)
#define VOXEL_PROFILE_SCOPE_NAMED(name)
#define VOXEL_PROFILE_MARK_FRAME()
2021-05-29 15:07:40 +01:00
#define VOXEL_PROFILE_PLOT(name, number)
// Name must be const char*. An internal copy will be made so it can be temporary.
#define VOXEL_PROFILE_SET_THREAD_NAME(name)
2020-08-29 23:20:51 +01:00
#endif
2020-10-29 00:47:16 +00:00
/*
To add Tracy support, clone it under thirdparty/tracy, and add the following lines in core/SCsub:
```
# tracy library
env.Append(CPPDEFINES="TRACY_ENABLE")
env_thirdparty.Append(CPPDEFINES="TRACY_ENABLE")
env_thirdparty.add_source_files(env.core_sources, ["#thirdparty/tracy/TracyClient.cpp"])
```
*/
2020-08-29 23:20:51 +01:00
#endif // VOXEL_PROFILING_H