sudheerv commented on a change in pull request #7918:
URL: https://github.com/apache/trafficserver/pull/7918#discussion_r645843707



##########
File path: proxy/http/remap/RemapHitCount.cc
##########
@@ -0,0 +1,90 @@
+/** @file
+
+  A brief file description
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#include "RemapHitCount.h"
+
+extern int num_of_net_threads;
+
+RemapHitCount RemapHitCount::_remapHitCountInstance;
+std::vector<std::unordered_map<std::string, int>> 
RemapHitCount::_perThreadHits(num_of_net_threads);
+
+std::string
+RemapHitCount::printRemapHits()
+{
+  std::unordered_map<std::string, int> aggregateHits;
+  ink_mutex_acquire(&_mutex);

Review comment:
       Ah, I forgot to remove this part - I had originally set out using the 
mutex to protect the read vs write (printRemapHits vs incrementCount). But, 
then decided against that to minimize overhead and went with per_thread data 
(with memory overhead) for performance reason. I removed the mutex from the 
incrementCount() but forgot to remove it altogether.
   
   Also, I switched to using atomic now to protect against read vs write 
without the mutex (even though it's relatively rare, probably good to protect 
it). Thoughts?




-- 
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.

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


Reply via email to