def METHOD_NAME(self, histogram_params: Dict[str, int], out_path: Path) -> None:
    alloc_size_hist = describe_histogram_databins(
        get_histogram_databins(
            self._stats.allocation_count_by_size, bins=histogram_params["num_bins"]
        )
    )
    metadata = asdict(self._stats.metadata)
    for name, val in metadata.items():
        if isinstance(val, datetime.datetime):
            metadata[name] = str(val)
    data: Dict[str, Any] = dict(
        total_num_allocations=self._stats.total_num_allocations,
        total_bytes_allocated=self._stats.total_memory_allocated,
        allocation_size_histogram=alloc_size_hist,
        allocator_type_distribution={
            allocation_type: count
            for allocation_type, count in self._get_allocator_type_distribution()
        },
        top_allocations_by_size=[
            {"location": self._format_location(location), "size": size}
            for location, size in self._get_top_allocations_by_size()
        ],
        top_allocations_by_count=[
            {"location": self._format_location(location), "count": count}
            for location, count in self._get_top_allocations_by_count()
        ],
        metadata=metadata,
    )
    with open(out_path, "w") as f:
        json.dump(data, f, indent=2)