aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/lib
diff options
context:
space:
mode:
authorGravatar Peter Hawkins <phawkins@google.com>2018-05-02 16:22:41 -0700
committerGravatar Yifei Feng <yifeif@google.com>2018-05-02 16:22:41 -0700
commit5e9e6967b47989aa9084fb328f5ef0c40fc146ef (patch)
treefab4ecb4e3fd627d724c717cde43cff7296878bc /tensorflow/core/lib
parent4704ae7af1918755d72f159f49d98d35da6eb6fa (diff)
Replaced calls to tensorflow::StringPiece::ToString with std::string conversions.
That is, instances of sp.ToString() are replaced with std::string(sp). This will allow tensorflow::StringPiece::ToString to be removed, which is necessary before it can be replaced with absl::string_view. PiperOrigin-RevId: 195162126
Diffstat (limited to 'tensorflow/core/lib')
-rw-r--r--tensorflow/core/lib/monitoring/collection_registry.cc8
-rw-r--r--tensorflow/core/lib/monitoring/collection_registry.h4
-rw-r--r--tensorflow/core/lib/monitoring/metric_def.h4
3 files changed, 8 insertions, 8 deletions
diff --git a/tensorflow/core/lib/monitoring/collection_registry.cc b/tensorflow/core/lib/monitoring/collection_registry.cc
index d3fd7132de..8c28620ff9 100644
--- a/tensorflow/core/lib/monitoring/collection_registry.cc
+++ b/tensorflow/core/lib/monitoring/collection_registry.cc
@@ -38,15 +38,15 @@ void Collector::CollectMetricDescriptor(
mutex_lock l(mu_);
return collected_metrics_->metric_descriptor_map
.insert(std::make_pair(
- metric_def->name().ToString(),
+ std::string(metric_def->name()),
std::unique_ptr<MetricDescriptor>(new MetricDescriptor())))
.first->second.get();
}();
- metric_descriptor->name = metric_def->name().ToString();
- metric_descriptor->description = metric_def->description().ToString();
+ metric_descriptor->name = std::string(metric_def->name());
+ metric_descriptor->description = std::string(metric_def->description());
for (const StringPiece label_name : metric_def->label_descriptions()) {
- metric_descriptor->label_names.push_back(label_name.ToString());
+ metric_descriptor->label_names.push_back(std::string(label_name));
}
metric_descriptor->metric_kind = metric_def->kind();
diff --git a/tensorflow/core/lib/monitoring/collection_registry.h b/tensorflow/core/lib/monitoring/collection_registry.h
index 63cc0f550d..20f0444f8b 100644
--- a/tensorflow/core/lib/monitoring/collection_registry.h
+++ b/tensorflow/core/lib/monitoring/collection_registry.h
@@ -72,7 +72,7 @@ class MetricCollector {
registration_time_millis_(registration_time_millis),
collector_(collector),
point_set_(point_set) {
- point_set_->metric_name = metric_def->name().ToString();
+ point_set_->metric_name = std::string(metric_def->name());
}
const MetricDef<metric_kind, Value, NumLabels>* const metric_def_;
@@ -261,7 +261,7 @@ class Collector {
auto* const point_set = [&]() {
mutex_lock l(mu_);
return collected_metrics_->point_set_map
- .insert(std::make_pair(metric_def->name().ToString(),
+ .insert(std::make_pair(std::string(metric_def->name()),
std::unique_ptr<PointSet>(new PointSet())))
.first->second.get();
}();
diff --git a/tensorflow/core/lib/monitoring/metric_def.h b/tensorflow/core/lib/monitoring/metric_def.h
index 5ecadcc427..6f94685665 100644
--- a/tensorflow/core/lib/monitoring/metric_def.h
+++ b/tensorflow/core/lib/monitoring/metric_def.h
@@ -98,8 +98,8 @@ class AbstractMetricDef {
const std::vector<string>& label_descriptions)
: kind_(kind),
value_type_(value_type),
- name_(name.ToString()),
- description_(description.ToString()),
+ name_(std::string(name)),
+ description_(std::string(description)),
label_descriptions_(std::vector<string>(label_descriptions.begin(),
label_descriptions.end())) {}