Hi,

I'm not sure if what you're trying to do should work or not. Somebody else may 
be able to help you. 


However, given that you are running your application on Gem5 simulator and 
depending of what you exactly want to achieve, you can alternatively instrument 
your code with m5 ops. An example:


#include "util/m5/m5op.h"


int main()
{
    for (int i = 0; i < 10; ++i)
    {
        m5_dumpreset_stats(0,0);
        int sum = 1;
        for (int j = 0; j < 1000; ++j)
            sum += sum;
    }
    return 0;
}



Each m5_dumpreset_stats call should generate a new section in the stats file 
(and reset the stat values). From there you can get the number of cycles and 
many more stats.

Oscar - Metempsywww.metempsy.com



---- On Sun, 10 Jul 2016 16:56:24 +0200 anoir nechi<[email protected]> 
wrote ---- 

Hi everybody


I'm trying to run a c application on SE mode using ARM (v7)... in order to get 
performance for a specific loop in the code i did an rdtsc() function that help 
me to het the number of cycles it take the loop to run. this is the code :

a  function to initialize the registers:

static inline void init_perfcounters (int32_t do_reset, int32_t enable_divider)
{
  // in general enable all counters (including cycle counter)
  int32_t value = 1;

  // peform reset:  
  if (do_reset)
  {
    value |= 2;     // reset all counters to zero.
    value |= 4;     // reset cycle counter to zero.
  } 

  if (enable_divider)
    value |= 8;     // enable "by 64" divider for CCNT.

  value |= 16;

  // program the performance-counter control-register:
  asm volatile ("MCR p15, 0, %0, c9, c12, 0\t\n" :: "r"(value));  

  // enable all counters:  
  asm volatile ("MCR p15, 0, %0, c9, c12, 1\t\n" :: "r"(0x8000000f));  

  // clear overflows:
  asm volatile ("MCR p15, 0, %0, c9, c12, 3\t\n" :: "r"(0x8000000f));
}


another function to read from the counter:

long long unsigned loop_start,loop_end,radix_start,radix_end,loop_cc,radix_cc;
static inline long long unsigned rdtsc32(void)
{
        long long unsigned r = 0;
        asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(r) );
        return r;
}


then i called this functions in main as following:

    loop_start = rdtsc32();

 /*loop*/

    loop_end = rdtsc32();
    loop_cc=loop_start-loop_end;


unfortunately i keep getting this warning while executing:

warn: Returning zero for read from miscreg pmccntr

meaning that i will get zero in the Cycle Count register!


Can someone help please?


Thank you


-- 
Anouar NECHIIT Engineer : Industrial systems
Higher Institute of Computer Science
Tunis - El Manar University
Phone : (+216) 50 311 536
E-mail : [email protected]


 




 _______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users






_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to