cedlecomte / RTG2

Realtime Traffic Grapher 2
GNU General Public License v2.0
11 stars 9 forks source link

Get the Nth Percentile on the graph #29

Open cedlecomte opened 10 years ago

cedlecomte commented 10 years ago

From ced.leco...@gmail.com on February 19, 2012 09:46:11

i have make some test to obtain the Nth percentile on the graph.

It's a little dirty and just a POC. Say me if it can be a interesting feature, I will review the code to do a better solution.

--- ../../rtg2-0.9.1-1/src/rtgplot.c 2012-02-17 16:12:13.000000000 +0100 +++ rtgplot.c 2012-02-19 15:38:07.000000000 +0100 @@ -1,4 +1,5 @@ /**** + Program: $Id: rtgplot.c,v 1.61 2008/01/19 03:01:32 btoneill Exp $ Author: $Author: btoneill $ Date: $Date: 2008/01/19 03:01:32 $ @@ -144,6 +145,7 @@ float interfaceSpeed = 0.0; data_obj_list_t DOLptr; data_t dataPtr;

-void plot_legend(gdImagePtr img, plot_obj_t graph, line_obj_t LO, int offset) { +void plot_legend(gdImagePtr img, plot_obj_t graph, line_obj_t LO, int offset, data_t *nth) { char total[BUFSIZE]; char max[BUFSIZE]; char avg[BUFSIZE]; char cur[BUFSIZE];

+data_t copyData(data_t src) {

--- ../../rtg2-0.9.1-1/src/rtgplot.h 2012-02-17 16:12:13.000000000 +0100 +++ rtgplot.h 2012-02-19 15:22:00.000000000 +0100 @@ -38,7 +38,7 @@

define DEFAULT_UNITS "bps"

define NUM_LINE_COLORS 10

-#define LEGEND_MAX_LEN 17 +#define LEGEND_MAX_LEN 10

define COPYRIGHT "RTG"

define DEBUGLOG "/tmp/rtgplot.log"

@@ -169,7 +169,7 @@ void writegraph(gdImagePtr , char ); void plot_scale(gdImagePtr , plot_obj_t ); void plot_labels(gdImagePtr , plot_obj_t ); -void plot_legend(gdImagePtr , plot_obj_t , line_obj_t , int); +void plot_legend(gdImagePtr , plot_obj_t , line_obj_t , int, data_t ); void init_colors(gdImagePtr , color_t _); void calculate_rate(datat *, rate_t ); void calculate_total(data_t _, rate_t ); @@ -200,6 +200,7 @@ int copyDO(data_obj_t , data_obj_t ); void clearEmpties(); void rateFactor(rate_t , int); +data_t copyData(data_t );

/* Precasts: rtgparse.c _/ char getField(char c, char sep, char *_result);

Attachment: rtgplot.cgi.png

Original issue: http://code.google.com/p/rtg2/issues/detail?id=29

bewing commented 9 years ago

It looks like this moves the percentile line plot to the legend plotter, and modifies the legend plot to include the numerical information. I like it.