MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / count

Method count

tests/test_coverage_terminal.py:141–168  ·  view source on GitHub ↗
(self, case, label, raw, function)

Source from the content-addressed store, hash-verified

139 return sorted(names)
140
141 def count(self, case, label, raw, function):
142 self.admit(raw)
143 require(self.common.regular_nonempty(raw), "raw profile is absent/unreadable")
144 indexed = case / (label + ".profdata")
145 self.run(case, label + "-merge", [self.tool, "merge", "--instr",
146 "--output=" + str(indexed), str(raw)],
147 self.environment, success=True)
148 require(self.common.regular_nonempty(indexed), "merge produced no indexed profile")
149 self.admit(indexed)
150 shown = self.run(case, label + "-count",
151 [self.tool, "show", "--counts", "--function=" + function, str(indexed)],
152 self.environment, success=True)
153 blocks, current = [], None
154 for line in self.log(case, shown, "stdout").splitlines():
155 heading = re.fullmatch(r" (.+):", line)
156 if heading:
157 current = {"name": heading.group(1), "counts": []}
158 blocks.append(current)
159 elif current is not None:
160 value = re.fullmatch(r" Function count: ([0-9]+)", line)
161 if value:
162 current["counts"].append(int(value.group(1)))
163 exact = [block for block in blocks if block["name"] == function
164 or block["name"].endswith(":" + function)]
165 require(len(exact) == 1 and len(exact[0]["counts"]) == 1,
166 "missing/ambiguous exact function record: " + function)
167 return {"raw": str(raw), "indexed": str(indexed), "function": exact[0]["name"],
168 "count": exact[0]["counts"][0]}
169
170 def reduce(self, case, directory, code):
171 # The pinned reducer invokes exactly one profdata reader per admitted raw

Callers 15

caseMethod · 0.95
galaxyTraceIncomingFunction · 0.80
chatScenarioFunction · 0.80
measureOverlapFunction · 0.80
architectureScenarioFunction · 0.80
systemScenarioFunction · 0.80
checkK2Function · 0.80
checkK8Function · 0.80
chatToggleFunction · 0.80
checkK3Function · 0.80
checkK13Function · 0.80
checkK5Function · 0.80

Calls 5

admitMethod · 0.95
runMethod · 0.95
logMethod · 0.95
strFunction · 0.85
requireFunction · 0.70

Tested by

no test coverage detected