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
a712aab6
Commit
a712aab6
authored
11 years ago
by
Richard Linden
Browse files
Options
Downloads
Patches
Plain Diff
added some defensive asserts in lltrace to make cases of misuse more obvious when it crashes
parent
3455bf95
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/lltracerecording.cpp
+11
-1
11 additions, 1 deletion
indra/llcommon/lltracerecording.cpp
indra/llcommon/lltracethreadrecorder.cpp
+15
-15
15 additions, 15 deletions
indra/llcommon/lltracethreadrecorder.cpp
with
26 additions
and
16 deletions
indra/llcommon/lltracerecording.cpp
+
11
−
1
View file @
a712aab6
...
@@ -88,6 +88,9 @@ Recording::~Recording()
...
@@ -88,6 +88,9 @@ Recording::~Recording()
disclaim_alloc
(
gTraceMemStat
,
this
);
disclaim_alloc
(
gTraceMemStat
,
this
);
disclaim_alloc
(
gTraceMemStat
,
mBuffers
);
disclaim_alloc
(
gTraceMemStat
,
mBuffers
);
// allow recording destruction without thread recorder running,
// otherwise thread shutdown could crash if a recording outlives the thread recorder
// besides, recording construction and destruction is fine without a recorder...just don't attempt to start one
if
(
isStarted
()
&&
LLTrace
::
get_thread_recorder
().
notNull
())
if
(
isStarted
()
&&
LLTrace
::
get_thread_recorder
().
notNull
())
{
{
LLTrace
::
get_thread_recorder
()
->
deactivate
(
mBuffers
.
write
());
LLTrace
::
get_thread_recorder
()
->
deactivate
(
mBuffers
.
write
());
...
@@ -101,7 +104,10 @@ void Recording::update()
...
@@ -101,7 +104,10 @@ void Recording::update()
{
{
mElapsedSeconds
+=
mSamplingTimer
.
getElapsedTimeF64
();
mElapsedSeconds
+=
mSamplingTimer
.
getElapsedTimeF64
();
llassert
(
mActiveBuffers
);
// must have
llassert
(
mActiveBuffers
!=
NULL
&&
LLTrace
::
get_thread_recorder
().
notNull
());
if
(
!
mActiveBuffers
->
isCurrent
())
if
(
!
mActiveBuffers
->
isCurrent
())
{
{
AccumulatorBufferGroup
*
buffers
=
mBuffers
.
write
();
AccumulatorBufferGroup
*
buffers
=
mBuffers
.
write
();
...
@@ -125,12 +131,16 @@ void Recording::handleStart()
...
@@ -125,12 +131,16 @@ void Recording::handleStart()
{
{
mSamplingTimer
.
reset
();
mSamplingTimer
.
reset
();
mBuffers
.
setStayUnique
(
true
);
mBuffers
.
setStayUnique
(
true
);
// must have thread recorder running on this thread
llassert
(
LLTrace
::
get_thread_recorder
().
notNull
());
mActiveBuffers
=
LLTrace
::
get_thread_recorder
()
->
activate
(
mBuffers
.
write
());
mActiveBuffers
=
LLTrace
::
get_thread_recorder
()
->
activate
(
mBuffers
.
write
());
}
}
void
Recording
::
handleStop
()
void
Recording
::
handleStop
()
{
{
mElapsedSeconds
+=
mSamplingTimer
.
getElapsedTimeF64
();
mElapsedSeconds
+=
mSamplingTimer
.
getElapsedTimeF64
();
// must have thread recorder running on this thread
llassert
(
LLTrace
::
get_thread_recorder
().
notNull
());
LLTrace
::
get_thread_recorder
()
->
deactivate
(
mBuffers
.
write
());
LLTrace
::
get_thread_recorder
()
->
deactivate
(
mBuffers
.
write
());
mActiveBuffers
=
NULL
;
mActiveBuffers
=
NULL
;
mBuffers
.
setStayUnique
(
false
);
mBuffers
.
setStayUnique
(
false
);
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/lltracethreadrecorder.cpp
+
15
−
15
View file @
a712aab6
...
@@ -191,25 +191,25 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate(
...
@@ -191,25 +191,25 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate(
void
ThreadRecorder
::
deactivate
(
AccumulatorBufferGroup
*
recording
)
void
ThreadRecorder
::
deactivate
(
AccumulatorBufferGroup
*
recording
)
{
{
active_recording_list_t
::
iterator
recording_it
=
bringUpToDate
(
recording
);
active_recording_list_t
::
iterator
recording_it
=
bringUpToDate
(
recording
);
if
(
recording_it
!=
mActiveRecordings
.
end
())
// this method should only be called on a thread where the recorder is active
llassert_always
(
recording_it
!=
mActiveRecordings
.
end
());
ActiveRecording
*
recording_to_remove
=
*
recording_it
;
bool
was_current
=
recording_to_remove
->
mPartialRecording
.
isCurrent
();
llassert
(
recording_to_remove
->
mTargetRecording
==
recording
);
mActiveRecordings
.
erase
(
recording_it
);
if
(
was_current
)
{
{
ActiveRecording
*
recording_to_remove
=
*
recording_it
;
if
(
mActiveRecordings
.
empty
())
bool
was_current
=
recording_to_remove
->
mPartialRecording
.
isCurrent
();
llassert
(
recording_to_remove
->
mTargetRecording
==
recording
);
mActiveRecordings
.
erase
(
recording_it
);
if
(
was_current
)
{
{
if
(
mActiveRecordings
.
empty
())
AccumulatorBufferGroup
::
clearCurrent
();
{
}
AccumulatorBufferGroup
::
clearCurrent
();
else
}
{
else
mActiveRecordings
.
back
()
->
mPartialRecording
.
makeCurrent
();
{
mActiveRecordings
.
back
()
->
mPartialRecording
.
makeCurrent
();
}
}
}
delete
recording_to_remove
;
}
}
delete
recording_to_remove
;
}
}
ThreadRecorder
::
ActiveRecording
::
ActiveRecording
(
AccumulatorBufferGroup
*
target
)
ThreadRecorder
::
ActiveRecording
::
ActiveRecording
(
AccumulatorBufferGroup
*
target
)
...
...
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