mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 18:41:07 +08:00
DEV: Seperate concerns of tracking GC stat from MethodProfiler
(#22921)
Why this change? This is a follow up to e8f7b62752a65e33aa1cee748fc966c4ad14b1ee. Tracking of GC stats didn't really belong in the `MethodProfiler` class so we want to extract that concern into its own class. As part of this PR, the `track_gc_stat_per_request` site setting has also been renamed to `instrument_gc_stat_per_request`.
This commit is contained in:

committed by
GitHub

parent
e8f7b62752
commit
773b22e8d0
@ -37,24 +37,4 @@ RSpec.describe MethodProfiler do
|
||||
|
||||
expect(result[:at_beach][:calls]).to eq(2)
|
||||
end
|
||||
|
||||
it "profiles GC stat information when `track_gc_stat_per_request` site setting has been enabled" do
|
||||
MethodProfiler.start
|
||||
GC.start(full_mark: false) # Minor GC
|
||||
result = MethodProfiler.stop
|
||||
|
||||
expect(result[:gc]).not_to be_present
|
||||
|
||||
SiteSetting.track_gc_stat_per_request = true
|
||||
|
||||
MethodProfiler.start
|
||||
GC.start(full_mark: true) # Major GC
|
||||
GC.start(full_mark: false) # Minor GC
|
||||
result = MethodProfiler.stop
|
||||
|
||||
expect(result[:gc]).to be_present
|
||||
expect(result[:gc][:time]).to be >= 0.0
|
||||
expect(result[:gc][:major_count]).to eq(1)
|
||||
expect(result[:gc][:minor_count]).to eq(1)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user