ftrias / TeensyThreads

MIT License
182 stars 26 forks source link

[feature] Implement "pseudo" task manager for listing running task #28

Closed miltkall closed 3 years ago

miltkall commented 3 years ago

Hello again,

I hope you like the feature. You can just call it like:

 Serial.print(threads.threadsInfo()); 

and get a list of the running tasks 👍🏿 with some extra information!

Accidentally I had pushed some work in progress into your master branch. 😬 I am really sorry for that! If you merge this pull request everything will be clean up! 🤞🏿

If you like the feature, I could gladly write some information in your README.md doce. Thanks

miltkall commented 3 years ago

A sample output can be seen below:

0:Stack size:10240|Used:537296896|Remains:-537286656|State:RUNNING|cycles:1863991007
1:Stack size:2048|Used:184|Remains:1864|State:SUSPENDED|cycles:4802728
2:Stack size:1024|Used:168|Remains:856|State:RUNNING|cycles:810566274

Can you maybe explain the Used/Remains for stack 0? Why such huge number? Thanks

ftrias commented 3 years ago

It does seem like the number for Thread 0 isn't reliable perhaps because Thread 0 is the main thread provided by Teensy at boot. It's stack is not managed by the library. I'll have to look more closely at it to see if it can be fixed.