MCPcopy Create free account
hub / github.com/adny-code/fastgrind / _compatibility_json_data

Method _compatibility_json_data

tools/fastgrind.py:1427–1458  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1425 self._render_stack_tree_text(child, depth + 1, lines)
1426
1427 def _compatibility_json_data(self) -> dict[str, Any]:
1428 result: dict[str, Any] = {}
1429 if self.reader.max_tick_ms == 0 and not self.reader.tick_directory:
1430 return result
1431
1432 start_tick = self.reader.default_start_tick()
1433 for tick_ms in range(start_tick, self.reader.max_tick_ms + self.reader.sample_interval_ms, self.reader.sample_interval_ms):
1434 result[str(tick_ms)] = {}
1435
1436 for entry, blocks in self.reader.iter_tick_blocks_range(start_tick, self.reader.max_tick_ms):
1437 tick_key = str(entry.tick_ms)
1438 per_tick = result.setdefault(tick_key, {})
1439 for thread_id, records in blocks:
1440 root = {"name": "(null)", "malloc": 0, "free": 0, "children": []}
1441 child_maps: dict[int, dict[str, Any]] = {id(root): {}}
1442 for leaf_node_id, malloc_bytes, free_bytes in records:
1443 root["malloc"] += malloc_bytes
1444 root["free"] += free_bytes
1445 parent = root
1446 for function_id in self.reader.node_paths[leaf_node_id]:
1447 mapping = child_maps.setdefault(id(parent), {})
1448 key = self.reader.function_names[function_id] or str(function_id)
1449 child = mapping.get(key)
1450 if child is None:
1451 child = {"name": key, "malloc": 0, "free": 0, "children": []}
1452 mapping[key] = child
1453 parent["children"].append(child)
1454 child["malloc"] += malloc_bytes
1455 child["free"] += free_bytes
1456 parent = child
1457 per_tick[str(thread_id)] = root
1458 return result
1459
1460
1461def generate_snapshot_html(

Callers 1

export_jsonMethod · 0.95

Calls 2

default_start_tickMethod · 0.80

Tested by

no test coverage detected