MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / printCpool

Method printCpool

src/flameGraph.cpp:269–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269void FlameGraph::printCpool(Writer& out) {
270 out << "'all'";
271
272 std::string prev;
273 u32 index = 0;
274 for (std::map<std::string, u32>::const_iterator it = _cpool.begin(); it != _cpool.end(); ++it) {
275 if (_name_order[it->second]) {
276 _name_order[it->second] = ++index;
277
278 size_t prefix_len = StringUtils::getCommonPrefix(prev, it->first);
279 prev = it->first;
280
281 if (prefix_len > 95) prefix_len = 95;
282 std::string s(1, (char)(prefix_len + ' '));
283 s.append(it->first, prefix_len, std::string::npos);
284
285 StringUtils::replace(s, '\\', "\\\\", 2);
286 StringUtils::replace(s, '\'', "\\'", 2);
287 out << ",\n'";
288 out.write(s.data(), s.size());
289 out << "'";
290 }
291 }
292
293 // Release cpool memory, since frame names are never used beyond this point
294 _cpool = std::map<std::string, u32>();
295}
296
297const char* FlameGraph::printTill(Writer& out, const char* data, const char* till) {
298 const char* pos = strstr(data, till);

Callers

nothing calls this directly

Calls 5

endMethod · 0.80
appendMethod · 0.80
writeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected