Hello: Is there a way to get the resident memory size of the rails process in- code using ruby? I''d like to have my application log the size of its own memory. Thank you in advance, Dan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
BTW, this is one way of doing it under Linux: Opening "/proc/$pid/status" and looking for VmSize. Not sure if there is a more efficient. Dan On 11/19/07, Dan <dforootan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello: > > Is there a way to get the resident memory size of the rails process in- > code using ruby? I''d like to have my application log the size of its > own memory. > > Thank you in advance, > > Dan >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan wrote:> Hello: > > Is there a way to get the resident memory size of the rails process in- > code using ruby? I''d like to have my application log the size of its > own memory. > > Thank you in advance, > > Dan(Given your followup post mentions your running linux ...) # in your controller or in application.rb ... after_filter :after_req_resource_usage ... def after_req_resource_usage ps_info = `ps -o psr,etime,pcpu,pmem,rss,vsz -p #{Process.pid} | grep -v CPU` ignore, psr, elapsed, pcpu, pmem, rss, vsz = ps_info.split(/\s+/) logger.info("pid=#{Process.pid} pcpu=#{pcpu} pmem=#{pmem} rss=#{rss} vsz=#{vsz}") end ... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- mongrel_cluster 0.2.2 - plugin cluster::status does not exist?
- Rsync 2.6.1 released (includes security note)
- Rsync 2.6.1 released (includes security note)
- kjournald hang on ext3 to ext3 copy
- Mongrel 0.3.13.4 Pre-Release -- Ruby''s LEAK Fixed (Death To Mutex!)