Need help with profiling driver

So I’m trying to profile a driver (i2s) and I’m having problems. Im using 6.3SP1. Can anyone make a suggestion how to go about it.

I don’t know if this is what you are asking but this is how you starting the profiling in Momentics.
when compiling you have to add an option to “build with profiling”, and compile your code and run.
To see the profiled information you have to open the “profiling perspective” from momentics. Also the app has to run until Qconn (IP) connection from Momentics side.

If you don’t have momentics and are just compiling from the command line or a Makefile then you need to do the following:

  1. Add a -p to the qcc line on both the compile AND link lines.
  2. Run your driver and a file called gmon.out will be created in the directory you start the driver from.
  3. Wait some period of time that you want to profile.
  4. Run gprof on the gmon.out file and examine the output

Note. This is post mortem profiling AFTER an app has run. It shows all the function calls your app makes including system ones, how long it spends in each routine etc.

You can read more on gprof on the gnu web site.

Tim

Thanks for the replies. I have tried both methods and when I try to load the driver it fails. I know the driver works because without the -p or build with profiling option it loads and works just fine. But as soon as I do -p or IDE profiling it fails. Do you know what could be causing it?

Bighonza,

What do you mean it ‘fails’. Does it crash, does it just not function properly code wise but not crash etc.

One thing to note, the profiler is going to be REALLY intrusive time wise on your driver. So if there are very hardcore timings in there it may not function properly from a coding standpoint because the profiling may chew up too much CPU.

Also does your driver do an interrupt_attach_event or does it use a true ISR? The doc’s for the profiler don’t mention anything specific for drivers but I wonder if an ISR could cause problems for a profiler since it runs in kernal space.

Tim

Tim,

Here is the exact error i get when i try to load the driver with the profile option turned on:

slay io-audio

slay slogger

slogger

io-audio -dcamelot_i2s_g.so

Process 213004 (io-audio) terminated SIGSEGV code=1 fltno=11 ip=78202a48 mapaddr
=00002a48. ref=00000000

Thanks for your help

Bighonza,

OK. So the driver terminated with a segment violation.

Are you running dumper on your system? If not, can you please start dumper to grab a dump file when the driver terminates (Do a ‘use dumper’ to show to use it). You’ll need to start dumper as root.

Once you get a dump file then you can run ‘gdb io-audio io-audio.core’ and then see exactly which line you sigsegv’d on (assuming you compile in debug mode). That might point out where/what the problem is when the driver crashes with profiling turned on. Let me know what you find.

You still didn’t mention whether your using a true ISR to talk to hardware or interrupt_attach_event.

Tim

interrupt_attach_event

You are trying to do profiling on a shared object? Better contact your QNX rep and ask if that is at all supported. I heard that maybe it is not.

Bighonza,

So what did you find when you ran the debugger on the core file? Where was it crashing?

Tim

It is crashing in the ctrl_version function of the driver when I try to assing 1 to *minor. Tried a few things, but nothing worked.