Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In Activity Monitor on OS X, it is possible to add additional columns to the process list view. Two columns available in that list are "Messages Sent" and "Messages Received", which show up as "Sent Msgs" and "Rcvd Msgs", respectively. Witness:

Portion of Activity Monitor window showing "Sent Msgs" and "Rcvd Msgs" columns

What kind of "messages" is Activity Monitor referring to?

When I saw "message", I thought at first of Objective-C "messages" that are dispatched with objc_msgSend(), but I can't see how those would be tracked by the operating system since most of those messages would be internal to the process itself. A debugger might track those kinds of messages when attached, but I can't see the OS doing it all the time — very high overhead.

So I am guessing those are heavier-weight messages. Are they a form of RPC between processes? Or, are those messages calls from user-land into the kernel? Seeking definitive references. Thank you.

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Those numbers match the Mach messages in/out counts, so you seem to be correct in not interpreting them as the objc_msgSend counts.

You can learn more about higher level message counts by firing up Instruments (part of the freely downloadable Xcode toolset) and digging into a specific application to see what messages are being sent and when.

Xcode Instruments screen shot

It can filter all allocations as well as allocations relating to ObjC and you can dig into much lower level details than just message send counts. The canonical documentation that is part of Xcode will help you make sense of these statistics and how they relate to Activity Monitor.

Specifically, search for NSObjCMessageLoggingEnabled and objc_msgSend in the Mac OS X Debugging Magic - Tools Guide portion of the Reference Documentation to get at the objC counts.

Search for mach message in Xcode and look for the IPC/Message Queues section of the Kernel Programming Guide for mach message queue details and what makes them up. They are much lower level IPC kernel traffic as you have surmised.

You probably can find it on developer.apple.com as well, but having the documentation local from within Xcode has many advantages.

share|improve this answer
1  
Thanks - but it isn't yet crystal clear. I suspected three things. Did you mean to confirm the first thing I suspected, i.e. objc_msgSend() calls are tracked for all processes, or the heavier-weight messages guesses? –  Chris W. Rea May 3 '13 at 20:47
1  
I thought those were objc_msgSend counts, but now I see I am wrong. They map perfectly to the mach message counts available when you select a process from within Activity Monitor. I'll revise my answer to be more correct and less wrong. –  bmike May 3 '13 at 20:56
    
Thanks! The pointer to the Kernel Programming Guide is particularly helpful. Wasn't aware of it. –  Chris W. Rea May 3 '13 at 21:36
    
Yes - there is so much amazing documentation, and even though I know how and why it got put on developer.apple.com, I am so more effective in using it and finding it when I use Xcode to browse the documents. –  bmike May 3 '13 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.