watchdog timer: interrupt handler: microblaze

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

Reply to
Aziz
Loading thread data ...

Unless you need clock cycle accuracy, you might be better off doing software intrusive code profiling as supported by the MicroBlaze and GCC / gprof tools. Search the Platform Studio online help for "profile" to see how it's done - pretty easy.

I used this just recently to resolve a performance issue in some standalone code - interpreting gprof output takes a little practise but isn't hard - it's starndard stuff so lots of web resources.

Regards,

John

Reply to
John Williams

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.