qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-<pid>.ma


From: Kirill Batuzov
Subject: Re: [Qemu-devel] [RFC PATCH] tcg: add ability to dump /tmp/perf-<pid>.map files
Date: Fri, 28 Mar 2014 16:29:37 +0400 (MSK)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)


On Thu, 27 Mar 2014, address@hidden wrote:

> From: Alex Bennée <address@hidden>
> 
> This allows the perf tool to map samples to each individual translation
> block. This could be expanded for user space but currently it gives
> enough information to find any hotblocks by other means.

I'm in favor of this patch. Being able to profile guest code with perf
will be very helpful for developing and tweaking optimizations in tcg.

<snip>

> @@ -2575,6 +2579,8 @@ static inline int tcg_gen_code_common(TCGContext *s, 
> uint64_t target_pc,
>   the_end:
>      /* Generate TB finalization at the end of block */
>      tcg_out_tb_finalize(s);
> +
> +    tcg_write_perfmap(gen_code_buf, s->code_ptr - gen_code_buf, target_pc);
>      return -1;
>  }

I think a part of the patch is missing here. tcg_gen_code_common does not
have target_pc argument in current master.

<snip>

> diff --git a/vl.c b/vl.c
> index c036367..f1c3c3d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -123,6 +123,9 @@ int main(int argc, char **argv)
>  #define MAX_VIRTIO_CONSOLES 1
>  #define MAX_SCLP_CONSOLES 1
>  
> +/* seems better than pulling in all the tcg headers? */
> +extern void qemu_tcg_enable_perfmap(void);
> +
>  static const char *data_dir[16];
>  static int data_dir_idx;
>  const char *bios_name = NULL;
> @@ -3345,6 +3348,9 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_DFILTER:
>                  qemu_set_dfilter_ranges(optarg);
>                  break;
> +            case QEMU_OPTION_PERFMAP:
> +                qemu_tcg_enable_perfmap();
> +                break;
>              case QEMU_OPTION_s:
>                  add_device_config(DEV_GDB, "tcp::" DEFAULT_GDBSTUB_PORT);
>                  break;
> 

Is there any particular reason it is not enabled for linux-user mode? I
think it should work just fine in both modes. linux-user handles command
line options by itself in a different manner (and it has it's own set of
options, different from softmmu targets). The corresponding code is in
linux-user/main.c.

-- 
Kirill

reply via email to

[Prev in Thread] Current Thread [Next in Thread]