Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to initialise the CPU profiler manually?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Enrico Zschemisch  
View profile  
 More options Nov 15 2012, 9:16 pm
From: Enrico Zschemisch <ezsch...@gmail.com>
Date: Thu, 15 Nov 2012 18:16:41 -0800 (PST)
Local: Thurs, Nov 15 2012 9:16 pm
Subject: How to initialise the CPU profiler manually?

Hi,

I have the following situation: A linux binary is searching a specific
directory for shared libraries. All found shared libraries are later used
as a plugin. Now the binary sets signal handlers for everything and exits
when it gets *any* signal. The binary can not be used with -fPIC-compiled
plugins.
As I don't have the code for the binary but need to (cpu and heap) profile
one of the plugins my only option is LD_PRELOAD.  
During initialisation of the cpu profiler a SIGPROF-signal is sent and the
binary exits.

So, what I want to do:

   1. ProfileHandler already has an option to disallow profiling, which is
   set to "allow" by default. I set this to disallow and added a new function
   to allow profiling from the outside (the plugin).
   2.  This new function will toggle the allow-flag and call Init().
   3. Then in the plugin I call RegisterThread() and
   ProfilerStart()/ProfilerStop() for my only thread I want to profile.

Now I get a crash somewhere which I can't catch in a debugger.

Have I initialised everything correctly? Is there a better way to do this?

Thanks,
Enrico


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Chappelle  
View profile  
 More options Nov 16 2012, 7:54 am
From: David Chappelle <chapp...@gmail.com>
Date: Fri, 16 Nov 2012 07:54:55 -0500
Local: Fri, Nov 16 2012 7:54 am
Subject: Re: How to initialise the CPU profiler manually?

Interesting problem Enrico. From the perspective of the profiler it looks
like you have the right initialization. What kind of crash is being
generated? abort? segfault? can you share the backtrace?

-Dave

On Thu, Nov 15, 2012 at 9:16 PM, Enrico Zschemisch <ezsch...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enrico Zschemisch  
View profile  
 More options Nov 16 2012, 6:31 pm
From: Enrico Zschemisch <ezsch...@gmail.com>
Date: Fri, 16 Nov 2012 15:31:49 -0800 (PST)
Local: Fri, Nov 16 2012 6:31 pm
Subject: Re: How to initialise the CPU profiler manually?

Hi Dave,

I looked into this again today: The binary reports it is "crashed", however
gdb prints:
*Program terminated with signal SIGPROF, Profiling timer expired.*
*
*
My search gave that this happens when the signal is sent before a handler
is registered. So I changed the sequence to:

   1. disallow profiling in ProfileHandler
   2. Binary & Plugin startup
   3. Call new ProfilerInit() to call InitAllowed() on the ProfileHandler:
   Will create a new instance with allowed = true
   4. Call ProfilerStart() which calls EnableHandler() to register a signal
   handler
   5. Call ProfilerRegisterThread() in my plugin's only (main) thread.

The binary will still exit with the above error message about an expired
timer. I made sure there is no *setitimer() *or *alarm()*-call before *
EnableHandler()*. The signal is coming from *StartTimer()*, which is called
from* ProfilerRegisterThread()*.

One more thing: I had to bypass the check in for an existing
SIG_PROF-handler in ProfileHandler's ctor, as the binary already has one
installed (which it uses to exit then).

Any idea or suggestion on how to get this working?

Thanks,
Enrico


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enrico Zschemisch  
View profile  
 More options Nov 29 2012, 8:42 pm
From: Enrico Zschemisch <ezsch...@gmail.com>
Date: Thu, 29 Nov 2012 17:42:40 -0800 (PST)
Local: Thurs, Nov 29 2012 8:42 pm
Subject: Re: How to initialise the CPU profiler manually?

Hi,

any idea?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Chappelle  
View profile  
 More options Nov 29 2012, 9:14 pm
From: David Chappelle <chapp...@gmail.com>
Date: Thu, 29 Nov 2012 21:14:29 -0500
Local: Thurs, Nov 29 2012 9:14 pm
Subject: Re: How to initialise the CPU profiler manually?

So just to make sure I have this correct, the binary itself has it's own
SIGPROF signal registered?

On Fri, Nov 16, 2012 at 6:31 PM, Enrico Zschemisch <ezsch...@gmail.com>wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enrico Zschemisch  
View profile  
 More options Nov 29 2012, 9:16 pm
From: Enrico Zschemisch <ezsch...@gmail.com>
Date: Thu, 29 Nov 2012 18:16:37 -0800
Local: Thurs, Nov 29 2012 9:16 pm
Subject: Re: How to initialise the CPU profiler manually?

Yeah, unfortunately it has. It does not do anything with it, according to
the developers. Kind of a "catch all" on signals.

After registering gperftool's signal handler, the binary does not exit as
usual, so it seems the last signal handler registered is used. But then I
get the timeout instead.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »