MCPcopy Create free account
hub / github.com/apache/brpc / dump_and_destroy

Method dump_and_destroy

src/bthread/mutex.cpp:171–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void ContentionProfiler::dump_and_destroy(SampledContention* c) {
172 init_if_needed();
173 // Categorize the contention.
174 SampledContention** p_c2 = _dedup_map.seek(c);
175 if (p_c2) {
176 // Most contentions are caused by several hotspots, this should be
177 // the common branch.
178 SampledContention* c2 = *p_c2;
179 c2->duration_ns += c->duration_ns;
180 c2->count += c->count;
181 c->destroy();
182 } else {
183 _dedup_map.insert(c, c);
184 }
185 if (_dedup_map.size() > MAX_CACHED_CONTENTIONS) {
186 flush_to_disk(false);
187 }
188}
189
190void ContentionProfiler::flush_to_disk(bool ending) {
191 BT_VLOG << "flush_to_disk(ending=" << ending << ")";

Callers

nothing calls this directly

Calls 4

seekMethod · 0.45
destroyMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected