MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Sampler

Method Sampler

tensorflow/core/lib/monitoring/sampler.h:147–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145 friend class SamplerCell;
146
147 Sampler(const MetricDef<MetricKind::kCumulative, HistogramProto, NumLabels>&
148 metric_def,
149 std::unique_ptr<Buckets> buckets)
150 : metric_def_(metric_def),
151 buckets_(std::move(buckets)),
152 registration_handle_(CollectionRegistry::Default()->Register(
153 &metric_def_, [&](MetricCollectorGetter getter) {
154 auto metric_collector = getter.Get(&metric_def_);
155
156 mutex_lock l(mu_);
157 for (const auto& cell : cells_) {
158 metric_collector.CollectValue(cell.first, cell.second.value());
159 }
160 })) {
161 if (registration_handle_) {
162 status_ = Status::OK();
163 } else {
164 status_ = Status(tensorflow::error::Code::ALREADY_EXISTS,
165 "Another metric with the same name already exists.");
166 }
167 }
168
169 mutable mutex mu_;
170

Callers 1

test_samplerMethod · 0.45

Calls 6

DefaultFunction · 0.85
CollectValueMethod · 0.80
StatusClass · 0.50
RegisterMethod · 0.45
GetMethod · 0.45
valueMethod · 0.45

Tested by 1

test_samplerMethod · 0.36