I have been trying to write a watchdog interrupt handler and have not been successful in coming up with a working code. I would like to use watch-dog timer on OPB bus of microblaze system to count the number of clock cycle each phase of your software code takes.
A specific application code running on microblaze and I would like to quantify my code by finding out the number of clock cycles spent executing it.
I would appreciate to you if you can send me an example of software code using the watchdog timer to measure the number of clock cycles spent for performing a certain section of code.
Regards, Aziz
p.s. I have been figured out that the code might look like the following. but I am struggling to find out the right SYNTAX to execute it
//using base system builder, the WDT has been configured in enable- once mode. unsigned rollover_count; wdt_interrupt_handler{ clear the MSB bit of the register; rollover_count++;
}int main(){ int start; int end; rollover_count = 0; read the time base register; software code; read the time base register again; //assuming that the watch dog counter has a 30 bit counter total_number_of_clock_cycles_spent = (rollover_count)*(2^30) + (end- start);
return 0; }//end of main