[Top][All Lists]

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

Re: [Qemu-discuss] instruction tracing for specified process

From: Peter Maydell
Subject: Re: [Qemu-discuss] instruction tracing for specified process
Date: Mon, 20 Nov 2017 09:43:29 +0000

On 20 November 2017 at 05:30, 李阳 <address@hidden> wrote:
> Since I want to trace the instruction statistics( instruction type and
> number) about specified process running on the simulated operating system,
> I can do the analysis of instruction type via the *struct TCGOpcode* in
> qemu source code(
> *void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb**)** in *
> *target-arm/translate-a64.c*).

Bear in mind that this function is called once at translation
time (when we JIT the Arm code to x86), not at runtime (we
may run this TB many times after JITting it once). So it's
tricky to put instrumentation here.

> My problem is that I can only collect the instruction statistics of all the
> processes running on the qemu guest operating system and cannot distinguish
> the specified process from all the processes.
> Is there any good way to help me out? Thanks in advance!
> My qemu configuration:
> Host: X86, ubuntu14.04
> QEMU: qemu-2.7.0-rc5
> Guest: AARCH64
> Target workload: Redis, NGINX etc.

You may be able to do something by looking at the state of the
guest CONTEXTIDR and TPIDR registers -- you'll need to look
into whether the guest OS stores useful per-process or
per-thread information in those which you can then use
to annotate your tracing.

(Since the CONTEXTIDR etc are runtime values, you'll need
to check them at runtime, not at translate time -- we can
translate a block of code once and then use the generated
code at runtime for more than one thread.)

-- PMM

reply via email to

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