Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 09:10:37 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 09:10:37 +0300
commite173c316de15057b099a93053c9ef16180d6d1de (patch)
treeb0b7b4223b5450f4c77c6d6ce087f151e2415bb4 /lib/gitlab/memory
parent6eba378ec4193d168af62094caf8a69dd62ad5fd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/memory')
-rw-r--r--lib/gitlab/memory/instrumentation.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gitlab/memory/instrumentation.rb b/lib/gitlab/memory/instrumentation.rb
index 8f9f6d19ce8..e800fe14cf1 100644
--- a/lib/gitlab/memory/instrumentation.rb
+++ b/lib/gitlab/memory/instrumentation.rb
@@ -45,9 +45,12 @@ module Gitlab
end
# This method returns a hash with the following keys:
- # - mem_objects: a number of allocated heap slots (as reflected by GC)
- # - mem_mallocs: a number of malloc calls
- # - mem_bytes: a number of bytes allocated with a mallocs tied to heap slots
+ # - mem_objects: number of allocated heap slots (as reflected by GC)
+ # - mem_mallocs: number of malloc calls
+ # - mem_bytes: number of bytes allocated by malloc for objects that did not fit
+ # into a heap slot
+ # - mem_total_bytes: number of bytes allocated for both objects consuming an object slot
+ # and objects that required a malloc (mem_malloc_bytes)
def self.measure_thread_memory_allocations(previous)
return unless available?
return unless previous
@@ -56,9 +59,13 @@ module Gitlab
return unless current
# calculate difference in a memory allocations
- previous.to_h do |key, value|
+ result = previous.to_h do |key, value|
[KEY_MAPPING.fetch(key), current[key].to_i - value]
end
+
+ result[:mem_total_bytes] = result[:mem_bytes] + result[:mem_objects] * GC::INTERNAL_CONSTANTS[:RVALUE_SIZE]
+
+ result
end
def self.with_memory_allocations