-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
stats: add built-in log linear histogram support #3059
Changes from 1 commit
f0a7faa
1a35b0e
5b66b74
8052ae7
5d30b85
a0bf03c
dede1fd
e744253
0aeac15
c200974
dd79e35
9dcddf6
5e8169a
f35083c
08cc211
a107b0f
dadba03
e41d7ef
9da426e
92620e5
6e6253a
6ca87c4
fa8f646
2b5772f
1032ffc
8266868
a041a3e
c9fef4b
29646d0
df348b2
68039f2
1b75b93
d5d4125
16003e7
05d00a2
9189b9e
1837956
8b1c7ab
2894da8
1e1f494
5ae99d3
7d3844e
5ccad60
339674c
33da1eb
61eb8bb
60f79e6
532a59b
aa5eda4
72d8850
cd0851f
85f5967
c010914
135d6f8
369877a
97daa92
edf4a52
b204bff
e6669b2
64d8c2a
86f447d
af7aacd
e9547f6
60428d3
9ee5b0a
b46f01c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,19 @@ class StatsThreadLocalStoreTest : public testing::Test, public RawStatDataAlloca | |
store_->addSink(sink_); | ||
} | ||
|
||
void setUp() { | ||
InSequence s; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I admit I've never been a huge gmock user. But I looked up InSequence and I suspect this usage model is not quite right. Check out https://github.com/google/googletest/blob/master/googlemock/docs/ForDummies.md#ordered-vs-unordered-calls I think this only affects what's in the scope of that declaration, which in this case is only one call. I would think it should either be declared at the top of SetUp or as a class member var. |
||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
} | ||
|
||
void tearDown() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. void TearDown() override { .... |
||
store_->shutdownThreading(); | ||
tls_.shutdownThread(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
} | ||
|
||
std::vector<uint64_t> h1_cumulative_values, h2_cumulative_values, h1_interval_values, | ||
h2_interval_values; | ||
|
||
|
@@ -265,8 +278,7 @@ TEST_F(StatsThreadLocalStoreTest, BasicScope) { | |
EXPECT_CALL(*this, free(_)).Times(5); | ||
} | ||
TEST_F(StatsThreadLocalStoreTest, BasicSingleHistogramMerge) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have any test where we actually look at the merged results to see if the percentiles are as expected? I scanned through and didn't see one but I might have missed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added it in one of the tests now. |
||
InSequence s; | ||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
setUp(); | ||
|
||
Histogram& h1 = store_->histogram("h1"); | ||
EXPECT_EQ("h1", h1.name()); | ||
|
@@ -282,21 +294,11 @@ TEST_F(StatsThreadLocalStoreTest, BasicSingleHistogramMerge) { | |
|
||
EXPECT_EQ(1, validateMerge()); | ||
|
||
// Validate the summary format is as expected. | ||
std::string expected_summary = "P0: 0, P25: 14, P50: 44, P75: 420, P90: 3220, P95: 3260, P99: " | ||
"3292, P99.9: 3299.2, P100: 3300"; | ||
EXPECT_EQ(expected_summary, store_->histograms().front()->cumulativeStatistics().summary()); | ||
|
||
store_->shutdownThreading(); | ||
tls_.shutdownThread(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
tearDown(); | ||
} | ||
|
||
TEST_F(StatsThreadLocalStoreTest, BasicMultiHistogramMerge) { | ||
InSequence s; | ||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
setUp(); | ||
|
||
Histogram& h1 = store_->histogram("h1"); | ||
Histogram& h2 = store_->histogram("h2"); | ||
|
@@ -309,16 +311,11 @@ TEST_F(StatsThreadLocalStoreTest, BasicMultiHistogramMerge) { | |
|
||
EXPECT_EQ(2, validateMerge()); | ||
|
||
store_->shutdownThreading(); | ||
tls_.shutdownThread(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
tearDown(); | ||
} | ||
|
||
TEST_F(StatsThreadLocalStoreTest, MultiHistogramMultipleMerges) { | ||
InSequence s; | ||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
setUp(); | ||
|
||
Histogram& h1 = store_->histogram("h1"); | ||
Histogram& h2 = store_->histogram("h2"); | ||
|
@@ -347,16 +344,11 @@ TEST_F(StatsThreadLocalStoreTest, MultiHistogramMultipleMerges) { | |
// cumulativeSummary has right values. | ||
EXPECT_EQ(2, validateMerge()); | ||
|
||
store_->shutdownThreading(); | ||
tls_.shutdownThread(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
tearDown(); | ||
} | ||
|
||
TEST_F(StatsThreadLocalStoreTest, BasicScopeHistogramMerge) { | ||
InSequence s; | ||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
setUp(); | ||
|
||
ScopePtr scope1 = store_->createScope("scope1."); | ||
|
||
|
@@ -369,17 +361,26 @@ TEST_F(StatsThreadLocalStoreTest, BasicScopeHistogramMerge) { | |
expectCallAndAccumulate(h2, 2); | ||
EXPECT_EQ(2, validateMerge()); | ||
|
||
store_->shutdownThreading(); | ||
tearDown(); | ||
} | ||
|
||
tls_.shutdownThread(); | ||
TEST_F(StatsThreadLocalStoreTest, BasicHistogramValidate) { | ||
setUp(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
Histogram& h1 = store_->histogram("h1"); | ||
expectCallAndAccumulate(h1, 1); | ||
|
||
EXPECT_EQ(1, validateMerge()); | ||
|
||
std::string expected_summary = "P0: 1, P25: 1.025, P50: 1.05, P75: 1.075, P90: 1.09, P95: 1.095, " | ||
"P99: 1.099, P99.9: 1.0999, P100: 1.1"; | ||
EXPECT_EQ(expected_summary, store_->histograms().front()->cumulativeStatistics().summary()); | ||
|
||
tearDown(); | ||
} | ||
|
||
TEST_F(StatsThreadLocalStoreTest, BasicHistogramUsed) { | ||
InSequence s; | ||
store_->initializeThreading(main_thread_dispatcher_, tls_); | ||
setUp(); | ||
|
||
ScopePtr scope1 = store_->createScope("scope1."); | ||
|
||
|
@@ -408,12 +409,7 @@ TEST_F(StatsThreadLocalStoreTest, BasicHistogramUsed) { | |
EXPECT_TRUE(histogram->used()); | ||
} | ||
|
||
store_->shutdownThreading(); | ||
|
||
tls_.shutdownThread(); | ||
|
||
// Includes overflow stat. | ||
EXPECT_CALL(*this, free(_)); | ||
tearDown(); | ||
} | ||
|
||
TEST_F(StatsThreadLocalStoreTest, ScopeDelete) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void SetUp() override { ....
then you can remove the explicit calls from the test methods. It has to be applicable to all the test-methods in the class, so you might want to make a subclass just for the histograms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a added a new sub class and made this override and removed explicit calls. similar change for TearDown.