mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-19 12:24:32 +00:00
42539bbe0d
Changing the way target descriptions work from a static mapping to something that is dynamically generated and is extensible via plugins. Also moving core target implementation stuff under "framework".
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
from wlauto.core.configuration.configuration import MetaConfiguration, RunConfiguration
|
|
from wlauto.core.configuration.plugin_cache import PluginCache
|
|
from wlauto.utils.serializer import yaml
|
|
from wlauto.utils.doc import strip_inlined_text
|
|
|
|
DEFAULT_INSTRUMENTS = ['execution_time',
|
|
'interrupts',
|
|
'cpufreq',
|
|
'status',
|
|
'standard',
|
|
'csv']
|
|
|
|
|
|
def _format_yaml_comment(param, short_description=False):
|
|
comment = param.description
|
|
comment = strip_inlined_text(comment)
|
|
if short_description:
|
|
comment = comment.split('\n\n')[0]
|
|
comment = comment.replace('\n', '\n# ')
|
|
comment = "# {}\n".format(comment)
|
|
return comment
|
|
|
|
|
|
def _format_instruments(output):
|
|
plugin_cache = PluginCache()
|
|
output.write("instrumentation:\n")
|
|
for plugin in DEFAULT_INSTRUMENTS:
|
|
plugin_cls = plugin_cache.loader.get_plugin_class(plugin)
|
|
output.writelines(_format_yaml_comment(plugin_cls, short_description=True))
|
|
output.write(" - {}\n".format(plugin))
|
|
output.write("\n")
|
|
|
|
|
|
def generate_default_config(path):
|
|
with open(path, 'w') as output:
|
|
for param in MetaConfiguration.config_points + RunConfiguration.config_points:
|
|
entry = {param.name: param.default}
|
|
comment = _format_yaml_comment(param)
|
|
output.writelines(comment)
|
|
yaml.dump(entry, output, default_flow_style=False)
|
|
output.write("\n")
|
|
_format_instruments(output)
|