Permalink
Browse files

Memory statistics tool: warn if it's not running as root.

  • Loading branch information...
1 parent c4ae459 commit ba4f5d12a5aca953a31e2cefd067bf4dfee5b708 @FooBarWidget FooBarWidget committed Apr 16, 2008
Showing with 13 additions and 0 deletions.
  1. +13 −0 misc/memory_stats.rb
View
@@ -30,12 +30,25 @@ def print
end
def start
+ some_private_dirty_rss_cannot_be_determined = false
processes = list_processes(:exe => PlatformInfo::HTTPD)
+ some_private_dirty_rss_cannot_be_determined = processes.any? do |p|
+ p.private_dirty_rss.nil?
+ end
print_process_list_stats(processes)
puts
processes = list_processes(:match => /^(Passenger|Rails) /)
+ some_private_dirty_rss_cannot_be_determined ||= processes.any? do |p|
+ p.private_dirty_rss.nil?
+ end
print_process_list_stats(processes)
+
+ if ::Process.uid != 0 && some_private_dirty_rss_cannot_be_determined
+ puts
+ puts "*** WARNING: Please run this tool as root, otherwise it " <<
+ "can't determine the private dirty RSS of processes."
+ end
end
# Returns a list of Process objects that match the given search criteria.

0 comments on commit ba4f5d1

Please sign in to comment.