mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 02:24:38 +00:00
contrib/plugins/hotblocks: Allow limit to be set as a command line argument
Also add documentation for this argument. This allows the default of 20 to be overridden, and is helpful for using the hotblocks plugin for analysis scripts that require collecting data on a larger number of blocks (e.g. setting limit=0 to dump information on all blocks). Signed-off-by: Alex Bradbury <asb@igalia.com> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Link: https://lore.kernel.org/qemu-devel/58281d6e54bcad1802e8d3dc8d8501d54c2a971e.1753857212.git.asb@igalia.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
This commit is contained in:
committed by
Pierrick Bouvier
parent
e4ed74c9ae
commit
0a9754525c
@@ -84,7 +84,8 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
|
||||
if (sorted_counts) {
|
||||
g_string_append_printf(report, "pc, tcount, icount, ecount\n");
|
||||
|
||||
for (i = 0, it = sorted_counts; i < limit && it; i++, it = it->next) {
|
||||
for (i = 0, it = sorted_counts; (limit == 0 || i < limit) && it;
|
||||
i++, it = it->next) {
|
||||
ExecCount *rec = (ExecCount *) it->data;
|
||||
g_string_append_printf(
|
||||
report, "0x%016"PRIx64", %d, %ld, %"PRIu64"\n",
|
||||
@@ -170,6 +171,13 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
|
||||
fprintf(stderr, "boolean argument parsing failed: %s\n", opt);
|
||||
return -1;
|
||||
}
|
||||
} else if (g_strcmp0(tokens[0], "limit") == 0) {
|
||||
char *endptr = NULL;
|
||||
limit = g_ascii_strtoull(tokens[1], &endptr, 10);
|
||||
if (endptr == tokens[1] || *endptr != '\0') {
|
||||
fprintf(stderr, "unsigned integer parsing failed: %s\n", opt);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "option parsing failed: %s\n", opt);
|
||||
return -1;
|
||||
|
||||
@@ -473,6 +473,8 @@ Behaviour can be tweaked with the following arguments:
|
||||
- Description
|
||||
* - inline=true|false
|
||||
- Use faster inline addition of a single counter.
|
||||
* - limit=N
|
||||
- The number of blocks to be printed. (Default: N = 20, use 0 for no limit).
|
||||
|
||||
Hot Pages
|
||||
.........
|
||||
|
||||
Reference in New Issue
Block a user