Skip to content

Commit

Permalink
Remove BRPC_ENABLE_HEAP_PROFILER related stuff from docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesge committed Sep 16, 2017
1 parent dfe659b commit 0234268
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/cn/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Another common issue with tcmalloc is that it does not return memory to system a

If you want to use [cpu profiler](cpu_profiler.md) or [heap profiler](heap_profiler.md), do link `libtcmalloc_and_profiler.a`. These two profilers are based on tcmalloc.[contention profiler](contention_profiler.md) does not require tcmalloc.

When you remove tcmalloc, not only remove the linking with tcmalloc but also the macros: `-DBRPC_ENABLE_CPU_PROFILER` and `-DBRPC_ENABLE_HEAP_PROFILER`.
When you remove tcmalloc, not only remove the linking with tcmalloc but also the macros: `-DBRPC_ENABLE_CPU_PROFILER`.

## glog: 3.3+

Expand Down
6 changes: 2 additions & 4 deletions docs/cn/heap_profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ brpc可以分析内存是被哪些函数占据的。heap profiler的原理是每

1. 如果tcmalloc使用frame pointer而不是libunwind回溯栈,请确保在CXXFLAGS或CFLAGS中加上`-fno-omit-frame-pointer`,否则函数间的调用关系会丢失,最后产生的图片中都是彼此独立的函数方框。

2. 定义宏BRPC_ENABLE_HEAP_PROFILER, 一般加入编译参数-DBRPC_ENABLE_HEAP_PROFILER。

3. 在shell中`export TCMALLOC_SAMPLE_PARAMETER=524288`。该变量指每分配这么多字节内存时做一次统计,默认为0,代表不开启内存统计。[官方文档](http://goog-perftools.sourceforge.net/doc/tcmalloc.html)建议设置为524288。这个变量也可在运行前临时设置,如`TCMALLOC_SAMPLE_PARAMETER=524288 ./server`。如果没有这个环境变量,可能会看到这样的结果:
2. 在shell中`export TCMALLOC_SAMPLE_PARAMETER=524288`。该变量指每分配这么多字节内存时做一次统计,默认为0,代表不开启内存统计。[官方文档](http://goog-perftools.sourceforge.net/doc/tcmalloc.html)建议设置为524288。这个变量也可在运行前临时设置,如`TCMALLOC_SAMPLE_PARAMETER=524288 ./server`。如果没有这个环境变量,可能会看到这样的结果:

```
$ tools/pprof --text localhost:9002/pprof/heap
Expand All @@ -18,7 +16,7 @@ brpc可以分析内存是被哪些函数占据的。heap profiler的原理是每
/home/gejun/pprof/echo_server.1419559063.localhost.pprof.heap: header size >= 2**16
```

4. 如果只是brpc client或没有使用brpc,看[这里](dummy_server.md)
3. 如果只是brpc client或没有使用brpc,看[这里](dummy_server.md)

注意要关闭Server端的认证,否则可能会看到这个:

Expand Down

0 comments on commit 0234268

Please sign in to comment.