Bruno Silva
05/25/2012 2:31 PM
post93305
|
I'm trying to measure the tick overhead in a Beagleboard-XM-REV C. That uses an arm processor.
I get a problem when using the ClockCycles() system call, because the counter seems to start counting backward when I
reduce the tick period.
I've made the following code to confirm this situation:
int main(int argc, char *argv[]) {
_uint64 before_clkper, after_clkper;
float cpu_freq;
struct _clockperiod clkper;
{
struct sched_param param;
int ret;
param.sched_priority = sched_get_priority_max( SCHED_RR );
ret = sched_setscheduler( 0, SCHED_RR, ¶m);
assert ( ret != -1 );
}
cpu_freq = SYSPAGE_ENTRY( qtime )->cycles_per_sec;
printf("Frequency of ClockCycles: %f\n", cpu_freq);
clkper.nsec = 10000000;
clkper.fract = 0;
ClockPeriod ( CLOCK_REALTIME, &clkper, NULL, 0 );
clkper.nsec = 10000;
clkper.fract = 0;
before_clkper= ClockCycles();
ClockPeriod ( CLOCK_REALTIME, &clkper, NULL, 0 );
after_clkper= ClockCycles();
printf("Before clock period %lld. After clock period %lld\n", before_clkper, after_clkper);
printf("Difference between clock period %lld\n", after_clkper-before_clkper);
return 0;
}
The results were:
Frequency of ClockCycles: 13000000.000000
Before clock period 15088465604. After clock period 15088465368
Difference between clock period -236
|
|
|