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 NECHI*
*IT Engineer : Industrial systemsHigher Institute of Computer ScienceTunis
- El Manar University*
*Phone :* *(+216) 50 311 536*
*E-mail :* *[email protected] <[email protected]>*
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users