[rrd-developers] RRDGraph - formatting marker 'g' in [G]PRINF
Tarmo Ainsaar
Tarmo.Ainsaar at eenet.ee
Mon Nov 18 21:18:25 MET 2002
Hi
Just a minor itch - I'd like the RRDGraph to print float numbers a bit
more "nicely" in [G]PRINT.
RRDGraph is currently supporting only '%lf' and '%le' markers for
floating-point output. But all the OS-es I can get access to (incl some
versions of FreeBSD, Solaris and Linux) have also 'g' formatting flag in
printf, allowing to express numbers without extra precedeng whitespace
or trailing insignificant digits.
Compare following numbers, printed with at least 3 significant digits:
%6.2lf
1.8843 [ 1.88]
18.843 [ 18.84]
188.43 [188.43]
%4.3lg
1.8843 [1.88]
18.843 [18.8]
188.43 [ 188]
With 'g' marker the output is both more compact and human-readable, IMHO.
Relevant patch to rrdtool-1.0.40 is attached, for sample output see
http://www2.eenet.ee/rrd-pic.sample.png
using
GPRINT:inb:LAST: cur\: %4.3lg %s
GPRINT:inb:MIN: min\: %4.3lg %s
GPRINT:inb:AVERAGE: avg\: %4.3lg %s
GPRINT:inb:MAX: max\: %4.3lg %s\l
...
I'm not too sure about this idea, because my access to various OS-es and
their standard libraries is limited. Thus i can not guarantee that
current patch will improve output on all platforms. (But it shouldn't
broke anything either...?)
With regards,
--
Tarmo Ainsaar
EENet
http://www.eenet.ee/
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list