Giter Site home page Giter Site logo

ploot's Introduction

Ploot

Plot streaming data from stdin to a tty terminal. Useful for displaying data piped from a serial port or long running process.

Example

Project used to be called ttyplot-rs.

Install

$ git clone https://github.com/mogenson/ploot.git
$ cd ploot
$ cargo build # or cargo install --path .

Usage

Pipe data from a process into ploot. Press ctrlc to quit.

Data format

Each line of data points can be positive or negative floating point numbers, separated by spaces. Ex: 1 2.3 -4.56. A new frame of one to multiple series of data points is shown when a newline character is received. Statistics like minimum, maximum, average, and current value are shown for the visible data for each series.

Options

-m, --min <min>        Lower bound of window (default: largest data point in window)
-M, --max <max>        Upper bound of window (default: smallest data point in window)
-w, --width <width>    Number of data points to display in window (default: terminal width)
-f, --file <file>      Log received data to file in CSV format

Copy ploot.bash to /usr/share/bash-completion/completions for command line tab-completion of options. A bash completion script can also be generated with the --completions flag.

Examples

# build example program
$ rustc feed_input.rs
$ ./feed_input | ploot
# serial port
$ cat /dev/ttyUSB0 | ploot
# CPU percentage
$ sar 1 | awk '{ print 100.0-$NF; fflush(); }' | ploot 
# ping time
$ ping 8.8.8.8 | awk -F '[= ]' '{ print 0+$(NF-1); fflush(); }' | ploot
# bash saw wave
$ for ((i=0;; i++)); do echo `expr $i % 20`; sleep 0.1; done | ploot 

Acknowledgment

Inspired by ttyplot. Some difference include: ploot can plot negative values and an arbitrary number of concurrent series, data window width can be specified, data points are plotted with points instead of bars, data rate is not calculated or plotted.

ploot's People

Contributors

mogenson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ploot's Issues

CPU usage?

Thanks for making this.

I compiled it successfully on macOS 10.15.6.

I was trying to use it to plot kernel memory usage over time, using this command:

if sudo -v; then while true; do \
  sudo zprint |\
  awk '$1~/^kalloc/ { sub("K","",$3); sum+=$3; } END { print sum; }'; \
  sleep 1; \
  done |\
  ploot; \
fi

I noticed my fans start to spin up like crazy so I checked Activity Monitor. I saw ploot using 99-100% CPU.

To rule out sudo, awk, zprint as possible culprits, I retried using a simple counter:

c=0; while true; do (( c++ )); echo $c; sleep 1; done | ploot

Same result. Any idea why this could be? Do I need to capture a spindump etc?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.