| 147 | } |
| 148 | |
| 149 | static int JeProfileReset(size_t lg_sample) { |
| 150 | if (!HasJemalloc()) { |
| 151 | LOG(WARNING) << "no jemalloc"; |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | if (!HasEnableJemallocProfile()) { |
| 156 | LOG(WARNING) << "jemalloc have not set opt.prof before start"; |
| 157 | return -1; |
| 158 | } |
| 159 | |
| 160 | int ret = mallctl("prof.reset", nullptr, nullptr, &lg_sample, sizeof(lg_sample)); |
| 161 | if (ret != 0) { |
| 162 | LOG(WARNING) << "mallctl set prof.reset:" << lg_sample << " err, ret:" << ret; |
| 163 | return ret; |
| 164 | } |
| 165 | LOG(INFO) << "mallctl set prof.reset:" << lg_sample << " succ"; |
| 166 | return 0; |
| 167 | } |
| 168 | |
| 169 | // https://github.com/jemalloc/jemalloc/blob/5.3.0/bin/jeprof.in#L211-L222 |
| 170 | static const std::unordered_set<const char*> g_extra_options_set = { |
no test coverage detected