Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Issue 185 in google-perftools: add realtime profiling support to cpuprofiler
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
  7 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
 
codesite-nore...@google.com  
View profile  
 More options Nov 3, 9:21 pm
From: codesite-nore...@google.com
Date: Wed, 04 Nov 2009 02:21:51 +0000
Local: Tues, Nov 3 2009 9:21 pm
Subject: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler
Status: New
Owner: ----

New issue 185 by themastermind1: add realtime profiling support to  
cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

Following patch adds a CPUPROFILE_REALTIME env flag to use ITIMER_REAL and  
SIGALRM for
profiling:
http://github.com/tmm1/perftools.rb/raw/8f9b826cfc221a396506110f73de1...
s/perftools-realtime.patch

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 3, 9:25 pm
From: codesite-nore...@google.com
Date: Wed, 04 Nov 2009 02:25:54 +0000
Local: Tues, Nov 3 2009 9:25 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler

Comment #1 on issue 185 by themastermind1: add realtime profiling support  
to cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

Patch attached.

Attachments:
        perftools-realtime.patch  2.4 KB

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 5, 2:15 pm
From: codesite-nore...@google.com
Date: Thu, 05 Nov 2009 19:15:23 +0000
Local: Thurs, Nov 5 2009 2:15 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler
Updates:
        Status: Started

Comment #2 on issue 185 by csilvers: add realtime profiling support to  
cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

I've applied the patch (or more exactly, the functionality from the patch),  
but one
of the unittests we use to test the heap-profiler handler breaks with the  
new
functionality.  I don't know if it's problems with the actual code or the  
test.  In
any case, we'll try to figure it out, and then get this ready for the next  
release.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 5, 2:19 pm
From: codesite-nore...@google.com
Date: Thu, 05 Nov 2009 19:19:26 +0000
Local: Thurs, Nov 5 2009 2:19 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler
Updates:
        Labels: Type-Enhancement Priority-Medium

Comment #3 on issue 185 by csilvers: add realtime profiling support to  
cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

(No comment was entered for this change.)

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 5, 2:27 pm
From: codesite-nore...@google.com
Date: Thu, 05 Nov 2009 19:27:34 +0000
Local: Thurs, Nov 5 2009 2:27 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler

Comment #4 on issue 185 by themastermind1: add realtime profiling support  
to cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

I'm curious to see your version of the patch.

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 5, 2:41 pm
From: codesite-nore...@google.com
Date: Thu, 05 Nov 2009 19:41:49 +0000
Local: Thurs, Nov 5 2009 2:41 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler

Comment #5 on issue 185 by csilvers: add realtime profiling support to  
cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

It's functionally the same:
---
==== //depot/google3/base/profile-handler.cc#2 -  
/home/csilvers/google3/base/pro
file-handler.cc ====
--- /tmp/g4-500/cache/depot/google3/base/profile-handler.cc#2   2009-11-04  
11:57
:28.000000000 -0500
+++ /home/csilvers/google3/base/profile-handler.cc      2009-11-04  
12:21:56.2512
44000 -0500
@@ -56,18 +56,18 @@
    // Registers a callback routine to receive profile timer ticks. The  
returned
    // token is to be used when unregistering this callback and must not be
    // deleted by the caller. Registration of the first callback enables the
-  // SIGPROF handler.
+  // SIGPROF handler (or SIGALRM if using ITIMER_REAL).
    ProfileHandlerToken* RegisterCallback(ProfileHandlerCallback callback,
                                          void* callback_arg);

    // Unregisters a previously registered callback. Expects the token  
returned
    // by the corresponding RegisterCallback routine. Unregistering the last
-  // callback disables the SIGPROF handler.
+  // callback disables the SIGPROF handler (or SIGALRM if using  
ITIMER_REAL).
    void UnregisterCallback(ProfileHandlerToken* token)
        NO_THREAD_SAFETY_ANALYSIS;

    // Unregisters all the callbacks, stops the timer if shared, disables the
-  // SIGPROF handler and clears the timer_sharing_ state.
+  // SIGPROF (or SIGALRM) handler and clears the timer_sharing_ state.
    void Reset();

    // Gets the current state of profile handler.
@@ -94,12 +94,15 @@
    // Initializes the ProfileHandler singleton via GoogleOnceInit.
    static void Init();

-  // Counts the number of SIGPROF interrupts received.
+  // The number of SIGPROF (or SIGALRM for ITIMER_REAL) interrupts  
received.
    int64 interrupts_ GUARDED_BY(signal_lock_);

-  // SIGPROF interrupt frequency, read-only after construction.
+  // SIGPROF/SIGALRM interrupt frequency, read-only after construction.
    int32 frequency_;

+  // ITIMER_PROF (which uses SIGPROF), or ITIMER_REAL (which uses SIGALRM)
+  int timer_type_;
+
    // Counts the number of callbacks registered.
    int32 callback_count_ GUARDED_BY(control_lock_);

@@ -163,7 +166,7 @@
    // Disables (ignores) the timer interrupt signal.
    void DisableHandler() EXCLUSIVE_LOCKS_REQUIRED(control_lock_);

-  // SIGPROF handler. Iterate over and call all the registered callbacks.
+  // SIGPROF/SIGALRM handler. Iterate over and call all the registered  
callback
s.
    static void SignalHandler(int sig, siginfo_t* sinfo, void* ucontext);

    DISALLOW_EVIL_CONSTRUCTORS(ProfileHandler);
@@ -189,6 +192,9 @@
        callback_count_(0),
        timer_sharing_(TIMERS_UNTOUCHED) {
    SpinLockHolder cl(&control_lock_);
+
+  timer_type_ = (getenv("CPUPROFILE_REALTIME") ? ITIMER_REAL :  
ITIMER_PROF);
+
    // Get frequency of interrupts (if specified)
    char junk;
    const char* fr = getenv("CPUPROFILE_FREQUENCY");
@@ -341,18 +347,18 @@
    timer.it_interval.tv_sec = 0;
    timer.it_interval.tv_usec = 1000000 / frequency_;
    timer.it_value = timer.it_interval;
-  setitimer(ITIMER_PROF, &timer, 0);
+  setitimer(timer_type_, &timer, 0);
  }

  void ProfileHandler::StopTimer() {
    struct itimerval timer;
    memset(&timer, 0, sizeof timer);
-  setitimer(ITIMER_PROF, &timer, 0);
+  setitimer(timer_type_, &timer, 0);
  }

  bool ProfileHandler::IsTimerRunning() {
    struct itimerval current_timer;
-  RAW_CHECK(0 == getitimer(ITIMER_PROF, &current_timer), strerror(errno));
+  RAW_CHECK(0 == getitimer(timer_type_, &current_timer), strerror(errno));
    return (current_timer.it_value.tv_sec != 0 ||
            current_timer.it_value.tv_usec != 0);
  }
@@ -362,7 +368,8 @@
    sa.sa_sigaction = SignalHandler;
    sa.sa_flags = SA_RESTART | SA_SIGINFO;
    sigemptyset(&sa.sa_mask);
-  RAW_CHECK(sigaction(SIGPROF, &sa, NULL) == 0, strerror(errno));
+  const int signal_number = (timer_type_ == ITIMER_PROF ? SIGPROF :  
SIGALRM);
+  RAW_CHECK(sigaction(signal_number, &sa, NULL) == 0, strerror(errno));
  }

  void ProfileHandler::DisableHandler() {
@@ -370,7 +377,8 @@
    sa.sa_handler = SIG_IGN;
    sa.sa_flags = SA_RESTART;
    sigemptyset(&sa.sa_mask);
-  RAW_CHECK(sigaction(SIGPROF, &sa, NULL) == 0, strerror(errno));
+  const int signal_number = (timer_type_ == ITIMER_PROF ? SIGPROF :  
SIGALRM);
+  RAW_CHECK(sigaction(signal_number, &sa, NULL) == 0, strerror(errno));
  }

  void ProfileHandler::SignalHandler(int sig, siginfo_t* sinfo, void*  
ucontext) {
---

I also updated the documentation. :-)

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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.
codesite-nore...@google.com  
View profile  
 More options Nov 5, 2:50 pm
From: codesite-nore...@google.com
Date: Thu, 05 Nov 2009 19:50:55 +0000
Local: Thurs, Nov 5 2009 2:50 pm
Subject: Re: Issue 185 in google-perftools: add realtime profiling support to cpuprofiler

Comment #6 on issue 185 by themastermind1: add realtime profiling support  
to cpuprofiler
http://code.google.com/p/google-perftools/issues/detail?id=185

Cool, was just curious. Thanks!

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


    Reply    Reply to author    Forward  
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 »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google