Remove references to and implementation of GetHistogramName().

The method prototype is being changed to returning a const char*,
we don't rely on it in webrtc and the point of the DCHECK that
previously referenced it, was to avoid usage of std::string for
histogram names.

Bug: webrtc:8472
Change-Id: I69b588d4a8f339911a051fd232d63ea5bb1f9a45
Reviewed-on: https://webrtc-review.googlesource.com/16940
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20484}
This commit is contained in:
Tommi
2017-10-30 17:16:22 +01:00
committed by Commit Bot
parent 1cf1b7d66f
commit 5e7d177ef2
3 changed files with 0 additions and 23 deletions

View File

@ -164,9 +164,6 @@
prev_pointer == histogram_pointer); \
} \
if (histogram_pointer) { \
RTC_DCHECK_EQ(constant_name, \
webrtc::metrics::GetHistogramName(histogram_pointer)) \
<< "The name should not vary."; \
webrtc::metrics::HistogramAdd(histogram_pointer, sample); \
} \
} while (0)
@ -262,9 +259,6 @@ Histogram* HistogramFactoryGetCountsLinear(const std::string& name,
Histogram* HistogramFactoryGetEnumeration(
const std::string& name, int boundary);
// Returns name of the histogram.
const std::string& GetHistogramName(Histogram* histogram_pointer);
// Function for adding a |sample| to a histogram.
void HistogramAdd(Histogram* histogram_pointer, int sample);

View File

@ -247,11 +247,6 @@ Histogram* HistogramFactoryGetEnumeration(const std::string& name,
return map->GetEnumerationHistogram(name, boundary);
}
const std::string& GetHistogramName(Histogram* histogram_pointer) {
RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);
return ptr->name();
}
// Fast path. Adds |sample| to cached |histogram_pointer|.
void HistogramAdd(Histogram* histogram_pointer, int sample) {
RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);

View File

@ -22,11 +22,6 @@ void AddSparseSample(const std::string& name, int sample) {
void AddSampleWithVaryingName(int index, const std::string& name, int sample) {
RTC_HISTOGRAMS_COUNTS_100(index, name, sample);
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
void AddSample(const std::string& name, int sample) {
RTC_HISTOGRAM_COUNTS_100(name, sample);
}
#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
} // namespace
class MetricsTest : public ::testing::Test {
@ -117,11 +112,4 @@ TEST_F(MetricsTest, RtcHistogramSparse_NonConstantNameWorks) {
EXPECT_EQ(1, metrics::NumSamples("Sparse2"));
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
TEST_F(MetricsTest, RtcHistogram_FailsForNonConstantName) {
AddSample("ConstantName1", kSample);
EXPECT_DEATH(AddSample("NotConstantName1", kSample), "");
}
#endif
} // namespace webrtc