MCPcopy Create free account
hub / github.com/ceph/ceph / create

Function create

src/common/perf_counters_key.cc:76–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76std::string create(std::string_view counter_name,
77 label_pair* begin, label_pair* end)
78{
79 // sort the input labels and remove duplicate keys
80 std::sort(begin, end, label_key_less);
81 end = std::unique(begin, end, label_key_equal);
82
83 // calculate the total size and preallocate the buffer
84 auto size = std::accumulate(begin, end,
85 counter_name.size() + sizeof(DELIMITER),
86 [] (std::size_t sum, const label_pair& l) {
87 return sum + label_size(l);
88 });
89 std::string result;
90 result.resize(size);
91
92 // copy out the counter name and labels
93 auto out = result.begin();
94 out = write(counter_name, out);
95 std::copy(begin, end, label_insert_iterator{out});
96
97 return result;
98}
99
100std::string insert(const char* begin1, const char* end1,
101 label_pair* begin2, label_pair* end2)

Callers 15

createMethod · 0.70
CephContextMethod · 0.70
modify_msgr_hookMethod · 0.70
key_createFunction · 0.70
GraylogMethod · 0.70
initMethod · 0.70
execute_commandMethod · 0.70
ptrMethod · 0.70
copy_deepMethod · 0.70
copy_shallowMethod · 0.70
rebuildMethod · 0.70

Calls 7

uniqueFunction · 0.85
label_sizeFunction · 0.85
writeFunction · 0.70
copyFunction · 0.50
sizeMethod · 0.45
resizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected