Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
647d0224
Commit
647d0224
authored
3 years ago
by
David Parks
Browse files
Options
Downloads
Patches
Plain Diff
SL-16243 Add Tracy timers to global new/delete overrides.
parent
a5b1c013
No related branches found
No related tags found
1 merge request
!83
Merge Linden 6.6.7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
indra/llcommon/llcommon.cpp
+22
-2
22 additions, 2 deletions
indra/llcommon/llcommon.cpp
indra/llcommon/llprofiler.h
+4
-2
4 additions, 2 deletions
indra/llcommon/llprofiler.h
indra/newview/llappviewerwin32.cpp
+2
-1
2 additions, 1 deletion
indra/newview/llappviewerwin32.cpp
with
28 additions
and
5 deletions
indra/llcommon/llcommon.cpp
+
22
−
2
View file @
647d0224
...
@@ -33,11 +33,22 @@
...
@@ -33,11 +33,22 @@
#include
"lltracethreadrecorder.h"
#include
"lltracethreadrecorder.h"
#include
"llcleanup.h"
#include
"llcleanup.h"
thread_local
bool
gProfilerEnabled
=
false
;
#if (TRACY_ENABLE)
#if (TRACY_ENABLE)
// Override new/delete for tracy memory profiling
// Override new/delete for tracy memory profiling
void
*
operator
new
(
size_t
size
)
void
*
operator
new
(
size_t
size
)
{
{
auto
ptr
=
(
malloc
)
(
size
);
void
*
ptr
;
if
(
gProfilerEnabled
)
{
LL_PROFILE_ZONE_SCOPED
;
ptr
=
(
malloc
)(
size
);
}
else
{
ptr
=
(
malloc
)(
size
);
}
if
(
!
ptr
)
if
(
!
ptr
)
{
{
throw
std
::
bad_alloc
();
throw
std
::
bad_alloc
();
...
@@ -49,8 +60,17 @@ void *operator new(size_t size)
...
@@ -49,8 +60,17 @@ void *operator new(size_t size)
void
operator
delete
(
void
*
ptr
)
noexcept
void
operator
delete
(
void
*
ptr
)
noexcept
{
{
TracyFree
(
ptr
);
TracyFree
(
ptr
);
if
(
gProfilerEnabled
)
{
LL_PROFILE_ZONE_SCOPED
;
(
free
)(
ptr
);
(
free
)(
ptr
);
}
}
else
{
(
free
)(
ptr
);
}
}
// C-style malloc/free can't be so easily overridden, so we define tracy versions and use
// C-style malloc/free can't be so easily overridden, so we define tracy versions and use
// a pre-processor #define in linden_common.h to redirect to them. The parens around the native
// a pre-processor #define in linden_common.h to redirect to them. The parens around the native
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/llprofiler.h
+
4
−
2
View file @
647d0224
...
@@ -36,6 +36,8 @@
...
@@ -36,6 +36,8 @@
#define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER
#define LL_PROFILER_CONFIGURATION LL_PROFILER_CONFIG_FAST_TIMER
#endif
#endif
extern
thread_local
bool
gProfilerEnabled
;
#if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE)
#if defined(LL_PROFILER_CONFIGURATION) && (LL_PROFILER_CONFIGURATION > LL_PROFILER_CONFIG_NONE)
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY || LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER
#define TRACY_ENABLE 1
#define TRACY_ENABLE 1
...
@@ -52,7 +54,7 @@
...
@@ -52,7 +54,7 @@
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY
#define LL_PROFILER_FRAME_END FrameMark
#define LL_PROFILER_FRAME_END FrameMark
#define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
#define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
; gProfilerEnabled = true;
#define LL_RECORD_BLOCK_TIME(name) ZoneScoped // Want descriptive names; was: ZoneNamedN( ___tracy_scoped_zone, #name, true );
#define LL_RECORD_BLOCK_TIME(name) ZoneScoped // Want descriptive names; was: ZoneNamedN( ___tracy_scoped_zone, #name, true );
#define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true );
#define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, name, true );
#define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB
#define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB
...
@@ -82,7 +84,7 @@
...
@@ -82,7 +84,7 @@
#endif
#endif
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER
#if LL_PROFILER_CONFIGURATION == LL_PROFILER_CONFIG_TRACY_FAST_TIMER
#define LL_PROFILER_FRAME_END FrameMark
#define LL_PROFILER_FRAME_END FrameMark
#define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
#define LL_PROFILER_SET_THREAD_NAME( name ) tracy::SetThreadName( name )
; gProfilerEnabled = true;
#define LL_RECORD_BLOCK_TIME(name) ZoneScoped const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__);
#define LL_RECORD_BLOCK_TIME(name) ZoneScoped const LLTrace::BlockTimer& LL_GLUE_TOKENS(block_time_recorder, __LINE__)(LLTrace::timeThisBlock(name)); (void)LL_GLUE_TOKENS(block_time_recorder, __LINE__);
#define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true );
#define LL_PROFILE_ZONE_NAMED(name) ZoneNamedN( ___tracy_scoped_zone, #name, true );
#define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB
#define LL_PROFILE_ZONE_NAMED_COLOR(name,color) ZoneNamedNC( ___tracy_scopped_zone, name, color, true ) // RGB
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llappviewerwin32.cpp
+
2
−
1
View file @
647d0224
...
@@ -325,7 +325,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
...
@@ -325,7 +325,8 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
{
{
// Call Tracy first thing to have it allocate memory
// Call Tracy first thing to have it allocate memory
// https://github.com/wolfpld/tracy/issues/196
// https://github.com/wolfpld/tracy/issues/196
LL_PROFILER_FRAME_END
LL_PROFILER_FRAME_END
;
LL_PROFILER_SET_THREAD_NAME
(
"App"
);
const
S32
MAX_HEAPS
=
255
;
const
S32
MAX_HEAPS
=
255
;
DWORD
heap_enable_lfh_error
[
MAX_HEAPS
];
DWORD
heap_enable_lfh_error
[
MAX_HEAPS
];
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment