forked from apache/incubator-pegasus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pprof): Supports both heap profiling and heap sampling (apache#1684
) In XiaoMi/rdsn#433, we updated the way to get heap profile by using ``` HeapProfilerStart(...); sleep(seconds); GetHeapProfile(); HeapProfilerStop(); ``` instead of ``` MallocExtension::instance()->GetHeapSample(...); ``` It provides a way to analyse which pieces of code allocated (and possibly freed) how much memory during the time the request processed on the server. However, in the scenario of a server already in heavy memory consumption but growing very slow, it's hard to tell which pieces of code allocated the most of the memory. This patch adds the heap sampling back, and keep the heap profiling as well. Both of the two ways are using the `pprof/heap` method, the difference is whether the `seconds` parameter appears. When the `seconds` parameter appears, using `GetHeapProfile()`, otherwise, using `GetHeapSample()`. Remember to set environment variable TCMALLOC_SAMPLE_PARAMETER when using heap sampling.
- Loading branch information
Showing
1 changed file
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters