From 5312c1442e304727396fb7e4f933940ceb247ed3 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Fri, 5 Oct 2018 10:53:14 +0000 Subject: remove usage of NameHash --- metrics/src/vespa/metrics/metric.cpp | 8 +------- metrics/src/vespa/metrics/metric.h | 13 ------------- metrics/src/vespa/metrics/metricmanager.cpp | 9 --------- metrics/src/vespa/metrics/metricmanager.h | 6 +----- metrics/src/vespa/metrics/metricset.cpp | 9 --------- metrics/src/vespa/metrics/metricset.h | 2 -- metrics/src/vespa/metrics/metricsnapshot.cpp | 7 ------- metrics/src/vespa/metrics/metricsnapshot.h | 2 -- 8 files changed, 2 insertions(+), 54 deletions(-) (limited to 'metrics') diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp index 784492de7d2..63d0f1d9f20 100644 --- a/metrics/src/vespa/metrics/metric.cpp +++ b/metrics/src/vespa/metrics/metric.cpp @@ -4,7 +4,7 @@ #include "countmetric.h" #include "valuemetric.h" #include "metricset.h" -#include "namehash.h" +#include "memoryconsumption.h" #include #include #include @@ -230,12 +230,6 @@ Metric::addMemoryUsage(MemoryConsumption& mc) const mc._metricMeta += sizeof(Metric); } -void -Metric::updateNames(NameHash&) const -{ - // not relevant anymore -} - void Metric::printDebug(std::ostream& out, const std::string& indent) const { diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index 3ea6e7a4854..85b47fb4d97 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -15,7 +15,6 @@ class MetricSet; class MetricSnapshot; class XmlWriterMetricVisitor; class MemoryConsumption; -class NameHash; /** Implement class to visit metrics. */ struct MetricVisitor { @@ -250,18 +249,6 @@ public: virtual void addMemoryUsage(MemoryConsumption&) const; - /** - * Update names using the given name hash, to utilize ref counting. - * - * NOTE: - * This is a hack that only works on GCC until they decide to finally break - * ABI compatibility and remove that particular multicore-hostile feature - * of their std::string implementation. If we want proper string ref - * counting, all strings should be replaced with explicit string handles - * and should only be created via a shared factory. - */ - virtual void updateNames(NameHash&) const; - /** Print debug information of the metric tree. */ virtual void printDebug(std::ostream&, const std::string& indent="") const; diff --git a/metrics/src/vespa/metrics/metricmanager.cpp b/metrics/src/vespa/metrics/metricmanager.cpp index b8255a6532f..544998e25cd 100644 --- a/metrics/src/vespa/metrics/metricmanager.cpp +++ b/metrics/src/vespa/metrics/metricmanager.cpp @@ -366,23 +366,15 @@ MetricManager::handleMetricsAltered(const MetricLockGuard & guard) configMap[consumer.name] = ConsumerSpec::SP(new ConsumerSpec(std::move(consumerMetricBuilder._matchedMetrics))); } LOG(debug, "Recreating snapshots to include altered metrics"); - _activeMetrics.updateNames(_nameHash); _totalMetrics->recreateSnapshot(_activeMetrics.getMetrics(), _snapshotUnsetMetrics); - _totalMetrics->updateNames(_nameHash); for (uint32_t i=0; i<_snapshots.size(); ++i) { _snapshots[i]->recreateSnapshot(_activeMetrics.getMetrics(), _snapshotUnsetMetrics); - _snapshots[i]->updateNames(_nameHash); } LOG(debug, "Setting new consumer config. Clearing dirty flag"); _consumerConfig.swap(configMap); _consumerConfigChanged = false; - LOG(debug, "Unified %u of %u strings configuring %" PRIu64 " consumers.", - _nameHash.getUnifiedStringCount(), - _nameHash.getCheckedStringCount(), - _config->consumer.size()); - _nameHash.resetCounts(); } namespace { @@ -966,7 +958,6 @@ MetricManager::getMemoryConsumption(const MetricLockGuard & guard) const _totalMetrics->addMemoryUsage(*mc); postTotal = mc->getTotalMemoryUsage(); mc->addSnapShotUsage("total", postTotal - preTotal); - _nameHash.addMemoryUsage(*mc); return mc; } diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h index 423eb41a787..ec166529b94 100644 --- a/metrics/src/vespa/metrics/metricmanager.h +++ b/metrics/src/vespa/metrics/metricmanager.h @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include @@ -125,10 +125,6 @@ private: LongAverageMetric _snapshotLatency; LongAverageMetric _sleepTimes; - // Name hash trying to ensure string ref counting works as well as can be - // expected - NameHash _nameHash; - public: MetricManager(std::unique_ptr timer = std::unique_ptr(new Timer)); ~MetricManager(); diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index 216073b497d..6ffae806322 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -349,15 +349,6 @@ MetricSet::addMemoryUsage(MemoryConsumption& mc) const } } -void -MetricSet::updateNames(NameHash& hash) const -{ - Metric::updateNames(hash); - for (const Metric* metric : _metricOrder) { - metric->updateNames(hash); - } -} - void MetricSet::printDebug(std::ostream& out, const std::string& indent) const { diff --git a/metrics/src/vespa/metrics/metricset.h b/metrics/src/vespa/metrics/metricset.h index 48027db374a..a8fea2fc290 100644 --- a/metrics/src/vespa/metrics/metricset.h +++ b/metrics/src/vespa/metrics/metricset.h @@ -75,8 +75,6 @@ public: bool used() const override; void addMemoryUsage(MemoryConsumption&) const override; - /** Update names using the given name hash, to utilize ref counting. */ - void updateNames(NameHash&) const override; void printDebug(std::ostream&, const std::string& indent="") const override; bool isMetricSet() const override { return true; } void addToPart(Metric& m) const override { addTo(m, 0); } diff --git a/metrics/src/vespa/metrics/metricsnapshot.cpp b/metrics/src/vespa/metrics/metricsnapshot.cpp index 0b6ad8f9acd..ac3c41215aa 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.cpp +++ b/metrics/src/vespa/metrics/metricsnapshot.cpp @@ -147,13 +147,6 @@ MetricSnapshotSet::addMemoryUsage(MemoryConsumption& mc) const _current->addMemoryUsage(mc); } -void -MetricSnapshotSet::updateNames(NameHash& hash) const -{ - if (_count != 1) _building->updateNames(hash); - _current->updateNames(hash); -} - void MetricSnapshotSet::setFromTime(time_t fromTime) { diff --git a/metrics/src/vespa/metrics/metricsnapshot.h b/metrics/src/vespa/metrics/metricsnapshot.h index 4cf8d113743..b00c001505c 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.h +++ b/metrics/src/vespa/metrics/metricsnapshot.h @@ -69,7 +69,6 @@ public: void recreateSnapshot(const MetricSet& metrics, bool copyUnset); void addMemoryUsage(MemoryConsumption&) const; - void updateNames(NameHash& hash) const { _snapshot->updateNames(hash); } }; class MetricSnapshotSet { @@ -107,7 +106,6 @@ public: */ void recreateSnapshot(const MetricSet& metrics, bool copyUnset); void addMemoryUsage(MemoryConsumption&) const; - void updateNames(NameHash& hash) const; void setFromTime(time_t fromTime); }; -- cgit v1.2.3