What does the slush command pollmemory do?

Tim Rohaly

pollmemory starts a simple TCP server which delivers the TINI memory usage to a given port at a given interval. The port is determined by the -p command-line option, and the interval, in milliseconds, is determined by the -i command-line option. Any client which connects to that port after pollmemory is started can read the current TINI memory usage.

The example program MemDisplay, included in the TINI firmware distribution, presents a graph of free memory as a function of time, determined by reading these values from the pollmemory server. After starting pollmemory on your TINI, you can run MemDisplay on another host to monitor your TINI board's memory usage. MemDisplay has the command-line option -a to specify the hostname of the TINI to monitor, the option -p to specify the port to connect to (this should be the same as the port specified as an argument to pollmemory), and the option -v to print the memory usage to the console in addition to graphing it.

Both pollmemory and MemDisplay operate on port 4401 unless otherwise specified in the command-line options.

If you are writing your own client to use with pollmemory, be aware that pollmemory outputs the memory usage as a 4-byte integer with little-endian byte ordering. Since this is not the standard byte-ordering for I/O in Java, you will have to explicitly rearrange the bytes on the client side to get them into correct order.

As of release Beta 3.0 of the TINI software, pollmemory is an optional command for slush, which means if you want to use it, you need to rebuild slush to include it then reload slush on your TINI.