You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/09/05 00:48:42 UTC

trafficserver git commit: TS-3877: Add a tracking ClassAllocator to keep track of where the allocation happened Display entries where the Allocs are equal to the Frees

Repository: trafficserver
Updated Branches:
  refs/heads/master 9279ddb1f -> c096fa5b1


TS-3877: Add a tracking ClassAllocator to keep track of where the allocation happened
Display entries where the Allocs are equal to the Frees


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c096fa5b
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c096fa5b
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c096fa5b

Branch: refs/heads/master
Commit: c096fa5b112023337ca99bd1e91047f559feea43
Parents: 9279ddb
Author: Bryan Call <bc...@apache.org>
Authored: Fri Sep 4 15:46:16 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Fri Sep 4 15:46:16 2015 -0700

----------------------------------------------------------------------
 lib/ts/ink_resource.cc | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c096fa5b/lib/ts/ink_resource.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_resource.cc b/lib/ts/ink_resource.cc
index e2242fa..b1c4d6a 100644
--- a/lib/ts/ink_resource.cc
+++ b/lib/ts/ink_resource.cc
@@ -157,14 +157,16 @@ ResourceTracker::dump(FILE *fd)
                 "--------------------------------------------------------------------\n");
     for (std::map<const char *, Resource *>::const_iterator it = _resourceMap.begin(); it != _resourceMap.end(); ++it) {
       const Resource &resource = *it->second;
-      if (resource.getIncrement() - resource.getDecrement()) {
-        fprintf(fd, "%10" PRId64 " | %10" PRId64 " | %20" PRId64 " | %10" PRId64 " | %-50s\n", resource.getIncrement(),
-                resource.getDecrement(), resource.getValue(),
-                resource.getValue() / (resource.getIncrement() - resource.getDecrement()), resource.getName());
-        total += resource.getValue();
+      int64_t average_size = 0;
+      if (resource.getIncrement() - resource.getDecrement() > 0) {
+        average_size = resource.getValue() / (resource.getIncrement() - resource.getDecrement());
       }
+      fprintf(fd, "%10" PRId64 " | %10" PRId64 " | %20" PRId64 " | %10" PRId64 " | %-50s\n", resource.getIncrement(),
+              resource.getDecrement(), resource.getValue(), average_size, resource.getName());
+      total += resource.getValue();
     }
-    fprintf(fd, "                          %20" PRId64 " |            | %-50s\n", total, "TOTAL");
   }
+  fprintf(fd, "                          %20" PRId64 " |            | %-50s\n", total, "TOTAL");
+
   ink_mutex_release(&resourceLock);
 }