On Wed, Jul 1, 2020 at 3:41 PM Eric Blake <ebl...@redhat.com> wrote: > > On 7/1/20 8:04 AM, Ahmed Karaman wrote: > > Python script that dissects QEMU execution into three main phases: > > code generation, JIT execution and helpers execution. > > > > Syntax: > > dissect.py [-h] -- <qemu executable> [<qemu executable options>] \ > > <target executable> [<target executable options>] > > > > [-h] - Print the script arguments help message. > > > > Example of usage: > > dissect.py -- qemu-arm coulomb_double-arm > > Given the example usage... > > > > > Example output: > > Total Instructions: 4,702,865,362 > > > > Code Generation: 115,819,309 2.463% > > JIT Execution: 1,081,980,528 23.007% > > Helpers: 3,505,065,525 74.530% > > > > Signed-off-by: Ahmed Karaman <ahmedkhaledkara...@gmail.com> > > --- > > scripts/performance/dissect.py | 165 +++++++++++++++++++++++++++++++++ > > 1 file changed, 165 insertions(+) > > create mode 100644 scripts/performance/dissect.py > > > > diff --git a/scripts/performance/dissect.py b/scripts/performance/dissect.py > > new file mode 100644 > > ...this should have the executable bit set. Thanks Mr. Eric, I don't know why I always forget doing this before sending the patch. Will do it in V2. > > > > +def get_JIT_line(callgrind_data): > > + """ > > + Search for the first instance of the JIT call in > > + the callgrind_annoutate output when ran using --tree=caller > > annotate Thanks.
> > > + This is equivalent to the self number of instructions of JIT. > > + > > + Parameters: > > + callgrind_data (list): callgrind_annotate output > > + > > + Returns: > > + (int): Line number > > + """ > > + line = -1 > > + for i in range(len(callgrind_data)): > > + if callgrind_data[i].strip('\n') and \ > > + callgrind_data[i].split()[-1] == "[???]": > > + line = i > > + break > > + if line == -1: > > + sys.exit("Couldn't locate the JIT call ... Exiting!") > > We tend to avoid ! at the end of error messages (it can come across as > shouting at the user). Yeah right, Will remove the exclamations. > > > + return line > > + > > + > > +def main(): > > + # Parse the command line arguments > > + parser = argparse.ArgumentParser( > > + usage='dissect.py [-h] -- ' > > + '<qemu executable> [<qemu executable options>] ' > > + '<target executable> [<target executable options>]') > > + > > + parser.add_argument('command', type=str, nargs='+', > > help=argparse.SUPPRESS) > > + > > + args = parser.parse_args() > > + > > + # Extract the needed variables from the args > > + command = args.command > > + > > + # Insure that valgrind is installed > > + check_valgrind = subprocess.run( > > + ["which", "valgrind"], stdout=subprocess.DEVNULL) > > + if check_valgrind.returncode: > > + sys.exit("Please install valgrind before running the script!") > > and again Noted. > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. +1-919-301-3226 > Virtualization: qemu.org | libvirt.org > Thanks for your feedback Mr. Eric. Best regards, Ahmed Karaman