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

Method export_html_snapshot

tools/fastgrind.py:1019–1065  ·  view source on GitHub ↗
(
        self,
        output: str | Path,
        start_ms: int | None = None,
        end_ms: int | None = None,
        thread_ids: Sequence[int] | None = None,
        function_ids: Sequence[int] | None = None,
        metric: str = "live",
        metrics: Sequence[str] | None = None,
        scope: str = "inclusive",
    )

Source from the content-addressed store, hash-verified

1017 return output_path
1018
1019 def export_html_snapshot(
1020 self,
1021 output: str | Path,
1022 start_ms: int | None = None,
1023 end_ms: int | None = None,
1024 thread_ids: Sequence[int] | None = None,
1025 function_ids: Sequence[int] | None = None,
1026 metric: str = "live",
1027 metrics: Sequence[str] | None = None,
1028 scope: str = "inclusive",
1029 ) -> Path:
1030 output_path = Path(output)
1031 start_tick, end_tick = self._normalize_window(start_ms, end_ms)
1032 selected_metrics = self._normalize_metrics(metrics, default=metric)
1033 series = self.query_multi_series(
1034 thread_ids=thread_ids,
1035 function_ids=function_ids,
1036 start_ms=start_tick,
1037 end_ms=end_tick,
1038 metrics=selected_metrics,
1039 scope=scope,
1040 split="auto",
1041 resolution=400,
1042 )
1043 primary_metric = self._primary_metric(selected_metrics)
1044 detail_metric = self.detail_metric(selected_metrics, default=metric)
1045 top = self.top_functions(start_tick, end_tick, thread_ids=thread_ids, limit=12, metric=detail_metric, scope="exclusive")
1046 focus_thread = (thread_ids or self._all_thread_ids[:1])[:1]
1047 stack_tree = self.stack_tree(focus_thread[0], start_tick, end_tick, metric=detail_metric) if focus_thread else None
1048 context = self.describe_detail_context(
1049 start_ms=start_tick,
1050 end_ms=end_tick,
1051 thread_ids=thread_ids,
1052 focus_thread=focus_thread[0] if focus_thread else None,
1053 )
1054
1055 html = generate_snapshot_html(
1056 title=f"fastgrind snapshot: {self.reader.path.name}",
1057 meta=self.meta(),
1058 series=series,
1059 top_rows=top,
1060 detail_metric=detail_metric,
1061 stack_tree=stack_tree,
1062 detail_context=context,
1063 )
1064 output_path.write_text(html, encoding="utf-8")
1065 return output_path
1066
1067 def query_bundle(
1068 self,

Callers 2

_save_htmlMethod · 0.80
export_html_commandFunction · 0.80

Calls 10

_normalize_windowMethod · 0.95
_normalize_metricsMethod · 0.95
query_multi_seriesMethod · 0.95
_primary_metricMethod · 0.95
detail_metricMethod · 0.95
top_functionsMethod · 0.95
stack_treeMethod · 0.95
metaMethod · 0.95
generate_snapshot_htmlFunction · 0.85

Tested by

no test coverage detected