Skip to content

Commit

Permalink
move to PSS with a RSS fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
noma4i committed Oct 14, 2024
1 parent 924ef82 commit d9f2f27
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/models/good_job/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ class Process < BaseRecord
PROCESS_MEMORY = case RUBY_PLATFORM
when /linux/
->(pid) {
File.readlines("/proc/#{pid}/status").each do |line|
next unless line.start_with?('VmRSS:')

break line.split[1].to_i
end
begin
File.readlines("/proc/#{pid}/smaps_rollup").each do |line|
next unless line.start_with?('Pss:')

break line.split[1].to_i
end
rescue Errno::ENOENT
File.readlines("/proc/#{pid}/status").each do |line|
next unless line.start_with?('VmRSS:')

break line.split[1].to_i
end
end
}
when /darwin|bsd/
->(pid) {
Expand Down

0 comments on commit d9f2f27

Please sign in to comment.