diff options
author | Abseil Team <absl-team@google.com> | 2021-10-27 13:22:18 -0700 |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2021-10-28 00:09:21 -0400 |
commit | cc413f8b674d61e3aa948386432e526e051afca0 (patch) | |
tree | 87292c6510661a0443c346c7b8be360c824647a4 /absl/container/internal/hashtablez_sampler.cc | |
parent | f70eadadd7767c3a97774b63c4c23981fa89af9f (diff) | |
download | abseil-cc413f8b674d61e3aa948386432e526e051afca0.tar.gz abseil-cc413f8b674d61e3aa948386432e526e051afca0.tar.bz2 abseil-cc413f8b674d61e3aa948386432e526e051afca0.zip |
Export of internal Abseil changes
--
05a099a580753f8e96cee38572e94dcdc079361b by Abseil Team <absl-team@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 405966217
--
c6b81e9ebc183d8389f14ecd091c8bad08cfe0aa by Abseil Team <absl-team@google.com>:
Add `inline_element_size` to hashtablez (so that we can compute the weighted load factors properly e.g., in b/187896534).
PiperOrigin-RevId: 405917711
--
3e3673de4e54e4142c54b09e1644dfa3de4bb296 by Abseil Team <absl-team@google.com>:
align indent of code comment in mutex.h
PiperOrigin-RevId: 405871997
--
2248301a5b14f8d2be5b2e9088f3528a353ea491 by Derek Mauro <dmauro@google.com>:
Internal change
PiperOrigin-RevId: 405639236
--
bc7d3c56fdad3dde4b89324af142529f2afe5f1b by Abseil Team <absl-team@google.com>:
Import of CCTZ from GitHub.
PiperOrigin-RevId: 405508045
--
66472387276ef02505d99195747be862768bb35b by Laramie Leavitt <lar@google.com>:
Also use uint8_t golden values in randen_test.cc
This makes randen_test, randen_slow_test, and randen_hwaes_test essentially
identical, as is the intent.
PiperOrigin-RevId: 405484423
GitOrigin-RevId: 05a099a580753f8e96cee38572e94dcdc079361b
Change-Id: I3dd5b0cfdb98d6e1ab02266194ba67d15428c2f8
Diffstat (limited to 'absl/container/internal/hashtablez_sampler.cc')
-rw-r--r-- | absl/container/internal/hashtablez_sampler.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/absl/container/internal/hashtablez_sampler.cc b/absl/container/internal/hashtablez_sampler.cc index 7070912e..40cce047 100644 --- a/absl/container/internal/hashtablez_sampler.cc +++ b/absl/container/internal/hashtablez_sampler.cc @@ -55,6 +55,9 @@ HashtablezSampler& GlobalHashtablezSampler() { return *sampler; } +// TODO(bradleybear): The comments at this constructors declaration say that the +// fields are not initialized, but this definition does initialize the fields. +// Something needs to be cleaned up. HashtablezInfo::HashtablezInfo() { PrepareForSampling(); } HashtablezInfo::~HashtablezInfo() = default; @@ -98,10 +101,12 @@ static bool ShouldForceSampling() { return state == kForce; } -HashtablezInfo* SampleSlow(int64_t* next_sample) { +HashtablezInfo* SampleSlow(int64_t* next_sample, size_t inline_element_size) { if (ABSL_PREDICT_FALSE(ShouldForceSampling())) { *next_sample = 1; - return GlobalHashtablezSampler().Register(); + HashtablezInfo* result = GlobalHashtablezSampler().Register(); + result->inline_element_size = inline_element_size; + return result; } #if !defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) @@ -123,10 +128,12 @@ HashtablezInfo* SampleSlow(int64_t* next_sample) { // that case. if (first) { if (ABSL_PREDICT_TRUE(--*next_sample > 0)) return nullptr; - return SampleSlow(next_sample); + return SampleSlow(next_sample, inline_element_size); } - return GlobalHashtablezSampler().Register(); + HashtablezInfo* result = GlobalHashtablezSampler().Register(); + result->inline_element_size = inline_element_size; + return result; #endif } |