# Path: compiler_opt/tools/benchmark_report.py
# def _geomean(data: List[float]):
# def _stdev(data: List[float]):
#   def __init__(self, suite_name: str, json_data: BenchmarkRunResults,
#                counter_names: Iterable[str]):
#   def suite_name(self):
#   def values(self):
#   def names(self):
#   def counters(self):
#   def raw_measurements(self):
#   def counter_means(self, benchmark: str, counter: str) -> Tuple[float, float]:
#   def zero_counters(self):
#   def large_variation_counters(self, variation: float):
#   def _load_values(self, data: BenchmarkRunResults,
#                    names: Iterable[str]) -> PerBenchmarkResults:
#   def __init__(self, base_report: BenchmarkReport, exp_report: BenchmarkReport):
#   def suite_name(self):
#   def summarize(self) -> ABComparison:
#   def names(self):
#   def counters(self):
#   def total_improvement(self, counter: str):
# class BenchmarkReport:
# class BenchmarkComparison:


import csv
import json
import tensorflow.compat.v2 as tf
from typing import Sequence
from absl import app
from absl import flags
from compiler_opt.tools import benchmark_report
# coding=utf-8
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

r"""Convert benchmark results.json to csv.

To run:
python3 compiler_opt/tools/benchmark_report_counter.py \
  --base=/tmp/base_report.json \
  --exp=/tmp/exp_report.json \
  --counters=INSTRUCTIONS \
  --counters=CYCLES \

# Path: compiler_opt/tools/benchmark_report.py
# def _geomean(data: List[float]):
# def _stdev(data: List[float]):
#   def __init__(self, suite_name: str, json_data: BenchmarkRunResults,
#                counter_names: Iterable[str]):
#   def suite_name(self):
#   def values(self):
#   def names(self):
#   def counters(self):
#   def raw_measurements(self):
#   def counter_means(self, benchmark: str, counter: str) -> Tuple[float, float]:
#   def zero_counters(self):
#   def large_variation_counters(self, variation: float):
#   def _load_values(self, data: BenchmarkRunResults,
#                    names: Iterable[str]) -> PerBenchmarkResults:
#   def __init__(self, base_report: BenchmarkReport, exp_report: BenchmarkReport):
#   def suite_name(self):
#   def summarize(self) -> ABComparison:
#   def names(self):
#   def counters(self):
#   def total_improvement(self, counter: str):
# class BenchmarkReport:
# class BenchmarkComparison:


# Path: compiler_opt/tools/benchmark_report_converter.py
import csv
import json
import tensorflow.compat.v2 as tf
from typing import Sequence
from absl import app
from absl import flags
from compiler_opt.tools import benchmark_report

# coding=utf-8
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

r"""Convert benchmark results.json to csv.

To run:
python3 compiler_opt/tools/benchmark_report_counter.py \
  --base=/tmp/base_report.json \
  --exp=/tmp/exp_report.json \
  --counters=INSTRUCTIONS \
  --counters=CYCLES \

  --output=/tmp/summary.csv