[Qemu-devel] [Qemu-Devel][PATCH 2/3] Saving counters between tb_flush events.

2019-06-14 Thread vandersonmr
A new hash map was added to store the accumulated execution frequency of the TBs even after tb_flush events. A dump function was also added as a way to visualize these frequencies. Signed-off-by: vandersonmr --- accel/tcg/translate-all.c | 59 +++ accel/tcg

[Qemu-devel] [PATCH 0/3] Collecting TB Execution Frequency

2019-06-14 Thread vandersonmr
This is the first series of patches related to the TCGCodeQuality GSoC project More at https://wiki.qemu.org/Features/TCGCodeQuality It adds an option to instrument TBs and collects their execution frequency. The execution frequency is then store/accumulated in an auxiliary structure every time

[Qemu-devel] [Qemu-Devel][PATCH 3/3] Adding command line option to linux-user.

2019-06-14 Thread vandersonmr
Added -execfreq to enable execution frequency counting and dump all the TB's addresses and their execution frequency at the end of the execution. Signed-off-by: vandersonmr --- linux-user/exit.c | 5 + linux-user/main.c | 7 +++ 2 files changed, 12 insertions(+) diff --git a/linux-user

[Qemu-devel] [Qemu-Devel][PATCH 1/3] Adding an optional tb execution counter.

2019-06-14 Thread vandersonmr
An uint64_t counter was added in the TranslationBlock struct and it is incremented every time that the TB is executed. Signed-off-by: vandersonmr --- accel/tcg/tcg-runtime.c | 6 ++ accel/tcg/tcg-runtime.h | 2 ++ include/exec/exec-all.h | 1 + include/exec/gen-icount.h | 7

[Qemu-devel] [PATCH v2 0/4] dumping hot TBs

2019-06-23 Thread vandersonmr
It adds a new structure which is linked with each TBs and stores its statistics. We collect the execution count of the TBs and store in this new structure. The information stored in this new struct is then used to support a new command line -d hot_tbs:N which dumps information of the N most hot

[Qemu-devel] [PATCH v2 1/4] add and link a statistic struct to TBs

2019-06-23 Thread vandersonmr
We want to store statistics for each TB even after flushes. We do not want to modify or grow the TB struct. So we create a new struct to contain this statistics and link it to each TB while they are created. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/translate-all.c | 40

[Qemu-devel] [PATCH v2 4/4] adding -d hot_tbs:limit command line option

2019-06-24 Thread vandersonmr
add option to dump the N most hot TB blocks. -d hot_tbs:N Signed-off-by: vandersonmr --- include/qemu/log-for-trace.h | 2 ++ linux-user/exit.c| 3 +++ util/log.c | 9 + 3 files changed, 14 insertions(+) diff --git a/include/qemu/log-for-trace.h b/include

[Qemu-devel] [PATCH v2 3/4] Introduce dump of hot TBs

2019-06-23 Thread vandersonmr
Adding a function to dump the Nth hottest TBs. The block PC, execution count and ops is dump to the log. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/translate-all.c | 45 +++ include/exec/exec-all.h | 2 ++ 2 files changed, 47 insertions(+) diff

[Qemu-devel] [PATCH v2 2/4] Adding an optional tb execution counter.

2019-06-23 Thread vandersonmr
We collect the number of times each TB is executed and store it in the its TBStatistics. We also count the number of times the execution counter overflows. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tcg-runtime.c | 10 ++ accel/tcg/tcg-runtime.h | 2 ++

[Qemu-devel] [PATCH v3 4/6] util/log: introduce dump of tbstats and -d hot_tbs:limit

2019-07-02 Thread vandersonmr
add option to dump the N most hot TB blocks. -d hot_tbs:N and also add all tbstats dump functions. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/Makefile.objs | 1 + accel/tcg/tb-stats.c | 293 +++ include/exec/cpu-all.h | 43 +

[Qemu-devel] [PATCH v3 3/6] accel/tcg: Collecting translation/code quality measurements

2019-07-02 Thread vandersonmr
Filling other tb statistics such as number of times the tb is compiled, its number of guest/host/IR instructions... Signed-off-by: vandersonmr --- accel/tcg/translate-all.c | 14 + accel/tcg/translator.c| 4 ++ disas.c | 107

[Qemu-devel] [PATCH v3 1/6] accel/tcg: adding structure to store TB statistics

2019-07-02 Thread vandersonmr
We want to store statistics for each TB even after flushes. We do not want to modify or grow the TB struct. So we create a new struct to contain this statistics and we link one of it to each TB as they are generated. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/translate-all.c | 60

[Qemu-devel] [PATCH v3 2/6] accel/tcg: Adding an optional tb execution counter

2019-07-02 Thread vandersonmr
We add the option to instrument each TB to count the number of times it is executed and store this in the its TBStatistics struct. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tcg-runtime.c | 7 +++ accel/tcg/tcg-runtime.h | 2 ++ accel/tcg/translator.c| 1 +

[Qemu-devel] [PATCH v3 6/6] monitor: adding start_stats to monitor

2019-07-02 Thread vandersonmr
adding the option to start collecting the tb statistics later using the start_stats command. Signed-off-by: vandersonmr --- hmp-commands.hx | 15 +++ monitor/misc.c | 15 +++ 2 files changed, 30 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index

[Qemu-devel] [PATCH v3 5/6] monitor: adding info tb and tbs to monitor

2019-07-02 Thread vandersonmr
adding options to list tbs by some metric and investigate their code. Signed-off-by: Vanderson M. do Rosario --- hmp-commands-info.hx | 22 ++ monitor/misc.c | 69 2 files changed, 91 insertions(+) diff --git a/hmp-commands-info.hx

[Qemu-devel] [PATCH v1 2/2] tb-stats: adding TBStatistics info into perf dump

2019-08-14 Thread vandersonmr
Adding TBStatistics information to linux perf TB's symbol names. This commit depends on the following PATCH: [PATCH v5 00/10] Measure Tiny Code Generation Quality Signed-off-by: Vanderson M. do Rosario --- accel/tcg/perf/jitdump.c | 15 ++- 1 file changed, 14 insertions(+), 1

[Qemu-devel] [PATCH v5 01/10] accel: introducing TBStatistics structure

2019-08-14 Thread vandersonmr
To store statistics for each TB, we created a TBStatistics structure which is linked with the TBs. TBStatistics can stay alive after tb_flush and be relinked to a regenerated TB. So the statistics can be accumulated even through flushes. The goal is to have all present and future qemu/tcg

[Qemu-devel] [PATCH v5 10/10] linux-user: dumping hot TBs at the end of the execution

2019-08-14 Thread vandersonmr
dumps, in linux-user mode, the hottest TBs if -d tb_stats is used. Signed-off-by: Vanderson M. do Rosario --- linux-user/exit.c | 4 1 file changed, 4 insertions(+) diff --git a/linux-user/exit.c b/linux-user/exit.c index bdda720553..7226104959 100644 --- a/linux-user/exit.c +++

[Qemu-devel] [PATCH v5 08/10] Adding info [tbs|tb|coverset] commands to HMP. These commands allow the exploration of TBs generated by the TCG. Understand which one hotter, with more guest/host instruc

2019-08-14 Thread vandersonmr
The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for now, a corresponding QMP command is not worthwhile. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tb-stats.c | 398 ++-

[Qemu-devel] [PATCH v5 04/10] accel: replacing part of CONFIG_PROFILER with TBStats

2019-08-14 Thread vandersonmr
We add some of the statistics collected in the TCGProfiler into the TBStats, having the statistics not only for the whole emulation but for each TB. Then, we removed these stats from TCGProfiler and reconstruct the information for the "info jit" using the sum of all TBStats statistics. The goal

[Qemu-devel] [PATCH v5 00/10] Measure Tiny Code Generation Quality

2019-08-14 Thread vandersonmr
while emulating. Collecting these statistics and information is useful to understand qemu performance and to help to add the support for traces to QEMU. v5: - full replacement of CONFIG_PROFILER - several fixes - adds "info cfg" - adds TB's targets to dump vandersonmr (10

[Qemu-devel] [PATCH v5 02/10] accel: collecting TB execution count

2019-08-14 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_EXEC_STATS enabled, then we instrument the start code of this TB to atomically count the number of times it is executed. We count both the number of "normal" executions and atomic executions of a TB. The execution count of the TB is stored in its

[Qemu-devel] [PATCH v5 07/10] monitor: adding tb_stats hmp command

2019-08-14 Thread vandersonmr
Adding tb_stats [start|pause|stop|filter] command to hmp. This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is

[Qemu-devel] [PATCH v5 09/10] monitor: adding new info cfg command

2019-08-14 Thread vandersonmr
Adding "info cfg id depth" commands to HMP. This command allow the exploration a TB neighbors by dumping [and opening] a .dot file with the TB CFG neighbors colorized by their hotness. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for

[Qemu-devel] [PATCH v5 06/10] log: adding -d tb_stats to control tbstats

2019-08-14 Thread vandersonmr
Adding -d tb_stats to control TBStatistics collection: -d tb_stats[[,level=(+all+jit+exec+time)][,dump_limit=]] "dump_limit" is used to limit the number of dumped TBStats in linux-user mode. [all+jit+exec+time] control the profilling level used by the TBStats. Can be used as follow: -d

[Qemu-devel] [PATCH v5 05/10] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER

2019-08-14 Thread vandersonmr
Replace all others CONFIG_PROFILER statistics and migrate it to TBStatistics system. However, TCGProfiler still exists and can be use to store global statistics and times. All TB related statistics goes to TBStatistics. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tb-stats.c | 95

[Qemu-devel] [PATCH v1 0/2] Integrating qemu to Linux Perf

2019-08-14 Thread vandersonmr
to analyze and dump JITed code with perf. Example of use: perf record -k 1 qemu-x86_64 -perf ./a.out perf inject -j -i perf.data -o perf.data.jitted perf report -i perf.data.jitted vandersonmr (2): accel/tcg: adding integration with linux perf tb-stats: adding TBStatistics info into perf dump

[Qemu-devel] [PATCH v5 03/10] accel: collecting JIT statistics

2019-08-14 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_JIT_STATS enabled then we collect statistics of its translation processes and code translation. Collecting the number of host instructions seems to be not simple as it would imply in having to modify several target source files. So, for now, we are

[Qemu-devel] [PATCH v1 1/2] accel/tcg: adding integration with linux perf

2019-08-14 Thread vandersonmr
This commit adds support to Linux Perf in order to be able to analyze qemu jitted code and also to able to see the TBs PC in it. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/Makefile.objs | 1 + accel/tcg/perf/Makefile.objs | 1 + accel/tcg/perf/jitdump.c | 180

[Qemu-devel] [PATCH v6 08/10] Adding info [tb-list|tb|coverset] commands to HMP.

2019-08-21 Thread vandersonmr
These commands allow the exploration of TBs generated by the TCG. Understand which one hotter, with more guest/host instructions... and examine their guest, host and IR code. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for now, a

[Qemu-devel] [PATCH v6 09/10] monitor: adding new info cfg command

2019-08-21 Thread vandersonmr
Adding "info cfg id depth" commands to HMP. This command allow the exploration a TB neighbors by dumping [and opening] a .dot file with the TB CFG neighbors colorized by their hotness. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for

[Qemu-devel] [PATCH v6 04/10] accel: replacing part of CONFIG_PROFILER with TBStats

2019-08-21 Thread vandersonmr
Signed-off-by: vandersonmr --- accel/tcg/tb-stats.c | 96 +++ accel/tcg/translate-all.c | 8 +--- include/exec/tb-stats.h | 11 + tcg/tcg.c | 93 - tcg/tcg.h | 10 5 files ch

[Qemu-devel] [PATCH v6 02/10] accel: collecting TB execution count

2019-08-21 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_EXEC_STATS enabled, then we instrument the start code of this TB to atomically count the number of times it is executed. We count both the number of "normal" executions and atomic executions of a TB. The execution count of the TB is stored in its

[Qemu-devel] [PATCH v6 01/10] accel: introducing TBStatistics structure

2019-08-21 Thread vandersonmr
To store statistics for each TB, we created a TBStatistics structure which is linked with the TBs. TBStatistics can stay alive after tb_flush and be relinked to a regenerated TB. So the statistics can be accumulated even through flushes. The goal is to have all present and future qemu/tcg

[Qemu-devel] [PATCH v6 00/10] Measure Tiny Code Generation Quality

2019-08-21 Thread vandersonmr
time" calculation v5: - full replacement of CONFIG_PROFILER - several fixes - adds "info cfg" - adds TB's targets to dump vandersonmr (10): accel: introducing TBStatistics structure accel: collecting TB execution count accel: collecting JIT statistics accel: replacing par

[Qemu-devel] [PATCH v6 03/10] accel: collecting JIT statistics

2019-08-21 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_JIT_STATS enabled then we collect statistics of its translation processes and code translation. Collecting the number of host instructions seems to be not simple as it would imply in having to modify several target source files. So, for now, we are

[Qemu-devel] [PATCH v6 05/10] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER

2019-08-21 Thread vandersonmr
Replace all others CONFIG_PROFILER statistics and migrate it to TBStatistics system. However, TCGProfiler still exists and can be use to store global statistics and times. All TB related statistics goes to TBStatistics. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tb-stats.c | 91

[Qemu-devel] [PATCH v6 07/10] monitor: adding tb_stats hmp command

2019-08-21 Thread vandersonmr
Adding tb_stats [start|pause|stop|filter] command to hmp. This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is

[Qemu-devel] [PATCH v6 06/10] log: adding -d tb_stats to control tbstats

2019-08-21 Thread vandersonmr
Adding -d tb_stats to control TBStatistics collection: -d tb_stats[[,level=(+all+jit+exec+time)][,dump_limit=]] "dump_limit" is used to limit the number of dumped TBStats in linux-user mode. [all+jit+exec+time] control the profilling level used by the TBStats. Can be used as follow: -d

[Qemu-devel] [PATCH v6 10/10] linux-user: dumping hot TBs at the end of the execution

2019-08-21 Thread vandersonmr
| exec:872032/0 guest inst cov:1.97% | trans:1 ints: g:2 op:56 op_opt:26 spills:1 | h/g (host bytes / guest insts): 68.00 | time to gen at 2.4GHz => code:1692.08(ns) IR:473.75(ns) | targets: 0x000ec1c5 (id:4), 0x000ec1cb (id:13) Signed-off-by: va

[Qemu-devel] [PATCH v2 0/2] Integrating qemu to Linux Perf

2019-08-30 Thread vandersonmr
to analyze and dump JITed code with perf. Example of use: perf record -k 1 qemu-x86_64 -perf ./a.out perf inject -j -i perf.data -o perf.data.jitted perf report -i perf.data.jitted vandersonmr (2): accel/tcg: adding integration with linux perf tb-stats: adding TBStatistics info into perf dump

[Qemu-devel] [PATCH v2 1/2] accel/tcg: adding integration with linux perf

2019-08-30 Thread vandersonmr
This commit adds support to Linux Perf in order to be able to analyze qemu jitted code and also to able to see the TBs PC in it. When using "-perf" qemu creates a jitdump file in the current working directory. The file format specification can be found in:

[Qemu-devel] [PATCH v2 2/2] tb-stats: adding TBStatistics info into perf dump

2019-08-30 Thread vandersonmr
Adding TBStatistics information to linux perf TB's symbol names. This commit depends on the following PATCH: [PATCH v5 00/10] Measure Tiny Code Generation Quality Signed-off-by: Vanderson M. do Rosario --- accel/tcg/perf/jitdump.c | 16 +++- 1 file changed, 15 insertions(+), 1

[Qemu-devel] [PATCH v8 01/11] accel: introducing TBStatistics structure

2019-08-29 Thread vandersonmr
To store statistics for each TB, we created a TBStatistics structure which is linked with the TBs. TBStatistics can stay alive after tb_flush and be relinked to a regenerated TB. So the statistics can be accumulated even through flushes. The goal is to have all present and future qemu/tcg

[Qemu-devel] [PATCH v8 00/11] Measure Tiny Code Generation Quality

2019-08-29 Thread vandersonmr
. - change info tbs to info tb-list - fix crash when dumping tb's targets - fix "liveness/code time" calculation v5: - full replacement of CONFIG_PROFILER - several fixes - adds "info cfg" - adds TB's targets to dump vandersonmr (11): accel: introducing TBStatisti

[Qemu-devel] [PATCH v8 04/11] accel: replacing part of CONFIG_PROFILER with TBStats

2019-08-29 Thread vandersonmr
We add some of the statistics collected in the TCGProfiler into the TBStats, having the statistics not only for the whole emulation but for each TB. Then, we removed these stats from TCGProfiler and reconstruct the information for the "info jit" using the sum of all TBStats statistics. The goal

[Qemu-devel] [PATCH v8 03/11] accel: collecting JIT statistics

2019-08-29 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_JIT_STATS enabled then we collect statistics of its translation processes and code translation. Collecting the number of host instructions seems to be not simple as it would imply in having to modify several target source files. So, for now, we are

[Qemu-devel] [PATCH v8 09/11] Adding info [tb-list|tb|coverset] commands to HMP.

2019-08-29 Thread vandersonmr
These commands allow the exploration of TBs generated by the TCG. Understand which one hotter, with more guest/host instructions... and examine their guest, host and IR code. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for now, a

[Qemu-devel] [PATCH v8 08/11] Adding tb_stats [start|pause|stop|filter] command to hmp.

2019-08-29 Thread vandersonmr
This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is to allow the dynamic exploration of the TCG behavior and

[Qemu-devel] [PATCH v7 00/10] Measure Tiny Code Generation Quality

2019-08-29 Thread vandersonmr
- fix crash when dumping tb's targets - fix "liveness/code time" calculation v5: - full replacement of CONFIG_PROFILER - several fixes - adds "info cfg" - adds TB's targets to dump vandersonmr (10): accel: collecting TB execution count accel: collecting JIT statistic

[Qemu-devel] [PATCH v7 01/10] accel: collecting TB execution count

2019-08-29 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_EXEC_STATS enabled, then we instrument the start code of this TB to atomically count the number of times it is executed. We count both the number of "normal" executions and atomic executions of a TB. The execution count of the TB is stored in its

[Qemu-devel] [PATCH v7 04/10] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER

2019-08-29 Thread vandersonmr
Replace all others CONFIG_PROFILER statistics and migrate it to TBStatistics system. However, TCGProfiler still exists and can be use to store global statistics and times. All TB related statistics goes to TBStatistics. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tb-stats.c | 91

[Qemu-devel] [PATCH v8 05/11] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER

2019-08-29 Thread vandersonmr
Replace all others CONFIG_PROFILER statistics and migrate it to TBStatistics system. However, TCGProfiler still exists and can be use to store global statistics and times. All TB related statistics goes to TBStatistics. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tb-stats.c | 91

[Qemu-devel] [PATCH v8 07/11] monitor: adding tb_stats hmp command

2019-08-29 Thread vandersonmr
Adding tb_stats [start|pause|stop|filter] command to hmp. This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is

[Qemu-devel] [PATCH v8 10/11] monitor: adding new info cfg command

2019-08-29 Thread vandersonmr
Adding "info cfg id depth" commands to HMP. This command allow the exploration a TB neighbors by dumping [and opening] a .dot file with the TB CFG neighbors colorized by their hotness. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for

[Qemu-devel] [PATCH v7 03/10] accel: replacing part of CONFIG_PROFILER with TBStats

2019-08-29 Thread vandersonmr
We add some of the statistics collected in the TCGProfiler into the TBStats, having the statistics not only for the whole emulation but for each TB. Then, we removed these stats from TCGProfiler and reconstruct the information for the "info jit" using the sum of all TBStats statistics. The goal

[Qemu-devel] [PATCH v7 02/10] accel: collecting JIT statistics

2019-08-29 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_JIT_STATS enabled then we collect statistics of its translation processes and code translation. Collecting the number of host instructions seems to be not simple as it would imply in having to modify several target source files. So, for now, we are

[Qemu-devel] [PATCH v7 07/10] Adding tb_stats [start|pause|stop|filter] command to hmp.

2019-08-29 Thread vandersonmr
This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is to allow the dynamic exploration of the TCG behavior and

[Qemu-devel] [PATCH v7 05/10] Adding -d tb_stats to control TBStatistics collection:

2019-08-29 Thread vandersonmr
-d tb_stats[[,level=(+all+jit+exec+time)][,dump_limit=]] "dump_limit" is used to limit the number of dumped TBStats in linux-user mode. [all+jit+exec+time] control the profilling level used by the TBStats. Can be used as follow: -d tb_stats -d tb_stats,level=jit+time -d tb_stats,dump_limit=15

[Qemu-devel] [PATCH v7 09/10] monitor: adding new info cfg command

2019-08-29 Thread vandersonmr
Adding "info cfg id depth" commands to HMP. This command allow the exploration a TB neighbors by dumping [and opening] a .dot file with the TB CFG neighbors colorized by their hotness. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for

[Qemu-devel] [PATCH v7 06/10] monitor: adding tb_stats hmp command

2019-08-29 Thread vandersonmr
Adding tb_stats [start|pause|stop|filter] command to hmp. This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. tb_stats filter allow to only collect statistics for the TB in the last_search list. The goal of this command is

[Qemu-devel] [PATCH v7 08/10] Adding info [tb-list|tb|coverset] commands to HMP.

2019-08-29 Thread vandersonmr
These commands allow the exploration of TBs generated by the TCG. Understand which one hotter, with more guest/host instructions... and examine their guest, host and IR code. The goal of this command is to allow the dynamic exploration of TCG behavior and code quality. Therefore, for now, a

[Qemu-devel] [PATCH v7 10/10] linux-user: dumping hot TBs at the end of the execution

2019-08-29 Thread vandersonmr
dumps, in linux-user mode, the hottest TBs if -d tb_stats is used. Example of output for the 3 hottest TBs: TB id:1 | phys:0x34d54 virt:0x00034d54 flags:0xf0 | exec:4828932/0 guest inst cov:16.38% | trans:1 ints: g:3 op:82 op_opt:34 spills:3 | h/g (host bytes

[Qemu-devel] [PATCH v8 06/11] Adding -d tb_stats to control TBStatistics collection:

2019-08-29 Thread vandersonmr
-d tb_stats[[,level=(+all+jit+exec+time)][,dump_limit=]] "dump_limit" is used to limit the number of dumped TBStats in linux-user mode. [all+jit+exec+time] control the profilling level used by the TBStats. Can be used as follow: -d tb_stats -d tb_stats,level=jit+time -d tb_stats,dump_limit=15

[Qemu-devel] [PATCH v8 11/11] linux-user: dumping hot TBs at the end of the execution

2019-08-29 Thread vandersonmr
dumps, in linux-user mode, the hottest TBs if -d tb_stats is used. Example of output for the 3 hottest TBs: TB id:1 | phys:0x34d54 virt:0x00034d54 flags:0xf0 | exec:4828932/0 guest inst cov:16.38% | trans:1 ints: g:3 op:82 op_opt:34 spills:3 | h/g (host bytes

[Qemu-devel] [PATCH v8 02/11] accel: collecting TB execution count

2019-08-29 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_EXEC_STATS enabled, then we instrument the start code of this TB to atomically count the number of times it is executed. We count both the number of "normal" executions and atomic executions of a TB. The execution count of the TB is stored in its

[Qemu-devel] [PATCH v4 1/7] accel: introducing TBStatistics structure

2019-07-19 Thread vandersonmr
To store statistics for each TB we created a TBStatistics structure which is linked with the TBs. The TBStatistics can stay alive after tb_flush and be relinked to a regenerated TB. So the statistics can be accumulated even through flushes. TBStatistics will be also referred to as TBS or tbstats.

[Qemu-devel] [PATCH v4 2/7] accel: collecting TB execution count

2019-07-19 Thread vandersonmr
If a TB has a TBS (TBStatistics) with the TB_EXEC_STATS enabled, then we instrument the start code of the TB to atomically count the number of times it is executed. The execution count of the TB is stored in its respective TBS. Signed-off-by: Vanderson M. do Rosario --- accel/tcg/tcg-runtime.c

[Qemu-devel] [PATCH v4 6/7] monitor: adding tb_stats hmp command

2019-07-19 Thread vandersonmr
Adding tb_stats [start|pause|stop|filter] command to hmp. This allows controlling the collection of statistics. It is also possible to set the level of collection: all, jit, or exec. The goal of this command is to allow the dynamic exploration of the TCG behavior and quality. Therefore, for now,

[Qemu-devel] [PATCH v4 4/7] accel: replacing part of CONFIG_PROFILER with TBStats

2019-07-19 Thread vandersonmr
We add some of the statistics collected in the TCGProfiler into the TBStats, having the statistics not only for the whole emulation but for each TB. Then, we removed these stats from TCGProfiler and reconstruct the information for the "info jit" using the sum of all TBStats statistics. The goal

[Qemu-devel] [PATCH v4 7/7] monitor: adding info tbs, tb, and coverset

2019-07-19 Thread vandersonmr
behavior and code quality. Therefore, for now, a corresponding QMP command is not worthwhile. Signed-off-by: vandersonmr --- accel/tcg/tb-stats.c | 275 +++ hmp-commands-info.hx | 23 +++ include/exec/tb-stats.h | 37 + include/qemu/log

[Qemu-devel] [PATCH v4 0/7] Measure Tiny Code Generation Quality

2019-07-19 Thread vandersonmr
while emulating. Collecting these statistics and information is useful to understand qemu performance and to help to add the support for traces to QEMU. vandersonmr (7): accel: introducing TBStatistics structure accel: collecting TB execution count accel: collecting JIT statistics accel

[Qemu-devel] [PATCH v4 3/7] accel: collecting JIT statistics

2019-07-19 Thread vandersonmr
(fake_fprintf) but counting the number of instructions. Signed-off-by: vandersonmr --- accel/tcg/translate-all.c | 18 +++ accel/tcg/translator.c| 5 ++ disas.c | 108 ++ include/disas/disas.h | 1 + include/exec/tb-stats.h | 14

[Qemu-devel] [PATCH v4 5/7] log: adding -d tb_stats to control tbstats

2019-07-19 Thread vandersonmr
Adding -d tb_stats:[limit:[all|jit|exec]] to control TBStatistics collection. "limit" is used to limit the number of TBStats in the linux-user dump. [all|jit|exec] control the profilling level used by the TBStats: all, only jit stats or only execution count stats. Signed-off-by: Vanderson M. do