Shop OBEX P1 Docs P2 Docs Learn Events
Measuring the execution time of Spin code — Parallax Forums

Measuring the execution time of Spin code

Paul BakerPaul Baker Posts: 6,351
edited 2007-04-19 21:35 in Propeller 1
The question how long a certain instruction or·section of Spin code takes to execute has been asked a few times. To answer a recent email question on this topic, I wrote some code to perform the task using one of the counters. This is the method Tracy Allen used to measure the execution speed of PBASIC commands, but this code performs the math for you and displays the number of clock cycles on a TV (and doesn't require an oscilloscope or logic analyzer). I hope some of you will find it useful when trying to figure out the most efficient method of writing Spin code.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer

Parallax, Inc.

Comments

  • CJCJ Posts: 470
    edited 2007-04-19 20:14
    a little overcomplicated for my taste, replace the setting of the pin high and low with captures of CNT, then you can use it on any code, even code that uses all the IO pins

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • M. K. BorriM. K. Borri Posts: 279
    edited 2007-04-19 21:35
    Thanks! I've been pulsing a pin every instruction and staring at a scope @_@; eyes hurt
Sign In or Register to comment.