TREND(1) | General Commands Manual | TREND(1) |
trend
— a
general-purpose, efficient trend graph
trend |
[-dDSsvlmFgGhtAERIMNTLzfcpue ]
[-display ] [-geometry ]
[-iconic ] ⟨fifo |
-⟩ ⟨hist-spec |
hist-sz x-sz⟩ [low
high] |
trend
is a general-purpose, efficient
trend graph for "live" data. Data is read in ASCII form from a
file or continuously from a FIFO and displayed in real-time into a
multi-pass trend (much like a CRT oscilloscope).
trend
can be used as a rapid analysis tool for
progressive or time-based data series together with trivial scripting.
trend
requires at least a valid
fifo to read from and an history specification
(hist-spec) or, for advanced usage, a combination of
history size and horizontal size (hist-sz
and x-sz
respectively). Optionally, to disable auto-scaling,
the vertical limits can be specified directly through the command line via
low and
high. The default input format is ASCII, in absolute
counting mode. Many settings can be changed directly during execution.
To display real-time data you should use a FIFO. Both standard input and named pipes can be used. Standard input (used for simple pipelining purposes) can be opened by using - instead of a named file. A named FIFO can be created using the mkfifo(1) command. FIFOs are automatically re-opened upon EOF. See the EXAMPLES section.
Alternatively you can store your data in a plain file and simply display its last values non-interactively.
When new data is written, the value is plotted and the cursor position is advanced. That is, the graph scrolling speed is determined by the speed of the data flow. When the number of received values is above the specified horizontal size, the graph will wrap or scroll, depending on your settings.
The default data format is a space/tab/newline-separated series of parseable ASCII numbers; eg:
1 2 3 4 5.1 0642 0x12 -12.4E5 .987
The parser is very lenient, and will silently ignore whatever looks like garbage.
By default all input values are considered absolute and displayed "as is" in a single graph.
The -c
[N]mode flag
sets an alternate counting mode and the number of available graphs.
Available modes are:
In incremental and differential mode, each value is calculated using the previous value as a reference except for the first, which is taken as absolute. The number of graphs can be specified by prefixing a multiplier before the counting mode (eg: 2a draws two graphs in absolute mode). See MULTIPLE GRAPHS for more details on how this affects the input stream.
Different input formats are supported, as specified by the
-f
flag. Note however that only the ASCII parser
(the default) silently ignores errors. NaNs and Infinity have special
treatment. Internally, trend
always works with
double precision floating points: conversion toward these is performed with
the default FPU conversion rules. The actual underlying binary format
depends on the host architecture:
ASCII and binary floating point input have special treatment for
NaNs and Infinity (entered in any representable form). Both are considered
as "undefined values". Undefined values can be highlighted, but
aren't otherwise rendered. If the -e
flag is set,
Infinity enters an escape sequence instead (See
ESCAPE SEQUENCES)
Multiple graphs can be displayed inside a single trend instance by
specifying a prefix number N for the -c
flag. The
input is interleaved, but otherwise unchanged: the reference value, if
needed, is expected to be seen N times, one for each graph. Thus, for three
graphs (A, B and C), the input order is:
[A0 B0 C0] A1 B1 C1 A2 B2 C2 .. .. ..
The display is updated only once all graph values are read. The color, label and origin for each graph can be specified through the usual command-line flags, separating each value with a comma; in the same order as the input. Default colors and labels are assigned if not completely specified.
All graphs share and are affected by the same settings, except for
the origin (zero) which can be changed independently. Filling, values and
the examiners only work on the current graph. The current graph can be
cycled dynamically with the TAB
key and
differentiated using the K
key, which cycles between
"normal", "dim others" and "hide others"
views. The graph key, if enabled, also highlights the current graph.
If escape sequences are enabled (through the
-e
flag), entering Infinity (in any representable
form) will start an escape sequence. Currently, this feature is not yet
implemented: Infinity is simply discarded. This is reserved for future use
as a way to control the trend
interface and
parameters remotely.
-d
-D
-S
-s
-v
-l
-m
-F
-g
-G
grid-spec-z
zero[,zero...]-h
-t
str-A
colour-E
colour-R
colour-I
colour[,colour...]-M
colour-N
colour-T
colour-L
label[,label...]-c
mode-f
format-p
rate-u
-e
-display
-geometry
-iconic
An history specification is another convenient form of defining the pair `hist-sz x-sz` for common cases. An history specification can be in either one of the following formats:
While this may seem hard at first, trend fifo
'60x3'
is an easier way of expressing "60 seconds for 3
minutes" and similar idioms.
A colour is specified in hex RGB format, as follows:
#RRGGBB
, RRGGBB
or 0xRRGGBB
; some
examples:
A grid specification is of the form:
[[A][+C]][x[B][+C]]
(eg: 1.3
, 10+5
,
1x10+5
, +5x+5
;
+1x+1
gets the old behaviour) where:
ESC
TAB
a
A
d
D
S
s
v
l
L
m
f
g
G
z
Z
p
u
k
K
space
When autoscaling is enabled the graph will be scaled vertically to fit visible values. The grid resolution is used to add some vertical bounds to the graph. Disabling autoscaling interactively will retain current limits. When the grid is too dense to be displayed it's deactivated automatically.
The latency indicator shows a 5s average of the visual and maximal sync latency (in seconds). The visual latency is the time-frame between real value updates and the final output you're seeing: it includes copy/redraw times, which varies depending on enabled layers, plus video sync. The maximal sync latency is the maximal time ever required for any received value to be synced with the display: since the display is updated atomically, values received while redrawing are implicitly delayed. See the UPDATE POLICY section for further details.
The default is to shade uniformly old values to complete transparency. The "dimmed" shading mode draws the foreground values with full opacity and the others with half opacity.
The default visualisation mode is "wrap-around": newer values will simply wrap around the screen when new data arrives. The other available one is "scrolling": new data is always placed at the right edge of the screen, and older values scrolled on the left.
Three value indicators are drawn on the screen: upper limit, lower limit and current value (respectively on the upper right, lower right and lower left of the screen).
You can query interactively the graph for any value in the history by clicking with the first mouse button. This will enable a permanent examiner in the selected position and display up to the three nearest values in the upper-left corner of the screen. Intersections are projected horizontally, while a small circle will show the position of the nearest sampled value. The mean value refers to the three intersections.
By holding down the CTRL key while clicking/dragging only "foreground" values will be considered.
When clicking inside the distribution graph, the current count for the selected value is displayed instead.
The examiners can be removed by clicking anywhere with the third mouse button.
D
or
-D
enable a distribution graph on the left side of
the window. This is especially useful when analyzing the continuity of a
function or signal. Intensity is proportional to the visible maximum.
f
or
-F
enable filling. In standard mode, or when hist-sz
is smaller than x-sz, the area between the curve and zero will be filled.
Otherwise, in dimmed mode, the area between the "foreground" and
"background" values is filled instead.
p
or -p
and defaulting to
1000) defines how often the history buffer should be checked for updates
and kept in sync with the visual. Values greater than 1000 result in
continuous scanning (note that this only affects the maximal sync latency,
and not the display rate, which is handled automatically).DISPLAY See
X(7).
Running trend
with a named FIFO:
mkfifo fifo
command > fifo &
trend fifo ...
Display the number of current active processes over time:
(while true; do ps -A | wc -l; sleep
1; done) | \
trend - 60x24
Display two graphs:
trend -c2a -L"graph 1, graph
2" fifo ...
The trend
utility exits 0 on
success, and >0 if an error occurs.
trend
is distributed under LGPL (see
COPYING)
WITHOUT ANY
WARRANTY. Copyright(c) 2003-2009 by Yuri
D'Elia ⟨wavexx@thregr.org⟩.
November 2, 2007 |