CPU Utilization Graph #2604
Replies: 5 comments
-
Posted at 2017-06-25 by MrTimcakes And here is Graph.js
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-06-25 by MrTimcakes Ah, and about using an ESP over the Orginal Espruino. Originally I wanted to use an ILI9341 LCD and display multiple graphs at the same time, this is why I designed the Graph library to create new instances. However, I couldn't get the display to update fast enough. Perhaps I'll try to improve that again at some point, probably something to do with compiled code for the STM32, any advice for that is welcome. In the end seeing as though I was going to use an OLED anyway it was easier to just use a NodeMCU. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-06-26 by @gfwilliams That's great! Thanks for posting it up! I really like Gettin the ILI9341 fast enough can be tricky - paletted mode can help sometimes (as you can build the whole image in RAM) but even then the updates aren't that fast. You do seem pretty limited by SPI - sending a whole screenful is 150kb, so even running SPI flat out at 10MHz it's still going to take over 1/10 of a second - and Espruino won't really manage that while doing the palette as well |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-06-26 by MrTimcakes Yeah, is 10MHz the fastest SPI clock? The Adafruit ILI9341 and TFT_eSPI Arduino libraries run 36MHz for the STM32F1 and 40MHz for the ESP |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-06-26 by @gfwilliams No, you can push it out faster - however I'd be a bit worried about trying to push 36MHz reliably over jumper wires? It's likely it'll be the pallet code that's slowing it down rather than SPI (well, a mix). However, if you weren't using the palleted code it'll certainly be the display driver that's slowing it down since it's in JavaScript. If you were willing to do a bit of poking in C it'd be pretty easy to write your own native SPI driver though. There's already a branch for an OLED display: https://github.com/espruino/Espruino/compare/DO003-oled You could strip that down and just send the commands from: in it instead... That one uses software SPI but it'd still be pretty speedy |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-06-25 by MrTimcakes
I've often wanted to know the CPU utilization of my home server to help debugging or just seeing general usage, I'm aware of the Pico CPU Monitor but that uses USB, seeing as though it's a server I wanted something with WiFi. Oh and fancy WebSockets.
First of all, we need some software on the server to broadcast its utilization. I chose WebSocketd, it takes any regular command line script and broadcasts it over WebSockets. Just remember to add it to your $PATH so you can use it from anywhere. I thought this was easier than making Node script to do essentially the same thing, this project is about Espruino after all. I have this run in a screen at startup on my server:
Now for the Espruino portion, while I had originally planned to run this on an Original Espruino I ended up using an ESP8266 I'll explain why later. The Espruino has to connect to the server, parse the information then display it on a graph. The information from the WebSocket comes in a format structured for columns on a command line using multiple spaces to separate it. Since Espruino doesn't support RegEx yet I had to use some fidgeting with indexOf to get the data into a usable format, specifically the idle time of the CPU. I then created a simple graph library to convert the CPU utilization into a graph and plot it. I used an SSD1306 128*64 OLED, here's the code and how it looks:
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions