# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os import subprocess import sys
def start_from_config(config_file=None, debug=False, **kwargs): """start from a YAML config file"""
# required options and associated error messages
required = { "xperf_path": "xperf_path not given", "xperf_providers": "No xperf providers given", "xperf_user_providers": "No xperf user providers given", "xperf_stackwalk": "No xperf stackwalk options given", "etl_filename": "No etl_filename given",
} for key in required: if key notin kwargs:
kwargs[key] = None
if config_file: # override options from YAML config file
kwargs = xtalos.options_from_config(kwargs, config_file)
# ensure the required options are given for key, msg in required.items(): ifnot kwargs.get(key): raise xtalos.XTalosError(msg)
# ensure path to xperf actually exists ifnot os.path.exists(kwargs["xperf_path"]): raise xtalos.XTalosError( "ERROR: xperf_path '%s' does not exist" % kwargs["xperf_path"]
)
# make calling arguments
args = dict([(key, kwargs[key]) for key in required.keys()])
args["debug"] = debug
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.