Skip to content

Instantly share code, notes, and snippets.

@antekone
Created April 6, 2017 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antekone/530a6e5e9469796310eaf6a85bd33966 to your computer and use it in GitHub Desktop.
Save antekone/530a6e5e9469796310eaf6a85bd33966 to your computer and use it in GitHub Desktop.
highest = 0
highest_score = 0
Dir["/proc/*"].each() do |pidstr|
next if not pidstr =~ /^\/proc\/([0-9]+)$/
pid = $1.to_i
score = IO.readlines("/proc/#{pid}/oom_score").join().to_i
if score > highest_score
highest_score = score
highest = pid
end
end
puts("oom killer target: pid #{highest}, score: #{highest_score}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment