On Aug 26, 2010, at 8:39 AM, Uli Kusterer wrote:

> On Aug 26, 2010, at 12:48 PM, Vijayakumar_Thota wrote:
>> I am working on the performance issues of an application. I am facing a 
>> difficulty in finding out how many times a method is called in different 
>> contexts.
>> 
>> Suppose there is a method called 'setItem'. I need the report which tells 
>> something like the method 'setItem' is called 12 times at runtime in 
>> specific event action.
>> 
>> Is there any tool in MAC which gives the report on how many times a method 
>> is called. I have seen the different templates in instruments tool, but I am 
>> not getting, which will give the right solution.
>> 
>> Please share any information if you have something or correct me if anything 
>> I am doing wrong.
> 
> 
> Have a look at Instruments, and Shark. they came with Xcode in your Dev Tools 
> installation. 

Shark and most of the instruments in Instruments are statistical samplers, not 
exact function-call measurement.  Also, Vijay already mentioned familiarity 
with Instruments.

Vijay, you might want to look into Saturn and the function instrumentation 
features of gcc.  They are documented here: 
<http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/SaturnUserGuide/>.

Another tool is DTrace.  You can use it manually or build a custom instrument 
in Instruments using DTrace as the underlying engine.  A quick one-liner 
example:

sudo dtrace -n 'objc$target:MyClass:-setItem?:entry { ustack(); }' -p <pid of 
my process>


However, it is pretty rare that the statistical tools are not sufficient for 
performance analysis, so you might want to reconsider whether you really need 
an exact function-call measurement.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to