godot_voxel/util/profiling.h

47 lines
1.4 KiB
C
Raw Normal View History

2022-04-09 15:33:08 +01:00
#ifndef ZN_PROFILING_H
#define ZN_PROFILING_H
2020-08-29 23:20:51 +01:00
#if defined(TRACY_ENABLE)
#include <thirdparty/tracy/Tracy.hpp>
#include <thirdparty/tracy/common/TracySystem.hpp>
2022-04-09 15:33:08 +01:00
#define ZN_PROFILER_ENABLED
2022-04-09 15:33:08 +01:00
#define ZN_PROFILE_SCOPE() ZoneScoped
#define ZN_PROFILE_SCOPE_NAMED(name) ZoneScopedN(name)
#define ZN_PROFILE_MARK_FRAME() FrameMark
#define ZN_PROFILE_SET_THREAD_NAME(name) tracy::SetThreadName(name)
#define ZN_PROFILE_PLOT(name, number) TracyPlot(name, number)
#define ZN_PROFILE_MESSAGE(message) TracyMessageL(message)
#define ZN_PROFILE_MESSAGE_DYN(message, size) TracyMessage(message, size)
2020-08-29 23:20:51 +01:00
#else
2022-04-09 15:33:08 +01:00
#define ZN_PROFILE_SCOPE()
// Name must be static const char* (usually string litteral)
2022-04-09 15:33:08 +01:00
#define ZN_PROFILE_SCOPE_NAMED(name)
#define ZN_PROFILE_MARK_FRAME()
#define ZN_PROFILE_PLOT(name, number)
#define ZN_PROFILE_MESSAGE(message)
// Name must be const char*. An internal copy will be made so it can be temporary.
2022-03-15 20:03:35 +00:00
// Size does not include the terminating character.
2022-04-09 15:33:08 +01:00
#define ZN_PROFILE_MESSAGE_DYN(message, size)
2022-03-15 20:03:35 +00:00
// Name must be const char*. An internal copy will be made so it can be temporary.
2022-04-09 15:33:08 +01:00
#define ZN_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"])
```
*/
2022-04-09 15:33:08 +01:00
#endif // ZN_PROFILING_H