qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v3 22/49] cpu: invent instruction count for


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC PATCH v3 22/49] cpu: invent instruction count for accurate replay
Date: Thu, 31 Jul 2014 17:17:29 +0100

Pavel Dovgalyuk writes:

> This patch adds instructions count fields to cpu structure and
> invents several functions for increasing this counter while executing
> translation blocks.
>
<snip>
> @@ -1186,6 +1188,7 @@ void qemu_init_vcpu(CPUState *cpu)
>      cpu->nr_cores = smp_cores;
>      cpu->nr_threads = smp_threads;
>      cpu->stopped = true;
> +    cpu->instructions_count = 0;
<snip>
> +    if (replay_file) {
> +        if (replay_mode == REPLAY_MODE_RECORD) {
> +            if (process_events && replay_has_events()) {
> +                replay_save_instructions();
> +                /* events will be after the last instruction */
> +                replay_save_events(-1);
> +            } else {
> +                /* instruction - increase the step counter */
> +                ++first_cpu->instructions_count;
> +            }
> +        } else if (replay_mode == REPLAY_MODE_PLAY) {
> +            skip_async_events_until(EVENT_INSTRUCTION);
> +            if (first_cpu->instructions_count >= 1) {
> +                ++replay_state.current_step;
> +                --first_cpu->instructions_count;
> +                if (first_cpu->instructions_count == 0) {
> +                    replay_has_unread_data = 0;
> +                }
> +            } else {
> +                replay_read_events(-1);
> +            }
> +        }
> +    }
> +}
> +
> +void replay_undo_last_instruction(void)
> +{
> +    if (replay_mode == REPLAY_MODE_RECORD) {
> +        first_cpu->instructions_count--;
> +    } else {
> +        replay_state.skipping_instruction = 1;
> +    }

I'm not quite following what instructions_count means here. Is it an
actual count of instructions executed? Can you add a comment to the
header where it's defined?

-- 
Alex Bennée



reply via email to

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