Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abseil-cpp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
abseil-cpp
Commits
b308bc06
Commit
b308bc06
authored
Sep 01, 2022
by
Abseil Team
Committed by
Copybara-Service
Sep 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes mutex profiling
PiperOrigin-RevId: 471545981 Change-Id: I4d2c8b6d4f1e58976915bda78a77178b8bf80da8
parent
43d3c7a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
absl/synchronization/mutex.cc
+4
-1
absl/synchronization/mutex.h
+1
-1
No files found.
absl/synchronization/mutex.cc
View file @
b308bc06
...
@@ -493,7 +493,8 @@ struct SynchWaitParams {
...
@@ -493,7 +493,8 @@ struct SynchWaitParams {
cvmu
(
cvmu_arg
),
cvmu
(
cvmu_arg
),
thread
(
thread_arg
),
thread
(
thread_arg
),
cv_word
(
cv_word_arg
),
cv_word
(
cv_word_arg
),
contention_start_cycles
(
base_internal
::
CycleClock
::
Now
())
{}
contention_start_cycles
(
base_internal
::
CycleClock
::
Now
()),
should_submit_contention_data
(
false
)
{}
const
Mutex
::
MuHow
how
;
// How this thread needs to wait.
const
Mutex
::
MuHow
how
;
// How this thread needs to wait.
const
Condition
*
cond
;
// The condition that this thread is waiting for.
const
Condition
*
cond
;
// The condition that this thread is waiting for.
...
@@ -511,6 +512,7 @@ struct SynchWaitParams {
...
@@ -511,6 +512,7 @@ struct SynchWaitParams {
int64_t
contention_start_cycles
;
// Time (in cycles) when this thread started
int64_t
contention_start_cycles
;
// Time (in cycles) when this thread started
// to contend for the mutex.
// to contend for the mutex.
bool
should_submit_contention_data
;
};
};
struct
SynchLocksHeld
{
struct
SynchLocksHeld
{
...
@@ -2348,6 +2350,7 @@ ABSL_ATTRIBUTE_NOINLINE void Mutex::UnlockSlow(SynchWaitParams *waitp) {
...
@@ -2348,6 +2350,7 @@ ABSL_ATTRIBUTE_NOINLINE void Mutex::UnlockSlow(SynchWaitParams *waitp) {
if
(
!
wake_list
->
cond_waiter
)
{
if
(
!
wake_list
->
cond_waiter
)
{
wait_cycles
+=
(
now
-
wake_list
->
waitp
->
contention_start_cycles
);
wait_cycles
+=
(
now
-
wake_list
->
waitp
->
contention_start_cycles
);
wake_list
->
waitp
->
contention_start_cycles
=
now
;
wake_list
->
waitp
->
contention_start_cycles
=
now
;
wake_list
->
waitp
->
should_submit_contention_data
=
true
;
}
}
wake_list
=
Wakeup
(
wake_list
);
// wake waiters
wake_list
=
Wakeup
(
wake_list
);
// wake waiters
}
while
(
wake_list
!=
kPerThreadSynchNull
);
}
while
(
wake_list
!=
kPerThreadSynchNull
);
...
...
absl/synchronization/mutex.h
View file @
b308bc06
...
@@ -988,7 +988,7 @@ inline Condition::Condition(const T *object,
...
@@ -988,7 +988,7 @@ inline Condition::Condition(const T *object,
method_
(
reinterpret_cast
<
InternalMethodType
>
(
method
)),
method_
(
reinterpret_cast
<
InternalMethodType
>
(
method
)),
arg_
(
reinterpret_cast
<
void
*>
(
const_cast
<
T
*>
(
object
)))
{}
arg_
(
reinterpret_cast
<
void
*>
(
const_cast
<
T
*>
(
object
)))
{}
// Register
a hook
for profiling support.
// Register
hooks
for profiling support.
//
//
// The function pointer registered here will be called whenever a mutex is
// The function pointer registered here will be called whenever a mutex is
// contended. The callback is given the cycles for which waiting happened (as
// contended. The callback is given the cycles for which waiting happened (as
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment