1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/**
* @file lltelemetry.h
* @brief Wrapper for Rad Game Tools Telemetry
*
* $LicenseInfo:firstyear=2020&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2020, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
/*
To use:
1. Uncomment #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER below
2. Include this header file
#include "lltelemetry.h"
3. Add zones to the functions you wish to profile
void onFoo()
{
LLPROFILE_ZONE("Foo");
}
*/
//#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 1
// Default NO local telemetry profiling
#ifndef LLPROFILE_USE_RAD_TELEMETRY_PROFILER
#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 0
#define LLPROFILE_SHUTDOWN( ...) {}
#define LLPROFILE_STARTUP( ...) {}
#define LLPROFILE_UPDATE( ...) {}
#define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b)
#define LLPROFILE_ENTER(name)
#define LLPROFILE_ENTER_FORMAT(format, ...)
#define LLPROFILE_FUNCTION
#define LLPROFILE_LEAVE()
#define LLPROFILE_THREAD_NAME(name)
#define LLPROFILE_ZONE(name)
#define LLPROFILE_ZONE_FORMAT(format, ...)
#else
#include <rad_tm.h>
#define LLPROFILE_SHUTDOWN telemetry_shutdown
#define LLPROFILE_STARTUP telemetry_startup
#define LLPROFILE_UPDATE telemetry_update
#define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) tmZoneColor(r, g, b)
#define LLPROFILE_ENTER(name) tmEnter(0, 0, name)
#define LLPROFILE_ENTER_FORMAT(format, ...) tmEnter(0, 0, format, __VA_ARGS__)
#define LLPROFILE_FUNCTION tmFunction(0, 0)
#define LLPROFILE_LEAVE() tmLeave(0)
#define LLPROFILE_THREAD_NAME(name) tmThreadName(0, 0, name)
#define LLPROFILE_ZONE(name) tmZone(0, 0, name)
#define LLPROFILE_ZONE_FORMAT(format, ...) tmZone(0, 0, format, __VA_ARGS__)
#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER
//
// exported functionality
//
extern void telemetry_startup();
extern void telemetry_shutdown();
extern void telemetry_update(); // called after every frame update
|