Shop OBEX P1 Docs P2 Docs Learn Events
COG Utilisation — Parallax Forums

COG Utilisation

simonlsimonl Posts: 866
edited 2007-01-25 13:34 in Propeller 1
Has anyone got any code that would give an idea of % cog utilisation (before I have a go myself) ?

[noparse][[/noparse]edit]
...or anyone got any ideas as to how I might achieve it?

I'm thinking that I might need some sort of polling of global var's that get updated by each (working!) cog. But not sure what each cog will need to do to arrive at a % utilisation figure.

Oh, and I guess I'm gonna have to get down-and-dirty with integer maths too [noparse]:([/noparse]
[noparse][[/noparse]/edit]

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheers,

Simon
www.norfolkhelicopterclub.co.uk
You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)

Post Edited (simonl) : 1/23/2007 4:16:26 PM GMT

Comments

  • asterickasterick Posts: 158
    edited 2007-01-23 18:27
    Are you talking like CPU used?

    The only time the cog is ever waiting is when it's stopped, or when it's executing a WAITPEQ WAITPNE WAITCNT and WAITVID. The only way you can really solve how many cycles are used is by wrapping something like this:

    mov old, CNT
    waitcnt Target,Delta wr
    sub  old, CNT
    ADD cyclesWasted, old
    
    



    (That treats the move's as 'wasted' too)

    The down side to using this is counter rollover (happens just under once a minute), and if you're doing video, you're likely to throw your timing off if you're squeezing out every cycle that you can (which almost anything dealing with VGA seems to be extremely fond of)

    As far as determining how many cogs are used, you can do a repeating loop that uploads a JMPRET 0, #0 to as many cogs as it can before none are free...

    Other than that, I'm out of ideas.

    Post Edited (asterick) : 1/23/2007 6:33:49 PM GMT
  • parskoparsko Posts: 501
    edited 2007-01-24 09:16
    Simon,

    There is a cog counter. Not sure if this helps...

    Should be straightforward how to use it.

    -Parsko

    PS- I think PhiPi wrote it, not me blush.gif
  • simonlsimonl Posts: 866
    edited 2007-01-25 13:34
    Thanks for the replies guys, gives me food for thought.

    Asterick: You've raised an excellent point, of course; I guess I'm trying to see how much time a COG is 'idle' / looping awaiting something useful. I've not got my head around that yet -- coz if it's looping it can't be 'idle' can it?! I guess I'm thinking of something like the 'Performance' tab in Windows Task Manager... (BTW: Love GEAR, you're a genius!)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
Sign In or Register to comment.