Using the Strip Chart Recorder


The EMC stripchart program is a modified version of GNOME stripchart program "gstripchart". This document is a modified copy of the GNOME stripchart documentation. For the original source code and/or documentaton goto www.gnome.org.

EMC Modifications

The following modifications were made to gstripchart program to turn it into emcstripchart.

Hints for EMC users.

Licensing

Most of EMC was written at NIST and is public domain. However, this is distributed under the GNU General Public License

GNOME Stripchart Documentation

The GNOME stripchart program charts various user-specified parameters as a function of time. Its main use is to chart system performance parameters such as CPU load, CPU utilization, network traffic levels, and the like. Other more ingenious uses are left as an exercise for the interested user.

The gstripchart program periodically reads data from a file, extracts a value, and displays these values in one of several formats. The default format is a graphical display similar to that of a stripchart recorder. Hence the name, "gstripchart".

On systems such as Linux, in which the system parameters are available in human-readable form in the /proc directory, the gstripchart program makes a dandy performance monitoring tool, similar to but more versatile than xload.

Instead of being limited to a few standard performance parameters, the gstripchart program can plot any time-variant parameter than can be read from a file or pipe. This ability to read data from a pipe provides a very versatile and easy to use method of setting up custom displays.

The gstripchart program determines the parameters to display by reading a configuration file. The gstripchart program will first look for a configuration file specified on the command line, then look for a file named gstripchart.conf in the current directory, then look for a file named .gstripchart.conf in the users home directory, then look for a file named /etc/gstripchart.conf. If no configuration file is found, the program is terminated. 

Options

There are a few command line switches that can be used to alter the behavior of the program.
  -f, --config-file=FILE     configuration file
  -g, --geometry=GEOMETRY    geometry
  -i, --chart-interval=SECS  chart update interval
  -I, --chart-filter=SECS    chart low-pass filter time constant
  -j, --slider-interval=SECS slider update interval
  -J, --slider-filter=SECS   slider low-pass filter time constant
  -M, --menubar              add menubar
  -S, --omit-slider          omit slider
  -t, --display-type=TYPE    type of display
                none:   no display is produced (for debugging);
                text:   a textual numeric display is produced;
                graph:  a textual graphic display is produced;
                gtk:    use the default gtk-based graphic display.
      --class=CLASS          FIXME
      --display=DISPLAY      X display to use
      --gxid_host=HOST       FIXME
      --gxid_port=PORT       FIXME
      --name=NAME            FIXME
      --no-xshm              Don't use X shared memory extension
      --xim-preedit=STYLE    FIXME
      --xim-status=STYLE     FIXME
  -u, --update-interval=SECS update interval to poll data
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version
configuration file
Specifies a file from which to read configuration information. If unspecified, the current working directory is checked for a file named "gstripchart.conf", the user's home directory is checked for a file named ".gstripchart.conf", and the /etc directory is checked for a file named "gstripchart.conf". The first such file found is used.
geometry
A standard X11 geometry specification of the form WxH+X+Y.
chart-interval
slider-interval
Specifies the time interval in seconds between updates to the chart window and slider window. If unspecified, the chart window will be updated every 5 seconds and the slider window will be updated every 0.2 seconds.
chart-filter
slider-filter
Specifies the time constant in seconds to be used in low-pass filtering the data displayed in the chart or slider windows. A time constant of 0 seconds turns low-pass filtering off, which can result in a jumpy display. A time constant in the same range as the interval parameter, described above, is usually a good choice. Much larger values cause display updates to become sluggish. If unspecified, no low pass filtering is performed in either window.
menubar
Adds an application menubar to the main window. Normally this is omitted, and the menu is popped up by right-clicking on the chart window.
omit-slider
Causes the display of the slider window to be suppressed.

Configuration

The configuration file has a paragraph of configuration information for each parameter to be ploted. Each of these paragraphs are comprised of a series of RFC-822 style "keyword: value" pairs, beginning with an "identifier:" line. A comment can be included by putting a sharp sign (#) in the first column of a line.

The following keywords are available. Some are optional; some are only used by certain display types; many have reasonable default values, as described below.

identifier:
Introduces a parameter definition, and assigns a name to the parameter. This line *must* be the first line of a parameter description.
active:
If a parameter is marked "active = no", it will be ignored. This provides a convenient way to disable a parameter without deleting it from a parameter file.
id_char:
Provides a single-character abbreviation for a parameter. Currently unused, this is intended for the non-existant character-graphics display mode.
color:
Determines the color to be used in displaying a parameter. The color names and their RGB values are taken from X11/rgb.txt.
filename:
The file from which a parameter value is read. When a filename beginning with a "|" is supplied, input lines will be read from a pipe.
pattern:
The pattern which identifies the line from which a parameter value is to be extracted. If no pattern is provided, the first line of the file is used.
fields:
The number of fields to be split out of the first line which matches the pattern. Splitting is done on whitespace.
equation:
An equation used to obtain the value to be ploted for this parameter.
maximum:
The largest value that can be displayed. Any value in excess of the maximum will be plotted at the top of the display. If omitted, a default value of 1.0 is used.
minimum:
The smallest value that can be displayed. Any value less than the minimum will be plotted at the bottom of the display. If omitted, a default value of 0.0 is used.
nml:
The name of the variable to read from NML to use for this plot. If an equation is specified this variable becomes keyword one or $1. Adding this keyword makes the filename and pattern keywords irrelavant. See the list of variables available.
emcmot:
The name of the variable to read from EMCMOT to use for this plot. If an equation is specified this variable becomes field one or $1. Adding this keyword makes the filename and pattern keywords irrelavant. See the list of variables available.
On each iteration, a value to be displayed is obtained for each parameter in the configuration file. The file named in the "filename" line is opened -- either as a pipe if the filename begins with a pipe character (|), or as a regular file otherwise -- and a line is read.

If a pattern was specified, lines are read until one is found that contains the pattern string anywhere in the line. This line is split into the number of whitespace seperated fields specified in the "fields" line. Each of these fields is interpreted as a floating point number.

A value is obtained by evaluating the "equation" line using these field values. The first (or only) value is denoted by $1, the next by $2, and so forth. The difference between the field values between the last and the current iteration is denoted by ~1, ~2, and so forth. The elapsed time in seconds between the last and current iteration is ~t. The requested update interval is $i (and the delta is ~i, but will always be zero). All the usual infix arithmatic operators are available.

If libgtop support has been compiled into the gstripchart program, a value can be obtained from this library. This provides a portable method of obtaining many system performance parameters. The following libgtop parameters are available:

CPU Statistics
cpu_total, cpu_user, cpu_nice, cpu_sys, cpu_idle, and cpu_freq
Memory Statistics
mem_total, mem_used, mem_free, mem_shared, mem_buffer, mem_cached, mem_user, mem_locked
Swap Statistics
swap_total, swap_used, swap_free, swap_pagein, swap_pageout
Uptime Statistics
uptime, idletime
Loadavg Statistics
loadavg_running, loadavg_tasks, loadavg_1m, loadavg_5m, loadavg_15m
Network Statistics
net_pkts_in, net_pkts_out, net_pkts_total, net_bytes_in, net_bytes_out, net_bytes_total, net_errs_in, net_errs_out, net_errs_total


Note that the network statistics don't use the libgtop library. Instead, the values are read directly from /proc/net/dev, and so are only available under Linux.

These are all signed long integer quantities, except for uptime, idletime, and the three loadavg values which are floating point values. 

NML Variables

This is the list of variables that can be read from NML. The array_index should be replaced with an appropriate integer.
task.heartbeat, task.mode, task.state, task.execState, task.interpState, task.motionLine, task.currentLine, task.readLine, motion.heartbeat, motion.traj.linearUnits, motion.traj.angularUnits, motion.traj.cycleTime, motion.traj.axes, motion.traj.mode, motion.traj.enabled, motion.traj.inpos, motion.traj.queue, motion.traj.activeQueue, motion.traj.queueFull, motion.traj.id, motion.traj.paused, motion.traj.scale, motion.traj.position.tran.x, motion.traj.position.tran.y, motion.traj.position.tran.z, motion.traj.actualPosition.tran.x, motion.traj.actualPosition.tran.y, motion.traj.actualPosition.tran.z, motion.traj.velocity, motion.traj.acceleration, motion.traj.maxVelocity, motion.traj.maxAcceleration, motion.axis[array_index].units, motion.axis[array_index].p, motion.axis[array_index].i, motion.axis[array_index].d, motion.axis[array_index].ff0, motion.axis[array_index].ff1, motion.axis[array_index].ff2, motion.axis[array_index].backlash, motion.axis[array_index].bias, motion.axis[array_index].maxError, motion.axis[array_index].deadband, motion.axis[array_index].cycleTime, motion.axis[array_index].inputScale, motion.axis[array_index].inputOffset, motion.axis[array_index].outputScale, motion.axis[array_index].outputOffset, motion.axis[array_index].minPositionLimit, motion.axis[array_index].maxPositionLimit, motion.axis[array_index].minOutputLimit, motion.axis[array_index].maxOutputLimit, motion.axis[array_index].maxFerror, motion.axis[array_index].minFerror, motion.axis[array_index].homingVel, motion.axis[array_index].homeOffset, motion.axis[array_index].enablePolarity, motion.axis[array_index].minLimitSwitchPolarity, motion.axis[array_index].maxLimitSwitchPolarity, motion.axis[array_index].homeSwitchPolarity, motion.axis[array_index].homingPolarity, motion.axis[array_index].faultPolarity, motion.axis[array_index].setpoint, motion.axis[array_index].ferrorCurrent, motion.axis[array_index].output, motion.axis[array_index].input, motion.axis[array_index].inpos, motion.axis[array_index].homing, motion.axis[array_index].homed, motion.axis[array_index].fault, motion.axis[array_index].enabled, motion.axis[array_index].minSoftLimit, motion.axis[array_index].maxSoftLimit, motion.axis[array_index].minHardLimit, motion.axis[array_index].maxHardLimit, motion.axis[array_index].overrideLimits, motion.axis[array_index].scale, motion.axis[array_index].ferrorHighMark, io.heartbeat, io.cycleTime, io.tool.toolPrepped, io.tool.toolInSpindle, io.spindle.speed, io.spindle.direction, io.spindle.brake, io.spindle.increasing, io.spindle.enabled, io.coolant.mist, io.coolant.flood, , io.lube.on, io.lube.level, , io.aux.estop, io.aux.estopIn, io.aux.dout[array_index], io.aux.din[array_index], io.aux.aout[array_index], io.aux.ain[array_index] 

EMCMOT Variables

This is the list of variables that can be read from emcmot.
heartbeat, computeTime, pos.tran.x, pos.tran.y, pos.tran.z, axisPos[0], axisPos[1], axisPos[2], ferrorCurrent[0], ferrorCurrent[1], ferrorCurrent[2], ferrorHighMark[0], ferrorHighMark[1], ferrorHighMark[2], output[0], output[1], output[2], input[0], input[1], input[2], actualPos.tran.x, actualPos.tran.y, actualPos.tran.z, id, depth, activeDepth, queueFull, motionFlag, axisFlag[0], axisFlag[1], axisFlag[2], axisPolarity[0], axisPolarity[1], axisPolarity[2], paused, overrideLimits, tMin, tMax, tAvg, sMin, sMax, sAvg, nMin, nMax, nAvg