aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2024-04-29 10:21:00 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-05-06 14:44:08 +0000
commit57b62940f14668b907acb31eebf0fe508d75c3ed (patch)
tree5af4ec59a9c11fe24cff5c08bd26ca8a5f96eaf8
parentc3f2c3036162bb13be972720a0cb09a94494cfd5 (diff)
downloadtoolchain-utils-57b62940f14668b907acb31eebf0fe508d75c3ed.tar.gz
remove update_telemetry_defaults
This script seems to update telemetry benchmarking defaults, specifically when used with crosperf. Since crosperf is gone, this script has no obvious use. BUG=b:337837895 TEST=None Change-Id: If461a2322a1610fb979347a7b2dbbe4a7a0388ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5496648 Tested-by: George Burgess <gbiv@chromium.org> Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: Bob Haarman <inglorion@chromium.org>
l---------py/bin/update_telemetry_defaults.py1
-rw-r--r--update_telemetry_defaults.py201
2 files changed, 0 insertions, 202 deletions
diff --git a/py/bin/update_telemetry_defaults.py b/py/bin/update_telemetry_defaults.py
deleted file mode 120000
index 63d45c29..00000000
--- a/py/bin/update_telemetry_defaults.py
+++ /dev/null
@@ -1 +0,0 @@
-../../python_wrapper.py \ No newline at end of file
diff --git a/update_telemetry_defaults.py b/update_telemetry_defaults.py
deleted file mode 100644
index 34b157e3..00000000
--- a/update_telemetry_defaults.py
+++ /dev/null
@@ -1,201 +0,0 @@
-# Copyright 2020 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Script to maintain the Telemetry benchmark default results file.
-
-This script allows the user to see and update the set of default
-results to be used in generating reports from running the Telemetry
-benchmarks.
-"""
-
-
-__author__ = "cmtice@google.com (Caroline Tice)"
-
-import json
-import os
-import sys
-
-from cros_utils import misc
-
-
-Defaults = {}
-
-
-class TelemetryDefaults(object):
- """Class for handling telemetry default return result fields."""
-
- DEFAULTS_FILE_NAME = "crosperf/default-telemetry-results.json"
-
- def __init__(self):
- # Get the Crosperf directory; that is where the defaults
- # file should be.
- dirname, __ = misc.GetRoot(__file__)
- fullname = os.path.join(dirname, self.DEFAULTS_FILE_NAME)
- self._filename = fullname
- self._defaults = {}
-
- def ReadDefaultsFile(self):
- if os.path.exists(self._filename):
- with open(self._filename, "r", encoding="utf-8") as fp:
- self._defaults = json.load(fp)
-
- def WriteDefaultsFile(self):
- with open(self._filename, "w", encoding="utf-8") as fp:
- json.dump(self._defaults, fp, indent=2)
-
- def ListCurrentDefaults(self, benchmark="all"):
- # Show user current defaults. By default, show all. The user
- # can specify the name of a particular benchmark to see only that
- # benchmark's default values.
- if len(self._defaults) == 0:
- print("The benchmark default results are currently empty.")
- if benchmark == "all":
- for b in self._defaults.keys():
- results = self._defaults[b]
- out_str = b + " : "
- for r in results:
- out_str += r + " "
- print(out_str)
- elif benchmark in self._defaults:
- results = self._defaults[benchmark]
- out_str = benchmark + " : "
- for r in results:
- out_str += r + " "
- print(out_str)
- else:
- print("Error: Unrecognized benchmark '%s'" % benchmark)
-
- def AddDefault(self, benchmark, result):
- if benchmark in self._defaults:
- resultList = self._defaults[benchmark]
- else:
- resultList = []
- resultList.append(result)
- self._defaults[benchmark] = resultList
- print("Updated results set for '%s': " % benchmark)
- print("%s : %s" % (benchmark, repr(self._defaults[benchmark])))
-
- def RemoveDefault(self, benchmark, result):
- if benchmark in self._defaults:
- resultList = self._defaults[benchmark]
- if result in resultList:
- resultList.remove(result)
- print("Updated results set for '%s': " % benchmark)
- print("%s : %s" % (benchmark, repr(self._defaults[benchmark])))
- else:
- print(
- "'%s' is not in '%s's default results list."
- % (result, benchmark)
- )
- else:
- print("Cannot find benchmark named '%s'" % benchmark)
-
- def GetDefault(self):
- return self._defaults
-
- def RemoveBenchmark(self, benchmark):
- if benchmark in self._defaults:
- del self._defaults[benchmark]
- print("Deleted benchmark '%s' from list of benchmarks." % benchmark)
- else:
- print("Cannot find benchmark named '%s'" % benchmark)
-
- def RenameBenchmark(self, old_name, new_name):
- if old_name in self._defaults:
- resultsList = self._defaults[old_name]
- del self._defaults[old_name]
- self._defaults[new_name] = resultsList
- print("Renamed '%s' to '%s'." % (old_name, new_name))
- else:
- print("Cannot find benchmark named '%s'" % old_name)
-
- def UsageError(self, user_input):
- # Print error message, then show options
- print("Error:Invalid user input: '%s'" % user_input)
- self.ShowOptions()
-
- def ShowOptions(self):
- print(
- """
-Below are the valid user options and their arguments, and an explanation
-of what each option does. You may either print out the full name of the
-option, or you may use the first letter of the option. Case (upper or
-lower) does not matter, for the command (case of the result name DOES matter):
-
- (L)ist - List all current defaults
- (L)ist <benchmark> - List current defaults for benchmark
- (H)elp - Show this information.
- (A)dd <benchmark> <result> - Add a default result for a particular
- benchmark (appends to benchmark's list
- of results, if list already exists)
- (D)elete <benchmark> <result> - Delete a default result for a
- particular benchmark
- (R)emove <benchmark> - Remove an entire benchmark (and its
- results)
- (M)ove <old-benchmark> <new-benchmark> - Rename a benchmark
- (Q)uit - Exit this program, saving changes.
- (T)erminate - Exit this program; abandon changes.
-
-"""
- )
-
- def GetUserInput(self):
- # Prompt user
- print("Enter option> ")
- # Process user input
- inp = sys.stdin.readline()
- inp = inp[:-1]
- # inp = inp.lower()
- words = inp.split(" ")
- option = words[0]
- option = option.lower()
- if option in ("h", "help"):
- self.ShowOptions()
- elif option in ("l", "list"):
- if len(words) == 1:
- self.ListCurrentDefaults()
- else:
- self.ListCurrentDefaults(benchmark=words[1])
- elif option in ("a", "add"):
- if len(words) < 3:
- self.UsageError(inp)
- else:
- benchmark = words[1]
- resultList = words[2:]
- for r in resultList:
- self.AddDefault(benchmark, r)
- elif option in ("d", "delete"):
- if len(words) != 3:
- self.UsageError(inp)
- else:
- benchmark = words[1]
- result = words[2]
- self.RemoveDefault(benchmark, result)
- elif option in ("r", "remove"):
- if len(words) != 2:
- self.UsageError(inp)
- else:
- benchmark = words[1]
- self.RemoveBenchmark(benchmark)
- elif option in ("m", "move"):
- if len(words) != 3:
- self.UsageError(inp)
- else:
- old_name = words[1]
- new_name = words[2]
- self.RenameBenchmark(old_name, new_name)
- elif option in ("q", "quit"):
- self.WriteDefaultsFile()
-
- return option in ("q", "quit", "t", "terminate")
-
-
-def Main():
- defaults = TelemetryDefaults()
- defaults.ReadDefaultsFile()
- defaults.ShowOptions()
- done = defaults.GetUserInput()
- while not done:
- done = defaults.GetUserInput()
- return 0