MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / diagCoverageRegions

Function diagCoverageRegions

src/Common/CoverageCollection.cpp:307–330  ·  view source on GitHub ↗

Returns (non_empty_file_count, zero_line_count, first_file_hash) among matched regions for diagnostic purposes.

Source from the content-addressed store, hash-verified

305/// Returns (non_empty_file_count, zero_line_count, first_file_hash)
306/// among matched regions for diagnostic purposes.
307std::tuple<size_t, size_t, uint64_t> diagCoverageRegions(const std::vector<CovCounter> & name_refs)
308{
309 ensureCoverageMapLoaded();
310 size_t non_empty = 0, zero_line = 0;
311 uint64_t first_file_hash = 0;
312 for (const auto & [name_hash, func_hash, counter_id, min_depth] : name_refs)
313 {
314 auto it = g_coverage_map.find(CoverageKey{name_hash, func_hash, counter_id});
315 if (it == g_coverage_map.end()) continue;
316 const CoverageRegion & r = it->second;
317 if (!r.file.empty())
318 {
319 ++non_empty;
320 if (first_file_hash == 0)
321 {
322 /// Store length of first file as a proxy diagnostic
323 first_file_hash = static_cast<uint64_t>(r.file.size()) << 32
324 | static_cast<uint64_t>(r.line_start);
325 }
326 }
327 if (r.line_start == 0) ++zero_line;
328 }
329 return {non_empty, zero_line, first_file_hash};
330}
331
332CurrentCoverageRegions getCurrentCoverageRegions()
333{

Callers 1

executeImplMethod · 0.85

Calls 5

ensureCoverageMapLoadedFunction · 0.85
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected