- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have developed c code by using PSoc Creator and i want to know about how to test performance of developed code.
Solved! Go to Solution.
- Labels:
-
PSoC 4 Architecture
- Tags:
- software testing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can measure amount of CPU clock cycles consumed by some piece of code using custom StopWatch component (attached). It uses system SysTick timer to count CPU cycles. The component is rather unfinished, but works for PSoC4, 4M and 5LP. To measure CPU clocks put StopWatch_Start() and StopWatch_Stop() in your code, and print result on terminal:
StopWatch_Start() ; // reset timer
// your code is here (function, ISR, etc.)
.....
StopWatch_Stop() ; // stop timer
uint32 BusClockTicks = StopWatch_Cycles; // read result
To add StopWatch component to you project, Import it from the demo project attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you want to do a unit-test (as in 'testing for correctness') or a performance test (as in 'how fast is it')? For the former, I can recommend the combination of Ceedling, CMock and Unity. Note that especially mocking can be interesting since you need to abstract from your hardware.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And for the second case (how fast...) use a logic analyzer and toggle a pin to see how fast things go on...
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can measure amount of CPU clock cycles consumed by some piece of code using custom StopWatch component (attached). It uses system SysTick timer to count CPU cycles. The component is rather unfinished, but works for PSoC4, 4M and 5LP. To measure CPU clocks put StopWatch_Start() and StopWatch_Stop() in your code, and print result on terminal:
StopWatch_Start() ; // reset timer
// your code is here (function, ISR, etc.)
.....
StopWatch_Stop() ; // stop timer
uint32 BusClockTicks = StopWatch_Cycles; // read result
To add StopWatch component to you project, Import it from the demo project attached.