Commit aa12f594 authored by Stefan Raspl's avatar Stefan Raspl Committed by Paolo Bonzini

tools/kvm_stat: sort '-f help' output

Sort the fields returned by specifying '-f help' on the command line.
While at it, simplify the code a bit, indent the output and eliminate an
extra blank line at the beginning.
Signed-off-by: default avatarStefan Raspl <raspl@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fae1a3e7
...@@ -1579,17 +1579,13 @@ def main(): ...@@ -1579,17 +1579,13 @@ def main():
stats = Stats(options) stats = Stats(options)
if options.fields == "help": if options.fields == 'help':
stats.fields_filter = None stats.fields_filter = None
event_list = "\n" event_list = []
s = stats.get() for key in stats.get().keys():
for key in s.keys(): event_list.append(key.split('(', 1)[0])
if key.find('(') != -1: sys.stdout.write(' ' + '\n '.join(sorted(set(event_list))) + '\n')
key = key[0:key.find('(')] sys.exit(0)
if event_list.find('\n' + key + '\n') == -1:
event_list += key + '\n'
sys.stdout.write(event_list)
return ""
if options.log: if options.log:
log(stats) log(stats)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment