[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 09/13] Adding info [tb-list|tb] commands to HMP (WIP)
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH v9 09/13] Adding info [tb-list|tb] commands to HMP (WIP) |
Date: |
Wed, 9 Oct 2019 10:44:07 +0100 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
* Alex Bennée (address@hidden) wrote:
> From: "Vanderson M. do Rosario" <address@hidden>
>
> 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 corresponding QMP
> command is not worthwhile.
>
> [AJB: WIP - we still can't be safely sure a translation will succeed]
>
<snip>
> diff --git a/util/log.c b/util/log.c
> index 86bd691967..fa78e2bca9 100644
> --- a/util/log.c
> +++ b/util/log.c
> @@ -33,25 +33,55 @@ int qemu_loglevel;
> static int log_append = 0;
> static GArray *debug_regions;
> int32_t max_num_hot_tbs_to_dump;
> +static bool to_monitor;
> +bool to_string;
>
> -/* Return the number of characters emitted. */
> -int qemu_log(const char *fmt, ...)
> +GString *string;
> +
> +int qemu_vlog(const char *fmt, va_list va)
> {
> int ret = 0;
> - if (qemu_logfile) {
> - va_list ap;
> - va_start(ap, fmt);
> - ret = vfprintf(qemu_logfile, fmt, ap);
> - va_end(ap);
> -
> - /* Don't pass back error results. */
> - if (ret < 0) {
> - ret = 0;
> + if (to_string) {
> + if (string) {
> + g_string_append_vprintf(string, fmt, va);
> }
> + } else if (to_monitor) {
> + ret = qemu_vprintf(fmt, va);
> + } else if (qemu_logfile) {
> + ret = vfprintf(qemu_logfile, fmt, va);
> + }
> +
> + /* Don't pass back error results. */
> + if (ret < 0) {
> + ret = 0;
> }
> return ret;
> }
>
> +/* Return the number of characters emitted. */
> +int qemu_log(const char *fmt, ...)
> +{
> + int ret = 0;
> + va_list ap;
> + va_start(ap, fmt);
> +
> + ret = qemu_vlog(fmt, ap);
> +
> + va_end(ap);
> + return ret;
> +}
> +
> +void qemu_log_to_monitor(bool enable)
> +{
> + to_monitor = enable;
> +}
> +
> +void qemu_log_to_string(bool enable, GString *s)
> +{
> + to_string = enable;
> + string = s;
> +}
> +
> static bool log_uses_own_buffers;
These feel like they should be in a separate patch.
Dave
>
> /* enable or disable low levels log */
> @@ -300,6 +330,7 @@ int qemu_str_to_log_mask(const char *str)
> trace_enable_events((*tmp) + 6);
> mask |= LOG_TRACE;
> #endif
> +#ifdef CONFIG_TCG
> } else if (g_str_has_prefix(*tmp, "tb_stats")) {
> mask |= CPU_LOG_TB_STATS;
> set_default_tbstats_flag(TB_JIT_STATS | TB_EXEC_STATS |
> TB_JIT_TIME);
> @@ -329,6 +360,7 @@ int qemu_str_to_log_mask(const char *str)
> }
> set_default_tbstats_flag(flags);
> }
> +#endif
> } else {
> for (item = qemu_log_items; item->mask != 0; item++) {
> if (g_str_equal(*tmp, item->name)) {
> --
> 2.20.1
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK
- Re: [PATCH v9 10/13] tb-stats: dump hot TBs at the end of the execution, (continued)
- [PATCH v9 05/13] accel: adding TB_JIT_TIME and full replacing CONFIG_PROFILER, Alex Bennée, 2019/10/07
- [PATCH v9 12/13] tb-stats: adding TBStatistics info into perf dump, Alex Bennée, 2019/10/07
- [PATCH v9 13/13] configure: remove the final bits of --profiler support, Alex Bennée, 2019/10/07
- [PATCH v9 09/13] Adding info [tb-list|tb] commands to HMP (WIP), Alex Bennée, 2019/10/07
- [PATCH v9 11/13] accel/tcg: adding integration with linux perf, Alex Bennée, 2019/10/07
- Re: [PATCH v9 00/13] TCG code quality tracking and perf integration, no-reply, 2019/10/07
- Re: [PATCH v9 00/13] TCG code quality tracking and perf integration, no-reply, 2019/10/07