[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tracing objC messages

From: Lucas Schnorr
Subject: Re: Tracing objC messages
Date: Mon, 30 May 2011 16:58:34 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110424 Thunderbird/3.1.10

Hi David,

On 05/27/2011 05:05 PM, David Chisnall wrote:
objc_profile_msg_enter(foo, @selector(bar), __FILE__, __LINE__);
[foo bar];
> objc_profile_msg_exit(foo, @selector(bar), __FILE__, __LINE__);

That's nice. But how would it work? A new clang parameter for compilation and a dynamic linkage to a tracing library that implements these functions? Or the application should implement the functions by itself?

You could then record timestamps along with this into a format that
something else could parse.  I'd be happy to make this modification
if you could define some interfaces for the profiling.

The prototypes I would implement to do this type of tracing:

void objc_trace_init (void);
void objc_trace_close (void);
void objc_trace_msg_enter (id obj,
                           SEL method,
                           const char *source_file,
                           int line);
void objc_trace_msg_exit (id obj,
                          SEL method,
                          const char *source_file,
                          int line);

I created a non-functional library with these functions:

In a first attempt, objc_trace_init should be called as soon as the program starts execution (before any call to other tracing functions), and objc_trace_close just before it exits (to manage the trace file on the disk). The visualization would have the classes used by the program and their objects and the timeline would show the execution path of the single-thread program.

Afterwards, we can also try a per-thread tracing to see the execution
path of each thread, with the visualization organized in the same way. We would need to call objc_trace_init for each thread, but with some
parameters to identify it on the trace.

I just installed llvm/clang from the svn, so I am ready to test your
modifications to clang.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]