• yurys@chromium.org's avatar
    Support higher CPU profiler sampling rate on posix systems · 4db1f475
    yurys@chromium.org authored
    New flag is added that allows to specify CPU profiler sampling rate in microseconds as command line argument. It was tested to work fine with 100us interval(currently it is 1ms). Default values are kept the same as in the current implementation. The new implementation is enabled only on POSIX platforms which use signals to collect samples. Other platforms that pause thread being sampled are to follow.
    
    SIGPROF signals are now sent on the profiler event processor thread to make sure that the processing thread does fall far behind the sampling.
    
    The patch is based on the previous one that was rolled out in r13851. The main difference is that the circular queue is not modified for now.
    
    On Linux sampling for CPU profiler is initiated on the profiler event processor thread, other platforms to follow.
    
    CPU profiler continues to use SamplingCircularQueue, we will probably replace it with a single sample buffer when Mac and Win ports support profiling on the event processing thread.
    
    When --prof option is specified profiling is initiated either on the profiler event processor thread if CPU profiler is on or on the SignalSender thread as it used to be if no CPU profiles are being collected.
    
    ProfilerEventsProcessor::ProcessEventsAndDoSample now waits in a tight loop, processing collected samples until sampling interval expires. To save CPU resources I'm planning to change that to use nanosleep as only one sample is expected in the queue at any point.
    
    BUG=v8:2814
    R=bmeurer@chromium.org
    
    Review URL: https://codereview.chromium.org/21101002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16310 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    4db1f475
cpu-profiler.h 9.09 KB