joular / powerjoular

PowerJoular allows monitoring power consumption of multiple platforms and processes.
https://www.noureddine.org/research/joular/powerjoular
GNU General Public License v3.0
66 stars 15 forks source link

Terminal output overlapping #47

Closed gcorrall closed 6 months ago

gcorrall commented 8 months ago

When printing data to the terminal (using the -t flag) the current line is written over the previous line. When the digits change in length, the line becomes a mixture of the current and previous lines. For example, note the "W)W)" and "Wattss" in the following line:

Total Power: 8.50 Watts (CPU: 8.50 W)W)    /\ 0.30 Wattss

I think the most straightforward way to address this would be to use an ANSI escape code to erase the current line (https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797) - say, printing ANSI ESC[0K after printing the carriage return. Though of course there are several other ways this could be fixed.

adelnoureddine commented 6 months ago

Fixed in commit 4661fcc