Re: How to measure code execution time...?
From: Thad Smith (thadsmith_at_acm.org)
Date: 06/15/04
- Next message: Ben Bradley: "Re: How to measure code execution time...?"
- Previous message: Simp: "How to measure code execution time...?"
- In reply to: Simp: "How to measure code execution time...?"
- Next in thread: Ben Bradley: "Re: How to measure code execution time...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 15 Jun 2004 08:53:03 -0600
Simp wrote:
>
> I have a pretty elementary question (I'm an intern - it happens!). My boss
> asked me to run a timer to measure how long it takes to execute some code on
> a Motorola 32-bit Microcontroller. Is there a built in tool in Metrowerks
> Codewarrior that can accomplish this? Or is there a coding technique or
> tool that I must/can use? Any help would be greatly appreciated!
I am not familiar with your specific processor and tool, but here are
three approaches:
1. Use a code simulator. Subtract the value of the cycle counter before
and after your code runs. Divide by the appropriate clock, or divided
down clock, to get the execution time on a real processor.
2. Run the code on your target system. Set a spare output high when
your code starts and low when it ends. Look at the pulse on a scope or
measure with an external timer.
3. Use an internal timer with suitable range and resolution to measure
the execution time. Read it before and after the code, then subtract.
Multiply by the time per tick.
Thad
- Next message: Ben Bradley: "Re: How to measure code execution time...?"
- Previous message: Simp: "How to measure code execution time...?"
- In reply to: Simp: "How to measure code execution time...?"
- Next in thread: Ben Bradley: "Re: How to measure code execution time...?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|