Improve docs coverage and refresh profiling parser artifacts
Add domain-specific XML documentation across src server components to satisfy CommentChecker, and update dotTrace parsing outputs used for diagnostics.
This commit is contained in:
Binary file not shown.
@@ -16,9 +16,9 @@ def walk(node):
|
||||
|
||||
|
||||
class DtpParserTests(unittest.TestCase):
|
||||
def test_emits_machine_readable_call_tree(self):
|
||||
def run_parser(self, *args: str) -> dict:
|
||||
result = subprocess.run(
|
||||
["python3", str(SCRIPT), str(SNAPSHOT), "--stdout"],
|
||||
["python3", str(SCRIPT), str(SNAPSHOT), "--stdout", *args],
|
||||
cwd=ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
@@ -26,16 +26,54 @@ class DtpParserTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0, msg=result.stderr)
|
||||
payload = json.loads(result.stdout)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
def test_emits_machine_readable_call_tree(self):
|
||||
payload = self.run_parser()
|
||||
|
||||
self.assertIn("callTree", payload)
|
||||
self.assertIn("hotspots", payload)
|
||||
self.assertIn("summary", payload)
|
||||
self.assertTrue(payload["callTree"]["children"])
|
||||
self.assertTrue(payload["hotspots"]["inclusive"])
|
||||
self.assertEqual(payload["snapshot"]["timeUnit"], "nanoseconds")
|
||||
self.assertLessEqual(len(payload["hotspots"]["inclusive"]), 200)
|
||||
self.assertLessEqual(len(payload["hotspots"]["exclusive"]), 200)
|
||||
self.assertIn("wallTimeMs", payload["summary"])
|
||||
self.assertIn("activeTimeMs", payload["summary"])
|
||||
self.assertIn("totalSamples", payload["summary"])
|
||||
self.assertIn("topExclusiveMethod", payload["summary"])
|
||||
|
||||
node_names = [node["name"] for node in walk(payload["callTree"])]
|
||||
self.assertTrue(any(not name.startswith("[special:") for name in node_names))
|
||||
|
||||
def test_supports_hotspot_filter_and_flat_paths(self):
|
||||
payload = self.run_parser("--top", "7", "--filter", "Microsoft.DotNet.Cli.Program", "--flat")
|
||||
|
||||
self.assertLessEqual(len(payload["hotspots"]["inclusive"]), 7)
|
||||
self.assertLessEqual(len(payload["hotspots"]["exclusive"]), 7)
|
||||
self.assertIn("hotPaths", payload)
|
||||
|
||||
node_names = [node["name"] for node in walk(payload["callTree"])]
|
||||
self.assertTrue(any("Microsoft.DotNet.Cli.Program" in name for name in node_names))
|
||||
self.assertFalse(any("Microsoft.Build.Tasks.Copy.ParallelCopyTask" == name for name in node_names))
|
||||
|
||||
for hotspot in payload["hotspots"]["inclusive"] + payload["hotspots"]["exclusive"]:
|
||||
self.assertIn("Microsoft.DotNet.Cli.Program", hotspot["name"])
|
||||
|
||||
for path_entry in payload["hotPaths"]:
|
||||
self.assertIn("Microsoft.DotNet.Cli.Program", path_entry["path"])
|
||||
|
||||
def test_can_include_idle_hotspots_when_requested(self):
|
||||
without_idle = self.run_parser("--top", "20")
|
||||
with_idle = self.run_parser("--top", "20", "--include-idle")
|
||||
|
||||
without_idle_names = {entry["name"] for entry in without_idle["hotspots"]["exclusive"]}
|
||||
with_idle_names = {entry["name"] for entry in with_idle["hotspots"]["exclusive"]}
|
||||
|
||||
self.assertNotIn("System.Threading.WaitHandle.WaitOneNoCheck", without_idle_names)
|
||||
self.assertIn("System.Threading.WaitHandle.WaitOneNoCheck", with_idle_names)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user