aboutsummaryrefslogtreecommitdiff
path: root/scripts/kvm/kvm_flightrecorder
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-06-12 11:56:20 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-06-12 11:56:21 +0100
commit5eca450b2ec219c4256062bfb5498c726c1ed0a4 (patch)
tree63bbbeb6fe3e21017c07eced27ee5ba34dc2d550 /scripts/kvm/kvm_flightrecorder
parent6e3bd769916e643d371882da1bda5fbd453d3c3b (diff)
parentc7883412440905b41dde7e70f4af782932e80e90 (diff)
Merge remote-tracking branch 'remotes/ehabkost/tags/python-next-pull-request' into staging
Python queue, 2018-06-11 * Make code compatible with Python 3 using 'futurize --stage1' * Require Python >= 2.7 and remove Python 2.6 compatibility modules # gpg: Signature made Mon 11 Jun 2018 18:41:26 BST # gpg: using RSA key 2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/python-next-pull-request: python: Remove scripts/ordereddict.py python: Remove scripts/argparse.py configure: Require Python 2.7 or newer python: futurize -f lib2to3.fixes.fix_numliterals python: futurize -f lib2to3.fixes.fix_except python: futurize -f lib2to3.fixes.fix_renames python: futurize -f lib2to3.fixes.fix_tuple_params python: futurize -f lib2to3.fixes.fix_reduce python: futurize -f lib2to3.fixes.fix_standarderror python: futurize -f lib2to3.fixes.fix_has_key python: futurize -f libfuturize.fixes.fix_next_call python: futurize -f libfuturize.fixes.fix_absolute_import python: futurize -f libfuturize.fixes.fix_print_with_import Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/kvm/kvm_flightrecorder')
-rwxr-xr-xscripts/kvm/kvm_flightrecorder21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/kvm/kvm_flightrecorder b/scripts/kvm/kvm_flightrecorder
index 7fb1c2d1a7..54a56745e4 100755
--- a/scripts/kvm/kvm_flightrecorder
+++ b/scripts/kvm/kvm_flightrecorder
@@ -32,6 +32,7 @@
# consuming CPU cycles. No disk I/O is performed since the ring buffer holds a
# fixed-size in-memory trace.
+from __future__ import print_function
import sys
import os
@@ -77,8 +78,8 @@ def tail_trace():
pass
def usage():
- print 'Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0]
- print 'Control the KVM flight recorder tracing.'
+ print('Usage: %s start [buffer_size_kb] | stop | dump | tail' % sys.argv[0])
+ print('Control the KVM flight recorder tracing.')
sys.exit(0)
def main():
@@ -87,15 +88,15 @@ def main():
cmd = sys.argv[1]
if cmd == '--version':
- print 'kvm_flightrecorder version 1.0'
+ print('kvm_flightrecorder version 1.0')
sys.exit(0)
if not os.path.isdir(tracing_dir):
- print 'Unable to tracing debugfs directory, try:'
- print 'mount -t debugfs none /sys/kernel/debug'
+ print('Unable to tracing debugfs directory, try:')
+ print('mount -t debugfs none /sys/kernel/debug')
sys.exit(1)
if not os.access(tracing_dir, os.W_OK):
- print 'Unable to write to tracing debugfs directory, please run as root'
+ print('Unable to write to tracing debugfs directory, please run as root')
sys.exit(1)
if cmd == 'start':
@@ -105,16 +106,16 @@ def main():
try:
buffer_size_kb = int(sys.argv[2])
except ValueError:
- print 'Invalid per-cpu trace buffer size in KB'
+ print('Invalid per-cpu trace buffer size in KB')
sys.exit(1)
write_file(trace_path('buffer_size_kb'), str(buffer_size_kb))
- print 'Per-CPU ring buffer size set to %d KB' % buffer_size_kb
+ print('Per-CPU ring buffer size set to %d KB' % buffer_size_kb)
start_tracing()
- print 'KVM flight recorder enabled'
+ print('KVM flight recorder enabled')
elif cmd == 'stop':
stop_tracing()
- print 'KVM flight recorder disabled'
+ print('KVM flight recorder disabled')
elif cmd == 'dump':
dump_trace()
elif cmd == 'tail':