Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - Profiling in QNX / or From QNX Momentics: Page 1 of 3 (3 Items)
   
Profiling in QNX / or From QNX Momentics  
Many problems regarding profiling applications that spawn processes by fork() / exec() calls

We build the project for "Function Instrumentation mode" i,e with the flags -finstrument-functions for compiler and -
lprofilingS for the linker successfully. 

It's a server/client application (i,e while (1) {  } but with proper termination signal handlers)

Main app is "process1" has 2 threads and launches many child processes (with many threads for each) by fork() / exec() 
of other binaries in the same directory. (1 binary -> 1 process with many threads usually) 

Use cases:

1-

Profiling the main procecess from Momentics gives a report of more than 10 threads (has only 2) (gprof is known for its 
issues with multi-process applications).
Many child processes are killed when the profiling session is launched.

---------------------
example output:

Process 335905 (child_appX) terminated SIGSEGV code=1 fltno=11 ip=00000000081373d5(/home/./child_appX@
ld_imposter_get_backtrace+0x00000000000c7bd5) mapaddr=00000000000ef3d5. ref=0000000000000b50
Process 331803 (child_appY) terminated SIGSEGV code=1 fltno=11 ip=00000000081145ef(/home/./child_appY@
ld_imposter_get_backtrace+0x00000000000a4dcf) mapaddr=00000000000cc5ef. ref=0000000000000010
Process 340002 (child_appZ) terminated SIGSEGV code=1 fltno=11 ip=00000000081145cf(/home/./child_appZ@
ld_imposter_get_backtrace+0x00000000000a4dcf) mapaddr=00000000000cc5cf. ref=0000000000001690

--------------------

2 -

We want to obtain the .ptrace file of a child process.

We set the env variables in this way:

QPROF_AUTO_START=1
QPROF_SIG_CONT_PROFILING=16
QPROF_SIG_STOP_PROFILING=17
QPROF_FILE=/home/<app_name>.ptrace (all permissions are set for the dir /home)

We launch the main application then after a while we send the signal 17 by the command :

slay -s SIGUSR2 -S -v child_appX

The child process terminates. We are given then the output:

Process 340002 (child_appX) terminated SIGUSR2 code=0 by process 446495 value=0.

But we can't find any .ptrace file anywhere.

--------------------

3 -

Configuring a "Profile As" >" C/C++ QNX Attach" session on a child process from Momentics gives no result but the 
termination of the child process (same as case 2).

we also can't find any .ptrace file anywhere.

--------------------

We have also many simple (one process , one thread with exit() calls or return from main() ) application that execute 
and exit successfully without generating any .ptrace file.

Am I not using the profiling tools properly ?
If it is a limitation for profiling , any workarounds for these problems ?

Best Regards,

Smail