[chef-dev] Re: ohai: ever needed to get memory info on mac os x?


Chronological Thread 
  • From: Pat Collins < >
  • To: Chef Dev < >
  • Cc: Graham McMillan < >, Lamont Granquist < >
  • Subject: [chef-dev] Re: ohai: ever needed to get memory info on mac os x?
  • Date: Mon, 25 Mar 2013 12:56:38 -0400

OK, pushed a new version that depends on sysctl and vm_stat, and included a unit test:

https://github.com/opscode/ohai/pull/119/files

It implements: "total", "active", "inactive", "free". I wanted to keep the semantics the same as other platforms, so "active" includes both "wired" and "active" numbers that you see in Activity Monitor. This has the distinct advantage that:: active + inactive + free = total

(The term "wired" seems to apply only to Darwin memory management, and means memory that will almost always stay in memory and will not be transferred to disk. This definitely counts as active memory in my book, hence my choice to include it in "active".)

The ticket is here:

http://tickets.opscode.com/browse/OHAI-431

Thanks Graham, for your help in tracking down a faster way to implement. Also thanks Lamont for the vm_stat tip.

As always any comments, q's let me know.

Cheers,
Pat

On Sat, Mar 23, 2013 at 9:17 AM, Pat Collins < " target="_blank"> > wrote:
Yeah I feel like I tried that route but ended up getting unreliable numbers (figures that didn't match what was coming from Activity Monitor.)

You're right that top is slow. I'll try it with your suggestion and see if I'm remembering correctly. 

Pat

--
Patrick Collins

On Mar 22, 2013, at 4:20 PM, Graham McMillan < " target="_blank"> > wrote:

Although that works, I'd try to implement it using vm_stat instead. Top produces a lot of unnecessary output and it's a bit slow.

Looks like someone was able to grab some of the info you need from vm_stat:

http://vigodome.com/blog/2012/01/27/show-free-memory-on-osx/


On Fri, Mar 22, 2013 at 4:05 PM, Pat Collins < " target="_blank"> > wrote:
Now you can!

I submitted this ticket a while back, with a fix provided, and I'm eager to get it merged into Ohai:


Can anyone see anything glaring that would prevent it from getting merged in?

Cheers,
Pat

--
Patrick Collins




--
Patrick Collins



Archive powered by MHonArc 2.6.16.

§