Comments (10)
Hi, nice idea, I like it!
Especially the pipe into ascii art viewer part is cool, since it provides a quick way to view the situation on a remote server while being logged in over ssh into a terminal (without having to rm the image file again etc). In combination with a helper program like 'timeout' and an infinite loop around it, you have a live refreshing self-updating image in the terminal, without writing an intermediate file.
What I did before while trying out things (on local computer) all the time was using an image viewer with inotify support like gthumb and then just overwriting the same file every time, having the viewer update automatically.
So, how to do this? When writing the png to stdout, all other text output has to be suppressed of course, but that's easy.
What's more difficult is that the png format is not "streaming-friendly" at all, since it has a length field which value we only know after writing all output. In the file writer code, I just jump back to that spot and then write the value, but that's obviously not possible when streaming to stdout:
Line 584 in d352ee1
So, instead it needs to generate everything in memory. That's not a big deal, since the memory needed is much less than the complete pixel grid which is already kept in memory in a very inefficient (but very convenient) way. :D
from btrfs-heatmap.
I don't have much time right now, but I actually took a quick look at the code and did some testing. I noticed the problem with .seek() you mentioned, so the whole image needs to be buffered, and also that sys.stdout doesn't accept binary out of the box.
Using it in an SSH session and in a loop was my thought as well. It would be great to watch a defragmentation or balance operation going on with something like this:
while :; do sudo heatmap.py --size 6 / -o - | catimg -; sleep 5; done
Edit: fixed above command
from btrfs-heatmap.
I tried catimg, it does not accept data from stdin. Do you have another catimg than I found, or didn't you try catimg - < pngfile yet?
I do like the result of what catimg shows more than cacaview or asciiview by the way. Unfortunately, it's also taking its time to produce it.
from btrfs-heatmap.
Oh wait, nevermind, there's a script and a C version (with stdin support). Bedtime, apparently. :)
from btrfs-heatmap.
Exactly, the C version works with stdin and is pretty fast. The ANSI output of it makes a lot more sense then the ASCII symbols of the other tools.
from btrfs-heatmap.
The images look also the best if the the resolution of the catimg image is a power of two. So either by using something like -w 128
with catimg or --size 6
with heatmap.py in order to fit it inside the terminal.
from btrfs-heatmap.
Oh, and catimg is also in Debian now. Great! I was just looking around on a Stretch system yesterday and didn't find it, but it's in Buster. Let me try to create a PoC branch first so that you can play around with it. I'm thinking about just using a dirty list to write into and some duck typing for creating a yolo memory buffer and not having to put workarounds in the 30 line png generator that I was so proud of. ;-]
from btrfs-heatmap.
Hey! You can try out the develop branch!
This is awesome. I will also add this to the documentation.
from btrfs-heatmap.
Thanks, this is great! The pipe to | catimg -
and | feh - &
works perfectly for me!
from btrfs-heatmap.
Ah, I'll also add feh as suggestion in the documentation yes.
from btrfs-heatmap.
Related Issues (12)
- Explicitly use python2 HOT 3
- "Btrfs and dirvish, a perfect match" HOT 7
- Man page missing from regular releases HOT 1
- Documentation needed? HOT 2
- Running python script as root? HOT 2
- Clarify license HOT 3
- btrfs-heatmap: search_v2(): ioctl.py:265:search_v2:PermissionError: [Errno 1] Operation not permitted HOT 6
- StopIteration when doing --sort virtual on small filesystem HOT 4
- BTRFS mounted on BTRFS shows the top most filesystem HOT 5
- ! [new branch] debian/master -> origin/debian/master (unable to update local ref)
- Suggestion: Use colors for different RAID levels HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btrfs-heatmap.