How many cogs are running
Brian_B
Posts: 842
Hi,
·Is there a fast way to look at code and tell how many cogs are being used ?
Thanks,Brian
·Is there a fast way to look at code and tell how many cogs are being used ?
Thanks,Brian
Comments
It's helpful if the initial documentation for an object spells this out right away, so you'll know. Because cogs are started at run-time, this could be hard to track down, otherwise.
Here's from an object I wrote (this is the coolest software I've ever written):
·
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Post Edited (Chip Gracey (Parallax)) : 2/11/2007 2:17:29 AM GMT
I think I might have phrased the question wrong .If you have five objects are they all using differnt cogs ,or does the propeller tools compress the code to less cogs. Example : Chris Savage's PING demo ,I believe 5 objects total .But not one cognew, is everything running on on cog ?
Thank's Brian
Using the cognew instruction you can start a 2nd cog running the same, or other spin methods.
If object contains assembler, a cog must be used to hold the machine code (the spin interpreter is dumped and loaded with the machine code).
So, certain objects, such as video, require one or more cogs to handle the high speed assembler code needed.
Other objects strictly using spin may or may not need their own cogs depending if parallel processing is needed.
Look over the 1st couple chapters of the propeller manual.
-Martin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Chip and the guys (and Gals), made the propeller to easy to work with. I've made up my mind to stop and reread the manual (I'll probally get more out of it this time).
Thanks,Brian
PhiPi wrote a clever routine a while back that I use regularly to check the amount of cogs available. The code I add to call it is below. Uses the TV object.
See his code attached...
You can call it any time. Add some delays and you can track a routine.
Hope it helps...
-Parsko
There is no relationship between the number of objects in a Spin program and the number of Cogs used.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Stan Dobrowski
Hey parsko ,I figured you being a fellow gearhead that you would like this video of my modified garden tractor.
http://www.youtube.com/watch?v=iWU12rMj03c
ps.might take a few minutes before it's there.
Brian
Garden Tractor?!?
Anything that produces noxious gases and smoke is cool! I'm impressed!
-Parsko