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>2020-04-01 21:07:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-01 21:07:56 +0300
commit33aa02e7a38d8dfc5e470dd5d776c8d4ce5b2dd5 (patch)
tree8cd2bc4711d3a017d839760c7fbea267e2ba4951 /lib/gitlab/utils
parent1219a9dce91f4edbc135dfc08299b4122b4825a8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/utils')
-rw-r--r--lib/gitlab/utils/measuring.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/gitlab/utils/measuring.rb b/lib/gitlab/utils/measuring.rb
index c9e6cb9c039..0680cefd249 100644
--- a/lib/gitlab/utils/measuring.rb
+++ b/lib/gitlab/utils/measuring.rb
@@ -11,7 +11,7 @@ module Gitlab
def with_measuring
logger.info "Measuring enabled..."
- with_gc_counter do
+ with_gc_stats do
with_count_queries do
with_measure_time do
yield
@@ -39,15 +39,17 @@ module Gitlab
logger.info "Number of sql calls: #{count}"
end
- def with_gc_counter
- gc_counts_before = GC.stat.select { |k, _v| k =~ /count/ }
+ def with_gc_stats
+ GC.start # perform a full mark-and-sweep
+ stats_before = GC.stat
yield
- gc_counts_after = GC.stat.select { |k, _v| k =~ /count/ }
- stats = gc_counts_before.merge(gc_counts_after) { |_k, vb, va| va - vb }
-
- logger.info "Total GC count: #{stats[:count]}"
- logger.info "Minor GC count: #{stats[:minor_gc_count]}"
- logger.info "Major GC count: #{stats[:major_gc_count]}"
+ stats_after = GC.stat
+ stats_diff = stats_after.map do |key, after_value|
+ before_value = stats_before[key]
+ [key, before: before_value, after: after_value, diff: after_value - before_value]
+ end.to_h
+ logger.info "GC stats:"
+ logger.info JSON.pretty_generate(stats_diff)
end
def with_measure_time