0

I'm currently debugging an issue where I see a large number of threads in my application hanging on to a database connection even though they are asleep, often the threads sleep for a significant length of time (10-300s) (they're sensor reading/normality checking threads; that's not important)

I wanted to know if there's a decent way to graph something like:

watch "echo select count(*) from pg_stat_activity where procpid <> pg_backend_pid(); | psql"

and have it shown in the CLI or as an image that I can simply open, or write the image at the end of the run?

Surely there's a unix tool for histograms over time using the CLI to draw it (curses)?

Jenny D
  • 27,780
  • 21
  • 75
  • 114
Lee Hambley
  • 360
  • 3
  • 12

2 Answers2

0

I am not sure about a curses based solution back for graphing arbitrary data gnuplot can be of help. The relevant URL http://www.gnuplot.info/ . It is quite complex but for basic things the documentation should be more than enough.

thanasisk
  • 941
  • 6
  • 16
0

gnuplot is one option for this, but it's a bit awkward if you want a continuous feed of data. This related question suggests that you could use eplot for more convenient terminal output.

Craig Ringer
  • 11,083
  • 9
  • 40
  • 61