Skip to content

Commit a59b4da

Browse files
Abseil Teamrogeeff
Abseil Team
authored andcommitted
Export of internal Abseil changes
-- 17141711ee419daa597a9f31e73721f80143e55a by Gennadiy Rozental <[email protected]>: Import of CCTZ from GitHub. PiperOrigin-RevId: 401384949 -- ac48584a7b16e8a12e26d49deb6cddec584a20b5 by Derek Mauro <[email protected]>: Internal change PiperOrigin-RevId: 401337785 -- 8a51bb7c962845e0707240c5ba12c1b80f6fbbe9 by Derek Mauro <[email protected]>: Internal change PiperOrigin-RevId: 401047691 -- 8e18024510869247f3c04c7807c93709eca2322a by Chris Kennelly <[email protected]>: Note that SpinLock does not guarantee priorities for wakeups. PiperOrigin-RevId: 400999238 -- 75bc09b5f95fbb74b74d14c370bfb80011e8fb7f by Derek Mauro <[email protected]>: Add visibility restrictions to some internal targets PiperOrigin-RevId: 400718253 -- 1de5061016bc42cd7be009c9725ed2343ce12e3d by Abseil Team <[email protected]>: Make it clear that operator<< can also be used in place of ToString when logging absl::Status. PiperOrigin-RevId: 400248269 -- cda15d9dc6e5cd569de7e5e73f409b72a3caed51 by Abseil Team <[email protected]>: Minor cleanup PiperOrigin-RevId: 400087535 -- b001375ec47da3a0434be9ca9a45c0df510e7dda by Abseil Team <[email protected]>: Move periodic_sampler from base/internal to profiling/internal PiperOrigin-RevId: 400038533 -- e7e02e686abc3900e723080849a3607d190ef57f by Abseil Team <[email protected]>: Move exponential_biased from base/internal to profiling/internal PiperOrigin-RevId: 400020329 GitOrigin-RevId: 17141711ee419daa597a9f31e73721f80143e55a Change-Id: I10924df7e1cc198447813dbe97a374a5cef66b49
1 parent ae0f4c2 commit a59b4da

25 files changed

+204
-191
lines changed

Diff for: CMake/AbseilDll.cmake

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ set(ABSL_INTERNAL_DLL_FILES
1717
"base/internal/dynamic_annotations.h"
1818
"base/internal/endian.h"
1919
"base/internal/errno_saver.h"
20-
"base/internal/exponential_biased.cc"
21-
"base/internal/exponential_biased.h"
2220
"base/internal/fast_type_id.h"
2321
"base/internal/hide_ptr.h"
2422
"base/internal/identity.h"
@@ -28,8 +26,6 @@ set(ABSL_INTERNAL_DLL_FILES
2826
"base/internal/low_level_alloc.h"
2927
"base/internal/low_level_scheduling.h"
3028
"base/internal/per_thread_tls.h"
31-
"base/internal/periodic_sampler.cc"
32-
"base/internal/periodic_sampler.h"
3329
"base/internal/pretty_function.h"
3430
"base/internal/raw_logging.cc"
3531
"base/internal/raw_logging.h"
@@ -133,6 +129,10 @@ set(ABSL_INTERNAL_DLL_FILES
133129
"numeric/int128.h"
134130
"numeric/internal/bits.h"
135131
"numeric/internal/representation.h"
132+
"profiling/internal/exponential_biased.cc"
133+
"profiling/internal/exponential_biased.h"
134+
"profiling/internal/periodic_sampler.cc"
135+
"profiling/internal/periodic_sampler.h"
136136
"profiling/internal/sample_recorder.h"
137137
"random/bernoulli_distribution.h"
138138
"random/beta_distribution.h"

Diff for: absl/base/BUILD.bazel

-69
Original file line numberDiff line numberDiff line change
@@ -593,75 +593,6 @@ cc_test(
593593
],
594594
)
595595

596-
cc_library(
597-
name = "exponential_biased",
598-
srcs = ["internal/exponential_biased.cc"],
599-
hdrs = ["internal/exponential_biased.h"],
600-
linkopts = ABSL_DEFAULT_LINKOPTS,
601-
visibility = [
602-
"//absl:__subpackages__",
603-
],
604-
deps = [
605-
":config",
606-
":core_headers",
607-
],
608-
)
609-
610-
cc_test(
611-
name = "exponential_biased_test",
612-
size = "small",
613-
srcs = ["internal/exponential_biased_test.cc"],
614-
copts = ABSL_TEST_COPTS,
615-
linkopts = ABSL_DEFAULT_LINKOPTS,
616-
visibility = ["//visibility:private"],
617-
deps = [
618-
":exponential_biased",
619-
"//absl/strings",
620-
"@com_google_googletest//:gtest_main",
621-
],
622-
)
623-
624-
cc_library(
625-
name = "periodic_sampler",
626-
srcs = ["internal/periodic_sampler.cc"],
627-
hdrs = ["internal/periodic_sampler.h"],
628-
copts = ABSL_DEFAULT_COPTS,
629-
linkopts = ABSL_DEFAULT_LINKOPTS,
630-
deps = [
631-
":core_headers",
632-
":exponential_biased",
633-
],
634-
)
635-
636-
cc_test(
637-
name = "periodic_sampler_test",
638-
size = "small",
639-
srcs = ["internal/periodic_sampler_test.cc"],
640-
copts = ABSL_TEST_COPTS,
641-
linkopts = ABSL_DEFAULT_LINKOPTS,
642-
visibility = ["//visibility:private"],
643-
deps = [
644-
":core_headers",
645-
":periodic_sampler",
646-
"@com_google_googletest//:gtest_main",
647-
],
648-
)
649-
650-
cc_binary(
651-
name = "periodic_sampler_benchmark",
652-
testonly = 1,
653-
srcs = ["internal/periodic_sampler_benchmark.cc"],
654-
copts = ABSL_TEST_COPTS,
655-
linkopts = ABSL_DEFAULT_LINKOPTS,
656-
tags = ["benchmark"],
657-
visibility = ["//visibility:private"],
658-
deps = [
659-
":core_headers",
660-
":periodic_sampler",
661-
"@com_github_google_benchmark//:benchmark_main",
662-
],
663-
)
664-
665596
cc_library(
666597
name = "scoped_set_env",
667598
testonly = 1,

Diff for: absl/base/CMakeLists.txt

-54
Original file line numberDiff line numberDiff line change
@@ -519,60 +519,6 @@ absl_cc_test(
519519
GTest::gtest_main
520520
)
521521

522-
absl_cc_library(
523-
NAME
524-
exponential_biased
525-
SRCS
526-
"internal/exponential_biased.cc"
527-
HDRS
528-
"internal/exponential_biased.h"
529-
COPTS
530-
${ABSL_DEFAULT_COPTS}
531-
DEPS
532-
absl::config
533-
absl::core_headers
534-
)
535-
536-
absl_cc_test(
537-
NAME
538-
exponential_biased_test
539-
SRCS
540-
"internal/exponential_biased_test.cc"
541-
COPTS
542-
${ABSL_TEST_COPTS}
543-
DEPS
544-
absl::exponential_biased
545-
absl::strings
546-
GTest::gmock_main
547-
)
548-
549-
absl_cc_library(
550-
NAME
551-
periodic_sampler
552-
SRCS
553-
"internal/periodic_sampler.cc"
554-
HDRS
555-
"internal/periodic_sampler.h"
556-
COPTS
557-
${ABSL_DEFAULT_COPTS}
558-
DEPS
559-
absl::core_headers
560-
absl::exponential_biased
561-
)
562-
563-
absl_cc_test(
564-
NAME
565-
periodic_sampler_test
566-
SRCS
567-
"internal/periodic_sampler_test.cc"
568-
COPTS
569-
${ABSL_TEST_COPTS}
570-
DEPS
571-
absl::core_headers
572-
absl::periodic_sampler
573-
GTest::gmock_main
574-
)
575-
576522
absl_cc_library(
577523
NAME
578524
scoped_set_env

Diff for: absl/base/internal/spinlock.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@
1616

1717
// Most users requiring mutual exclusion should use Mutex.
1818
// SpinLock is provided for use in two situations:
19-
// - for use in code that Mutex itself depends on
19+
// - for use by Abseil internal code that Mutex itself depends on
2020
// - for async signal safety (see below)
2121

2222
// SpinLock is async signal safe. If a spinlock is used within a signal
2323
// handler, all code that acquires the lock must ensure that the signal cannot
2424
// arrive while they are holding the lock. Typically, this is done by blocking
2525
// the signal.
26+
//
27+
// Threads waiting on a SpinLock may be woken in an arbitrary order.
2628

2729
#ifndef ABSL_BASE_INTERNAL_SPINLOCK_H_
2830
#define ABSL_BASE_INTERNAL_SPINLOCK_H_

Diff for: absl/base/internal/spinlock_wait.h

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ struct SpinLockWaitTransition {
3939
// satisfying 0<=i<n && trans[i].done, atomically make the transition,
4040
// then return the old value of *w. Make any other atomic transitions
4141
// where !trans[i].done, but continue waiting.
42+
//
43+
// Wakeups for threads blocked on SpinLockWait do not respect priorities.
4244
uint32_t SpinLockWait(std::atomic<uint32_t> *w, int n,
4345
const SpinLockWaitTransition trans[],
4446
SchedulingMode scheduling_mode);

Diff for: absl/container/BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,9 @@ cc_library(
510510
":have_sse",
511511
"//absl/base",
512512
"//absl/base:core_headers",
513-
"//absl/base:exponential_biased",
514513
"//absl/debugging:stacktrace",
515514
"//absl/memory",
515+
"//absl/profiling:exponential_biased",
516516
"//absl/profiling:sample_recorder",
517517
"//absl/synchronization",
518518
"//absl/utility",

Diff for: absl/container/internal/hashtablez_sampler.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
#include <limits>
2222

2323
#include "absl/base/attributes.h"
24-
#include "absl/base/internal/exponential_biased.h"
2524
#include "absl/container/internal/have_sse.h"
2625
#include "absl/debugging/stacktrace.h"
2726
#include "absl/memory/memory.h"
27+
#include "absl/profiling/internal/exponential_biased.h"
2828
#include "absl/profiling/internal/sample_recorder.h"
2929
#include "absl/synchronization/mutex.h"
3030

@@ -40,7 +40,7 @@ ABSL_CONST_INIT std::atomic<bool> g_hashtablez_enabled{
4040
ABSL_CONST_INIT std::atomic<int32_t> g_hashtablez_sample_parameter{1 << 10};
4141

4242
#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
43-
ABSL_PER_THREAD_TLS_KEYWORD absl::base_internal::ExponentialBiased
43+
ABSL_PER_THREAD_TLS_KEYWORD absl::profiling_internal::ExponentialBiased
4444
g_exponential_biased_generator;
4545
#endif
4646

Diff for: absl/debugging/BUILD.bazel

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ cc_library(
183183
],
184184
copts = ABSL_DEFAULT_COPTS,
185185
linkopts = ABSL_DEFAULT_LINKOPTS,
186+
visibility = ["//visibility:private"],
186187
deps = [
187188
"//absl/base:config",
188189
"//absl/base:core_headers",
@@ -197,6 +198,7 @@ cc_library(
197198
srcs = ["internal/demangle.cc"],
198199
hdrs = ["internal/demangle.h"],
199200
copts = ABSL_DEFAULT_COPTS,
201+
visibility = ["//visibility:private"],
200202
deps = [
201203
"//absl/base",
202204
"//absl/base:config",

Diff for: absl/profiling/BUILD.bazel

+73
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ load(
1616
"//absl:copts/configure_copts.bzl",
1717
"ABSL_DEFAULT_COPTS",
1818
"ABSL_DEFAULT_LINKOPTS",
19+
"ABSL_TEST_COPTS",
1920
)
2021

2122
package(default_visibility = ["//visibility:private"])
@@ -51,3 +52,75 @@ cc_test(
5152
"@com_google_googletest//:gtest_main",
5253
],
5354
)
55+
56+
cc_library(
57+
name = "exponential_biased",
58+
srcs = ["internal/exponential_biased.cc"],
59+
hdrs = ["internal/exponential_biased.h"],
60+
linkopts = ABSL_DEFAULT_LINKOPTS,
61+
visibility = [
62+
"//absl:__subpackages__",
63+
],
64+
deps = [
65+
"//absl/base:config",
66+
"//absl/base:core_headers",
67+
],
68+
)
69+
70+
cc_test(
71+
name = "exponential_biased_test",
72+
size = "small",
73+
srcs = ["internal/exponential_biased_test.cc"],
74+
copts = ABSL_TEST_COPTS,
75+
linkopts = ABSL_DEFAULT_LINKOPTS,
76+
visibility = ["//visibility:private"],
77+
deps = [
78+
":exponential_biased",
79+
"//absl/strings",
80+
"@com_google_googletest//:gtest_main",
81+
],
82+
)
83+
84+
cc_library(
85+
name = "periodic_sampler",
86+
srcs = ["internal/periodic_sampler.cc"],
87+
hdrs = ["internal/periodic_sampler.h"],
88+
copts = ABSL_DEFAULT_COPTS,
89+
linkopts = ABSL_DEFAULT_LINKOPTS,
90+
visibility = [
91+
"//absl:__subpackages__",
92+
],
93+
deps = [
94+
":exponential_biased",
95+
"//absl/base:core_headers",
96+
],
97+
)
98+
99+
cc_test(
100+
name = "periodic_sampler_test",
101+
size = "small",
102+
srcs = ["internal/periodic_sampler_test.cc"],
103+
copts = ABSL_TEST_COPTS,
104+
linkopts = ABSL_DEFAULT_LINKOPTS,
105+
visibility = ["//visibility:private"],
106+
deps = [
107+
":periodic_sampler",
108+
"//absl/base:core_headers",
109+
"@com_google_googletest//:gtest_main",
110+
],
111+
)
112+
113+
cc_binary(
114+
name = "periodic_sampler_benchmark",
115+
testonly = 1,
116+
srcs = ["internal/periodic_sampler_benchmark.cc"],
117+
copts = ABSL_TEST_COPTS,
118+
linkopts = ABSL_DEFAULT_LINKOPTS,
119+
tags = ["benchmark"],
120+
visibility = ["//visibility:private"],
121+
deps = [
122+
":periodic_sampler",
123+
"//absl/base:core_headers",
124+
"@com_github_google_benchmark//:benchmark_main",
125+
],
126+
)

Diff for: absl/profiling/CMakeLists.txt

+54
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,57 @@ absl_cc_test(
3737
GTest::gmock_main
3838
)
3939

40+
absl_cc_library(
41+
NAME
42+
exponential_biased
43+
SRCS
44+
"internal/exponential_biased.cc"
45+
HDRS
46+
"internal/exponential_biased.h"
47+
COPTS
48+
${ABSL_DEFAULT_COPTS}
49+
DEPS
50+
absl::config
51+
absl::core_headers
52+
)
53+
54+
absl_cc_test(
55+
NAME
56+
exponential_biased_test
57+
SRCS
58+
"internal/exponential_biased_test.cc"
59+
COPTS
60+
${ABSL_TEST_COPTS}
61+
DEPS
62+
absl::exponential_biased
63+
absl::strings
64+
GTest::gmock_main
65+
)
66+
67+
absl_cc_library(
68+
NAME
69+
periodic_sampler
70+
SRCS
71+
"internal/periodic_sampler.cc"
72+
HDRS
73+
"internal/periodic_sampler.h"
74+
COPTS
75+
${ABSL_DEFAULT_COPTS}
76+
DEPS
77+
absl::core_headers
78+
absl::exponential_biased
79+
)
80+
81+
absl_cc_test(
82+
NAME
83+
periodic_sampler_test
84+
SRCS
85+
"internal/periodic_sampler_test.cc"
86+
COPTS
87+
${ABSL_TEST_COPTS}
88+
DEPS
89+
absl::core_headers
90+
absl::periodic_sampler
91+
GTest::gmock_main
92+
)
93+

0 commit comments

Comments
 (0)