Thanks for patch. It seems correct. I'll test it out and apply it to master
branch soon.

- Avadh

On Mon, Mar 7, 2011 at 10:00 PM, <[email protected]> wrote:

> Thanks Avadh,
> I have a quick patch for counting instructions in multi-core.
> Files affected are:
>
> ---------------------------
> +++ b/ptlsim/x86/ptlhwdef.h
> @@ -819,6 +819,7 @@ struct Context: public CPUX86State {
>   W64 insns_at_last_mode_switch;
>   W64 user_instructions_commited;
>   W64 kernel_instructions_commited;
> +  W64 total_instructions_commited;
>   W64 exception;
>   W64 reg_trace;
>   W64 reg_selfrip;
> --------------------------------------
> +++ b/ptlsim/core/ooopipe.cpp
> @@ -2348,6 +2348,7 @@ int ReorderBufferEntry::commit() {
>
>   if likely (uop.eom) {
>     total_user_insns_committed++;
> +    ctx.total_instructions_commited++;
>     per_context_ooocore_stats_update(threadid,
> commit.insns++);
>     thread.total_insns_committed++;
> -----------------------------------
> +++ b/ptlsim/sim/ptl-qemu.cpp
> @@ -723,11 +723,11 @@ void Context::update_mode_count() {
>     W64 prev_cycles = cycles_at_last_mode_switch;
>     W64 prev_insns = insns_at_last_mode_switch;
>     W64 delta_cycles = sim_cycle -
> cycles_at_last_mode_switch;
> -    W64 delta_insns = total_user_insns_committed -
> +    W64 delta_insns =total_instructions_commited -
>         insns_at_last_mode_switch;
>
>     cycles_at_last_mode_switch = sim_cycle;
> -    insns_at_last_mode_switch = total_user_insns_committed;
> +    insns_at_last_mode_switch =total_instructions_commited;
> ------------------------------------
> +++ b/ptlsim/sim/ptlsim.cpp
> @@ -720,6 +720,7 @@ CPUX86State* ptl_create_new_context() {
>
>        // Create a new CPU context and add it to contexts
> array
>        Context* ctx = new Context();
> +        ctx->total_instructions_commited = 0;
>        ptl_contexts[ctx_counter] = ctx;
>        ctx_counter++;
> -------------------------------------
> Let me know, if I am doing something wrong. It seems to work.
>
>
> --ishwar
>
> ---- Original message ----
> >Date: Sun, 6 Mar 2011 08:39:11 -0700
> >From: avadh patel <[email protected]>
> >Subject: Re: [marss86-devel] Ptlstats for Multi-cores
> >To: Ishwar Bhati <[email protected]>
> >Cc: <[email protected]>
> >
> >   On Fri, Mar 4, 2011 at 1:26 PM, Ishwar Bhati
> >   <[email protected]> wrote:
> >
> >     Hey, I have couple of questions regarding the
> >     status of ptlstats.
> >
> >     A)I see this comment line before update_stats
> >     which used by flush_stats in
> >     "ptlsim/core/ooocore.cpp"
> >     /* this assume only one core in each machine, need
> >     to be fixed. */
> >     void OutOfOrderMachine::update_stats(PTLsimStats*
> >     stats) {
> >
> >     Does this mean that, stats collection for
> >     multi-core are not correct? I know, for sure that
> >     instructions committed per core calculations
> >     are wrong, because it uses
> >     "total_user_insns_committed"  in
> >     update_mode_count() in ptl-qemu.cpp which is a
> >     global variable. Instead,
> >     we should be using per core instruction counter
> >     for this calculations. Are the dcache miss/hit
> >     stats similarly mixed up?
> >
> >   Here the comment is clearly wrong because we have
> >   only one Machine in each simulation run and in this
> >   machine all the Cores are present. So this function
> >   is called only once at the end when stats are
> >   flushed.
> >   But about 'update_mode_count()', that is a bug.
> >   Instead of 'total_user_insns_committed', it should
> >   be replaced with per core instruction commit. About
> >   dcache hit/miss counts, they should be fine because
> >   they are added only once for 'global' snapshot.
> >   Thanks for finding this bug.
> >
> >     B)
> >      There is a "idle" counter/parameter in the
> >     insns_in_mode stats, what is this for and will
> >     this be supported in future?
> >     We want to actually know that for how much time a
> >     core/thread was in the idle loop doing nothing? If
> >     it is not supported, can any body give suggestion
> >     on how to implement
> >     the idle loop count for some context?
> >
> >   The 'idle' counter was used in old Xen based PTLsim.
> >   When we switched to QEMU, it was little tricky to
> >   find time spent in idle loop because of the way QEMU
> >   works.  So in simulation mode we decided to not to
> >   switch in QEMU mode when we encounter PAUSE
> >   instruction, instead we pause the core for fix
> >   amount of cycles (THREAD_PAUSE_CYCLES). In stats,
> >   you can check 'cycles_in_pause' to find out how many
> >   cycles a CPU was in PAUSE mode.
> >   We don't have any implementation of C-States, used
> >   in modern CPU's for energy efficient idle modes.
> >   - Avadh
> >
> >     Thanks
> >     Ishwar
> >     _______________________________________________
> >     http://www.marss86.org
> >     Marss86-Devel mailing list
> >     [email protected]
> >     https://www.cs.binghamton.edu/mailman/listinfo/marss86-
> devel
>
_______________________________________________
http://www.marss86.org
Marss86-Devel mailing list
[email protected]
https://www.cs.binghamton.edu/mailman/listinfo/marss86-devel

Reply via email to