Re: operf evil memory consumption

William Cohen <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 05/12/2015 01:40 PM, Andrew Haley wrote:
> I was surprised to see this:
> 
>   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
>  1968 aph       20   0 7657600 1.675g  13184 S 754.0 10.5  73:01.82 java
>  1970 aph       20   0 7533760 7.180g   4288 S  36.8 45.1   3:28.73 operf
> 
> The RSS of operf really is extreme.  Is it that it keeps all samples
> in memory, or somesuch?

Hi Andrew,

That does look excessive. This was just taking measurements on the java process and its children or system-wide? What is the command line being used to start up operf?  I could imagine some options like --separate-thread and --separate-cpu increasing the number of files open to record data and increasing the resident memory use. Also  the way that perf works in system-wide mode each processor on the system needs to have a perf open and buffer space allocated; for many processor machine this overhead could be come more noticable.

The main data collection loop for operf is in operf_counter.cpp the method operf_record::recordPerfData(void) and this is calling OP_perf_utils::op_get_kernel_event_data(struct mmap_data *md, operf_record * pr).  op_get_kernel_event_data() uses a fixed size mmap'ed page to get data from the kernel.  It looks like this should be process immediately by OP_perf_utils::op_write_event(event_t * event, u64 sample_type).

What does the output of the following look like when this is happening?

$ pmap `pgrep operf`

-Will

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.