Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#6938 sched migrate: Add lock contention stats #6968

Merged
merged 4 commits into from
Sep 9, 2024

Conversation

derekbruening
Copy link
Contributor

@derekbruening derekbruening commented Sep 6, 2024

Adds lock contention counters for mutex_dbg_owned::lock() in non-NDEBUG builds.
While it's not there for release builds, the results in non-release should still be
indicative of general lock behavior.

When I just changed the mutex_dbg_owned header, the relese build static drmemtrace
tests (e.g., the burst_* ones) were all failing with floating point exceptions. It
turns out it's due to different compilation units having different values for NDEBUG.
I tried to make them all the same: but we have some files that contain #undef NDEBUG
and other complexities. So I split the mutex_dbg_owned implementation into a
.cpp file and have the mutex wrapper extra fields always present.

Prints the stats for sched_lock_ with the other scheduler stats.

Sample results on schedule_stats on a threadsig trace show a lot of contention even with only 3 cores:

$ clients/bin64/drmemtrace_launcher -indir ../build_x64_dbg_tests/drmemtrace.threadsig.5* -core_sharded -cores 3 -tool schedule_stats -verbose 1
[scheduler] Schedule lock acquired     :   2196602
[scheduler] Schedule lock contended    :    257580

Issue: #6938

Adds lock contention counters for mutex_dbg_owned::lock() in
non-NDEBUG builds.  While it's not there for release builds, the
results in non-release should still be indicative of general lock
behavior.

Prints the stats for sched_lock_ with the other scheduler stats.

Sample results on schedule_stats on a threadsig trace show a lot of
contention even with only 3 cores:

```
$ clients/bin64/drmemtrace_launcher -indir ../build_x64_dbg_tests/drmemtrace.threadsig.5* -core_sharded -cores 3 -tool schedule_stats -verbose 1
[scheduler] Schedule lock acquired     :   2196602
[scheduler] Schedule lock contended    :    257580
```

Issue: #6938
@derekbruening
Copy link
Contributor Author

Relese build static drmemtrace tests (e.g., the burst_* ones) are all failing with floating point exceptions. It turns out it's due to different compilation units having different values for NDEBUG. I tried to make them all the same: but we have some files that contain #undef NDEBUG and other complexities. So I split the mutex_dbg_owned implementation into a .cpp file and
have the mutex wrapper extra fields always present.

@derekbruening
Copy link
Contributor Author

win64 failure is drcacheoff.gencode callback.c assert #6081

@derekbruening derekbruening merged commit 6630c73 into master Sep 9, 2024
16 of 17 checks passed
@derekbruening derekbruening deleted the i6938-lock-contention branch September 9, 2024 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants