Shop OBEX P1 Docs P2 Docs Learn Events
Need info on cog com timing — Parallax Forums

Need info on cog com timing

Question. If a program in main launches a cog and sends it pointers.
Pub main 
   ‘Start new cog and send long ptr  @aptr @bptr 
   Repeat
       If somethinghappens
           Newcog.Somemethod


New cog
Pub somemethod
    Long[a] := long[b]


If there a way to calculate the difference in time it could take to make a = b using the method above versus if the main program did the equation itself a:=b. And is the time difference affected based on the order of the cogs and if the sub is at some unknown cog number. I’m trying to see if this time difference can be determined at 80Mhz

Comments

  • If you're sending a message to the other cog to tell it to do "somemethod", then the message sending overhead is going to vastly overshadow the time to actually do the assignment. Message passing and remote call overhead is likely to be hundreds of cycles, whereas the order of cogs relative to each other might make a few cycles difference (at most).
  • booting up a new cog takes at least 8192 cycles (512 longs x 16 cycles per hub revolution): it needs to fetch the PASM program from hub, one long at a time. If you start a cog to run Spin code, you need to add a couple additional cycles for the Spin interpreter to initialize itself and interpret the code. If you start a cog from Spin, there is also some overhead involved with actually doing the starting.

    Parallax used to have a little table with more detailed timings on their site, but I can't find it now.
Sign In or Register to comment.