def create_if_supported(cls): executable = find_executable2("cpu-energy-meter") if executable is None: # not available on current system logging.debug( "Energy measurement not available because cpu-energy-meter binary could not be found." ) return None return cls(executable)
def __init__(self, show_warnings=False): self.reset_required = False self.show_warnings = show_warnings self.mon_process = None self.executable_path = find_executable2("pqos_wrapper") if self.executable_path is None: if self.show_warnings: logging.info( "Unable to find pqos_wrapper, please install it for " "cache allocation and monitoring if your CPU supports Intel RDT " "(cf. https://gitlab.com/sosy-lab/software/pqos-wrapper).")
def _find_file_relative(name): """ Find a file with the given name in the same directory as this script. Returns a path relative to the current directory, or None. """ main_dir = os.path.dirname(sys.argv[0]) search_dirs = [ main_dir, os.path.join(main_dir, os.path.pardir, "bin"), os.path.join(os.path.dirname(__file__), os.path.pardir), ] path = util.find_executable2(name, search_dirs) if not path: return None if os.path.dirname(path) in util.get_path(): # in PATH, just use command name return os.path.basename(path) path = os.path.relpath(path) if path == name: path = "./" + path # for easier copy and paste into a shell return path