@cryptotaxi247 / netdata-1 / commits / 4fc83902f

documentation and fixed a rounding bug

Costa Tsaousis (ktsaou) committed Apr 30, 2014 at 02:04 UTC 4fc83902f4a235eacd2d3eb0604ed70613fc70ac
2 files changed +34 -16
charts.d/skeleton-chart.sh
+32 -14
@@ -19,8 +19,8 @@ echo "MYPID $$"
19
20 # -----------------------------------------------------------------------------
21 # create a new chart
22 -# > CHART type.chartname family[=chartname] homegroup[=type] charttype priority[=1000]
23 -# charttype = line or area or stacked
22 +# > CHART type.chartname family[=chartname] homegroup[=type] charttype[=line] priority[=1000] update_every[=user default]
23 +# charttype = line, area or stacked
24 # homegroup = any name or the word 'none' which hides the chart from the home web page
25 #
26 # set the chart title
@@ -29,11 +29,8 @@ echo "MYPID $$"
29 # set the units of measurement
30 # > UNITS my wonderfull unit
31 #
32 -# you can overwrite the update frequency as you need
33 -# > UPDATE EVERY $update_every
34 -#
32 # create all the dimensions you need
36 -# > DIMENSION CREATE dimensionname1 algorithm signed|unsigned byte|char|int|long|long long multiplier divisor [hidden]"
33 +# > DIMENSION CREATE dimensionname algorithm multiplier divisor [hidden]"
34 #
35 # algorithms:
36 # absolute
@@ -50,17 +47,38 @@ echo "MYPID $$"
47 # the % is drawn of this value compared to the differential total of
48 # each dimension
49 #
53 -# number sizes:
54 -# unsigned byte = 1 byte = 0 ... 255
55 -# unsigned int = 2 bytes = 0 ... 65.535
56 -# unsigned long = 4 bytes = 0 ... 4.294.967.295
57 -# unsigned long long = 8 bytes = 0 ... 18.446.744.073.709.551.615
58 -#
59 -# signed values are from - to + the half of the above
50 +# A NOTE ABOUT VALUES
51 +# NetData will collect any signed value in the 64bit range:
52 +#
53 +# -9.223.372.036.854.775.807 to +9.223.372.036.854.775.807
54 +#
55 +# However, to lower its memory requirements, it stores all values in the
56 +# signed 32bit range, divided by 10, that is:
57 +#
58 +# -214.748.364 to 214.748.364
59 +#
60 +# This division by 10, is used to give you a decimal point in the charts.
61 +# In memory, every number is 4 bytes (32bits).
62 +#
63 +# To work with this without loosing detail, you should set the proper
64 +# algorithm of calculation, together with a multiplier and a divider.
65 +#
66 +# The algorithm is applied in the wider 64bit numbers. Once the calculation
67 +# is complete the value is multiplied by the multiplier, by 10, and then
68 +# divided by the divider (all of these at the 64bit level).
69 +# The 64bit result is then stored in a 32 bit signed int.
70 +#
71 +# So, at the chart level:
72 +#
73 +# - the finest number is 0.1
74 +# - the smallest -214.748.364,7
75 +# - the highest 214.748.364,7
76 +#
77 +# You should choose a multiplier and divider to stay within these limits.
78 #
79
80 cat <<EOF
63 -CHART example.random ExampleGroup ExampleCategory stacked 1
81 +CHART example.random ExampleGroup ExampleCategory stacked 1 1
82 TITLE Random Numbers Example Chart
83 UNITS random numbers
84 UPDATE EVERY $update_every
netdata.c
+2 -2
@@ -1044,10 +1044,10 @@ void rrd_stats_done(RRD_STATS *st)
1044 break;
1045 }
1046
1047 - rd->calculated_value = rd->calculated_value * rd->multiplier / rd->divisor;
1047 + rd->calculated_value = rd->calculated_value * 10 * rd->multiplier / rd->divisor;
1048
1049 // store the calculated value
1050 - rd->values[st->current_entry] = rd->calculated_value * 10;
1050 + rd->values[st->current_entry] = rd->calculated_value;
1051 }
1052
1053 // store the time difference to the last entry