Newton Dynamics  4.00
dTracyProfiler.h
1 /* Copyright (c) <2018-2018> <Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely
10 */
11 
12 #ifndef __D_TRACY_PROFILER_H__
13 #define __D_TRACY_PROFILER_H__
14 
15 
16 #ifdef D_PROFILER_EXPORTS
17 #define D_PROFILER_API __declspec(dllexport)
18 #else
19 #define D_PROFILER_API __declspec(dllimport)
20 #endif
21 
23 {
24  const char* name;
25  const char* function;
26  const char* file;
27  long long line;
28  long long color;
29 };
30 
31 D_PROFILER_API void dProfilerEnableProlingLow();
32 D_PROFILER_API void dProfilerStartTraceLow(const dProfilerSourceLocation* const sourceLocation);
33 D_PROFILER_API void dProfilerEndTraceLow();
34 D_PROFILER_API void dProfilerSetTrackNameLow(const char* const trackName);
35 
36 
37 #ifdef D_PROFILER
38 
39 class dgProfile
40 {
41  public:
42  dgProfile(const dProfilerSourceLocation* const location)
43  {
44  dProfilerStartTraceLow(location);
45  }
46 
47  ~dgProfile()
48  {
49  dProfilerEndTraceLow();
50  }
51 };
52 
53 #define dProfilerEnableProling() dProfilerEnableProlingLow();
54 #define dProfilerZoneScoped(name) \
55 static const dProfilerSourceLocation __dprofiler_source_location { name, __FUNCTION__, __FILE__, (long long)__LINE__, 0 }; \
56 dgProfile ___dgprofile_scoped_zone( &__dprofiler_source_location );
57 
58 #define dProfilerSetTrackName(trackName) dProfilerSetTrackNameLow(trackName)
59 
60 #else
61 
62 #define dProfilerEnableProling(mode);
63 #define dProfilerZoneScoped(name)
64 #define dProfilerSetTrackName(trackName)
65 #endif
66 
67 #endif
dProfilerSourceLocation
Definition: dTracyProfiler.h:23