Re: [Gems-users] How to count "Privileged" instructions in Opal??


Date: Wed, 3 Jun 2009 17:34:26 +0200
From: David Bonavila <david.bonavila@xxxxxxxxxxxxxxxxxx>
Subject: Re: [Gems-users] How to count "Privileged" instructions in Opal??

Hello again.

I have changed the code, and now it is like this:

/*---------------------------------------------------*/
/* Variable declarations                             */
/*---------------------------------------------------*/
bool last_mode[2] = { false, false }; // transformes it into global
int iPriv[2] = { 0, 0 }; // we have 2 cores
int iUser[2] = { 0, 0 };

[...]

if (d_instr) last_mode[proc] = d_instr->getPrivilegeMode();

[...]

m_stat_committed[proc]++; // this line was already there
if (last_mode[proc]) iPriv[proc]++; // I have added these 2 lines
else iUser[proc]++;


[...]

out_info("  %-50.50s %10llu\n", "PRIVILEGED INSTRUCTIONS:", iPriv[k]);
out_info("  %-50.50s %10llu\n", "USER_MODE  INSTRUCTIONS:", iUser[k]);

and the Opal stats file shows:

[0]   PRIVILEGED INSTRUCTIONS:                               767827
[0]   USER_MODE  INSTRUCTIONS:                               232177


[1]   PRIVILEGED INSTRUCTIONS:                               767827
[1]   USER_MODE  INSTRUCTIONS:                               232177



Now the sum of privileged + user instructions is correct, 1 million, but the number of privileged instructions is the same for the 2 cores, and the number of user instructions is the same for both cores also.

What am I doing wrong now??

Thank you!!


2009/6/2 David Bonavila <david.bonavila@xxxxxxxxxxxxxxxxxx>

Hi.

I have added the following lines to the pseq.C file:

/*------------------------------------------------------------------------*/
/* Variable declarations                                                  */
/*------------------------------------------------------------------------*/
int iPriv[2] = { 0, 0 };
// I am simulating a 2-core processor
int iUser[2] = { 0, 0 };

if (d_instr) {
  last_mode = d_instr->getPrivilegeMode(); // this line already existed
  if (last_mode) iPriv[proc]++; // I have added these two lines
  else iUser[proc]++;
}

out_info("  %-50.50s %10llu\n", "PRIVILEGED INSTRUCTIONS:", iPriv[k]);
out_info("  %-50.50s %10llu\n", "USER_MODE  INSTRUCTIONS:", iUser[k]);


I have simulated 1 Million instructions with Opal, and the Opal output file has this:

[0]   PRIVILEGED INSTRUCTIONS:                                 219278
[0]   USER_MODE  INSTRUCTIONS:                                 175210

[1]   PRIVILEGED INSTRUCTIONS:                                 219278
[1]   USER_MODE  INSTRUCTIONS:                                 175210

The two processors have executed the same number of privileged instructions??
And the total instructions (Privileged + User) is different from 1M (I have changed Opal so the number of instructions passed to the opal0.sim-step command is the TOTAL number of instructions executed between all processors, not just CPU0).
I am simulating a workload which runs only 1 thread.

Is all this right??
Am I doing something wrong??

Thanks!!


[← Prev in Thread] Current Thread [Next in Thread→]