serrislew commented on code in PR #13506:
URL: https://github.com/apache/trafficserver/pull/13506#discussion_r3799622712


##########
src/tsutil/Metrics.cc:
##########
@@ -257,6 +295,26 @@ namespace details
       metrics.push_back(std::move(m));
     }
 
+    void
+    add_source(Metrics::IdType id, Metrics::AtomicType *source, 
Metrics::Derived::Op op)
+    {
+      if (!source) {
+        return;
+      }
+
+      std::lock_guard l(metrics_lock);
+      auto            it = std::find_if(metrics.begin(), metrics.end(), 
[id](DerivedMetric const &m) { return m.metric == id; });

Review Comment:
    since `add_source` is O(# of derived metrics) and is called from the Group 
ctor under the outbound table lock, maybe an id-indexed map would help here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to