[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
From: |
mldonkey-commits |
Subject: |
[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co... |
Date: |
Tue, 14 Nov 2006 11:23:11 +0000 |
CVSROOT: /sources/mldonkey
Module name: mldonkey
Changes by: spiralvoice <spiralvoice> 06/11/14 11:23:11
Modified files:
distrib : ChangeLog
src/daemon/common: commonGlobals.ml commonOptions.ml
commonUploads.ml
src/daemon/driver: driverCommands.ml driverGraphics_gd.ml
driverMain.ml
Log message:
patch #5530
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1088&r2=1.1089
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonGlobals.ml?cvsroot=mldonkey&r1=1.74&r2=1.75
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.185&r2=1.186
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonUploads.ml?cvsroot=mldonkey&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.194&r2=1.195
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverGraphics_gd.ml?cvsroot=mldonkey&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverMain.ml?cvsroot=mldonkey&r1=1.130&r2=1.131
Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1088
retrieving revision 1.1089
diff -u -b -r1.1088 -r1.1089
--- distrib/ChangeLog 13 Nov 2006 13:14:49 -0000 1.1088
+++ distrib/ChangeLog 14 Nov 2006 11:23:11 -0000 1.1089
@@ -14,6 +14,9 @@
ChangeLog
=========
+2006/11/14
+5530: GD: Improve graph output (skeeve, Schlumpf)
+
2006/11/13
5548: New search parameters: "-and", "-or", "-not", removed "-without"
(Schlumpf)
Index: src/daemon/common/commonGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -b -r1.74 -r1.75
--- src/daemon/common/commonGlobals.ml 12 Nov 2006 12:36:14 -0000 1.74
+++ src/daemon/common/commonGlobals.ml 14 Nov 2006 11:23:11 -0000 1.75
@@ -618,8 +618,12 @@
put time sample short_delay_bandwidth_samples;
trimto 5 short_delay_bandwidth_samples
+let history_step = 5
let history_size = 720
+let history_h_step = history_size * history_step
let history_h_size = 720
+let history_timeflag = ref 0.
+let history_h_timeflag = ref 0.
let upload_history = Fifo.create ()
let download_history = Fifo.create ()
@@ -638,7 +642,7 @@
let update_download_history () =
Fifo.put download_history (download_usage ());
let len = ref (Fifo.length download_history) in
- while !len > history_size do
+ while !len > history_size+1 do
ignore (Fifo.take download_history);
decr len
done
@@ -646,7 +650,7 @@
let update_upload_history () =
Fifo.put upload_history (upload_usage ());
let len = ref (Fifo.length upload_history) in
- while !len > history_size do
+ while !len > history_size+1 do
ignore (Fifo.take upload_history);
decr len
done
@@ -654,7 +658,7 @@
let update_h_download_history () =
Fifo.put download_h_history ((List.fold_left (+) 0 (Fifo.to_list
download_history)) / ((Fifo.length download_history)));
let len = ref (Fifo.length download_h_history) in
- while !len > history_h_size do
+ while !len > history_h_size+1 do
ignore (Fifo.take download_h_history);
decr len
done
@@ -662,7 +666,7 @@
let update_h_upload_history () =
Fifo.put upload_h_history ((List.fold_left (+) 0 (Fifo.to_list
upload_history)) / ((Fifo.length upload_history)));
let len = ref (Fifo.length upload_h_history) in
- while !len > history_h_size do
+ while !len > history_h_size+1 do
ignore (Fifo.take upload_h_history);
decr len
done
Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.185
retrieving revision 1.186
diff -u -b -r1.185 -r1.186
--- src/daemon/common/commonOptions.ml 9 Nov 2006 21:32:26 -0000 1.185
+++ src/daemon/common/commonOptions.ml 14 Nov 2006 11:23:11 -0000 1.186
@@ -799,13 +799,25 @@
bool_option true
let html_mods_vd_gfx_x_size = define_expert_option current_section
["html_mods_vd_gfx_x_size"]
- "Graph x size in vd output ( 320 < x < 3600 )"
- int_option 630
+ "Graph x size in vd output ( 365 < x < 3665 )"
+ int_option 795
let html_mods_vd_gfx_y_size = define_expert_option current_section
["html_mods_vd_gfx_y_size"]
"Graph y size in vd output ( 200 < y < 1200 )"
int_option 200
+let html_mods_vd_gfx_h_dynamic = define_expert_option current_section
["html_mods_vd_gfx_h_dymamic"]
+ "Dynamic grid width, start with 1 h/grid, maximum
html_mods_vd_gfx_h_grid_time h/grid"
+ bool_option true
+
+let html_mods_vd_gfx_h_grid_time = define_expert_option current_section
["html_mods_vd_gfx_h_grid_time"]
+ "Max hours on time scale per grid (0 = no limit)"
+ int_option 0
+
+let html_mods_vd_gfx_subgrid = define_expert_option current_section
["html_mods_vd_gfx_subgrid"]
+ "Number of shown subgrids on graph (0 = no subgrids)"
+ int_option 0
+
let html_mods_vd_gfx_tag = define_expert_option current_section
["html_mods_vd_gfx_tag"]
"Draw tag graph"
bool_option false
Index: src/daemon/common/commonUploads.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonUploads.ml,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- src/daemon/common/commonUploads.ml 5 Nov 2006 14:09:38 -0000 1.49
+++ src/daemon/common/commonUploads.ml 14 Nov 2006 11:23:11 -0000 1.50
@@ -962,34 +962,18 @@
end
let turn = ref (-1)
-let turn_h = ref (-1)
let refill_upload_slots () =
incr turn;
if !turn = 5 then
turn := 0;
- if !turn_h = 360 then
- turn_h := 0;
if !!dynamic_slots then begin
if !turn = 0 then
(* call every 5s *)
dynamic_refill_upload_slots ()
end else
(* call every 1s *)
- static_refill_upload_slots ();
-
- if !turn = 0 then begin
- (* call every 5s *)
- incr turn_h;
- update_download_history ();
- update_upload_history ()
- end;
-
- if !turn_h = 0 then begin
- (* call every 720 * 5s *)
- update_h_download_history ();
- update_h_upload_history ()
- end
+ static_refill_upload_slots ()
let consume_bandwidth len =
streaming_left := !streaming_left - len
Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -b -r1.194 -r1.195
--- src/daemon/driver/driverCommands.ml 13 Nov 2006 13:10:17 -0000 1.194
+++ src/daemon/driver/driverCommands.ml 14 Nov 2006 11:23:11 -0000 1.195
@@ -1678,6 +1678,9 @@
strings_of_option html_mods_vd_gfx_mean;
strings_of_option html_mods_vd_gfx_transparent;
strings_of_option html_mods_vd_gfx_h;
+ strings_of_option html_mods_vd_gfx_h_dynamic;
+ strings_of_option html_mods_vd_gfx_h_grid_time;
+ strings_of_option html_mods_vd_gfx_subgrid;
strings_of_option html_mods_vd_gfx_x_size;
strings_of_option html_mods_vd_gfx_y_size;
strings_of_option html_mods_vd_gfx_tag;
Index: src/daemon/driver/driverGraphics_gd.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverGraphics_gd.ml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- src/daemon/driver/driverGraphics_gd.ml 25 Jan 2006 22:44:08 -0000
1.1
+++ src/daemon/driver/driverGraphics_gd.ml 14 Nov 2006 11:23:11 -0000
1.2
@@ -47,14 +47,6 @@
module Graphics : Graphics = struct
-(* some thoughts
-type gfx_settings = {
- win_x : int;
- win_y : int;
- vtext : string;
- }
-*)
-
(* some defs *)
let reverse lst =
let rec reverseAux lst acc =
@@ -73,138 +65,140 @@
| [x] -> x
| x::xs -> max x (maxlist xs)
-
(* set some vars *)
-let samples_time = 5
-let samples_h_time = 720
+
+let history_time = history_size * history_step
+let history_h_time = history_h_size * history_h_step
+
+(* define margins *)
+let left_margin = 20
+let right_margin = 45
+let top_margin = 16
+let bottom_margin = 24
(* set _x and _y with boundaries *)
-let tag_x() = if !!html_mods_vd_gfx_tag_x_size < 130 then 130
- else if !!html_mods_vd_gfx_tag_x_size > 3600 then 3600
- else !!html_mods_vd_gfx_tag_x_size
-let tag_y() = if !!html_mods_vd_gfx_tag_y_size < 50 then 50
- else if !!html_mods_vd_gfx_tag_y_size > 1200 then 1200
- else !!html_mods_vd_gfx_tag_y_size
-let win_x() = if !!html_mods_vd_gfx_x_size < 320 then 320
- else if !!html_mods_vd_gfx_x_size > 3600 then 3600
- else !!html_mods_vd_gfx_x_size
-let win_y() = if !!html_mods_vd_gfx_y_size < 200 then 200
- else if !!html_mods_vd_gfx_y_size > 1200 then 1200
- else !!html_mods_vd_gfx_y_size
-
-let vtext = "0"
-let x_divisions() = (win_x()) / 80
-let y_divisions() = (win_y()) / 30
-let x_fdivisions() = float_of_int (x_divisions())
-let y_fdivisions() = float_of_int (y_divisions())
-
-(* todo: limit to 4 max *)
-let xmult = 1
-let xgmult = 16
-(* todo: limit to 4 max *)
-let ymult = 1
-let xdivisions() = (x_divisions()) * xmult
-let fxdivisions() = float_of_int (xdivisions())
-let xgdivisions() = (x_divisions()) * xgmult
-let fxgdivisions() = float_of_int (xgdivisions())
-let ydivisions() = (y_divisions()) * ymult
-let fydivisions() = float_of_int (ydivisions())
-let vmax_auto() = if detected_downlink_capacity () < detected_uplink_capacity
() then
- (detected_uplink_capacity ())
+let tag_x () = min (max 130 !!html_mods_vd_gfx_tag_x_size) 3600
+let tag_y () = min (max 50 !!html_mods_vd_gfx_tag_y_size) 1200
+let win_x () = min (max 365 !!html_mods_vd_gfx_x_size) 3665
+let win_y () = min (max 200 !!html_mods_vd_gfx_y_size) 1200
+
+let round_down x =
+ let values = [120; 60; 30; 15; 12; 10; 6; 4; 3; 2; 1; 0] in
+ max 1 (List.find ((>=) x) values)
+
+let round_up x =
+ let v = min x 120 in
+ let values = [0; 1; 2; 3; 4; 5; 10; 15; 30; 60; 120] in
+ List.find ((<=) v) values
+
+let round_h_up x =
+ let v = min x 840 in
+ let values = [1; 2; 3; 4; 5; 10; 15; 30; 60; 120; 180; 240; 300; 360; 480;
720; 1440; 2880; 4320; 5760; 7200; 8640; 10080; 11520; 12960; 14400; 15840;
17280; 18720; 20160; 30240; 40320; 50400; 60480; 70560; 80640; 90720] in
+ List.find ((<=) v) values
+
+let round_h_down x =
+ let values = [90720; 80640; 70560; 60480; 50400; 40320; 30240; 20160; 18720;
17280; 15840; 14400; 12960; 11520; 10080; 8640; 7200; 5760; 4320; 2880; 1440;
720; 480; 360; 300; 240; 180; 120; 60; 30; 15; 10; 5; 4; 3; 2; 1; 0] in
+ max 1 (List.find ((>=) x) values)
+
+(* calculate x-values *)
+let x_time_per_grid() = 60 * round_up (history_time / (60 * ((win_x () -
left_margin - right_margin) / 60)))
+let x_divisions () = history_time / (x_time_per_grid ())
+let x_fdivisions () = float_of_int (x_divisions ())
+
+let x_h_time_per_grid g = max history_h_step (
+ if !!html_mods_vd_gfx_h_dynamic then
+ begin
+ if !!html_mods_vd_gfx_h_grid_time >= 1 then
+ min (round_h_down (!!html_mods_vd_gfx_h_grid_time * 60))
+ (min
+ ((round_h_up ((((Fifo.length g) + x_divisions () - 2) /
(x_divisions())) * history_h_step/60 )) * 60)
+ ((round_h_down ( history_h_time / (60 * x_divisions()) )) * 60))
+ else
+ min ((round_h_up ((((Fifo.length g) + x_divisions () - 2) /
(x_divisions ())) * history_h_step / 60)) * 60)
+ ((round_h_down (history_h_time / (60 * x_divisions ()) )) * 60)
+ end
else
- (detected_downlink_capacity ())
+ if !!html_mods_vd_gfx_h_grid_time >= 1 then
+ round_h_down (!!html_mods_vd_gfx_h_grid_time * 60)
+ else
+ round_h_down (history_h_time / (60 * x_divisions ())))
let vmax link = (detected_link_capacity link)
-let vx() = (fxgdivisions()) /. (x_fdivisions())
-let vy() = (((float_of_int(vmax_auto())) /. 1024.) +. 2.) /. (y_fdivisions())
-let vy_m link = (((float_of_int(vmax link)) /. 1024.) +. 2.) /.
(y_fdivisions())
+let x_h_time g = (x_divisions() * x_h_time_per_grid g)
+let x_h_values g = ((x_h_time g) / history_h_step)
-(* define margins *)
-let left_margin = 20
-let right_margin = 45
-let top_margin = 16
-let bottom_margin = 20
+(* calculate y-values *)
+let y_divisions () = ((win_y() - top_margin - bottom_margin)) / 50 * 2
+let y_fdivisions () = float_of_int (y_divisions())
+
+let vmax_auto () = max (detected_uplink_capacity())
(detected_downlink_capacity())
let samples_size = win_x() - (left_margin + right_margin)
let xbl = left_margin
let xbr() = win_x() - right_margin
let xbs() = xbr() - xbl
-let ybt = top_margin
-let ybb() = win_y() - bottom_margin
+let ybt = (top_margin / 2) * 2
+let ybb() = ((win_y () - bottom_margin) / 2) * 2 - 1
let ybs() = ybb() - ybt
let vdt() = float_of_int(ybs()) /. float_of_int(vmax_auto())
let vdt_m link = float_of_int(ybs()) /. float_of_int(vmax link)
-let vdt_stack link = float_of_int(ybs() / 2) /. float_of_int(vmax link)
+let vdt_stack link = float_of_int((ybs() / 2)-1) /. float_of_int(vmax link)
let ttl = ref ""
let vl = ref ""
let hl = ref ""
-let graph_length g =
- if (Fifo.length g) < (xgdivisions()) then
- ((Fifo.length g) - 1)
- else
- (xgdivisions())
-
-let datas_length g =
- ((Fifo.length g))
-
-let l_max g =
- (List.fold_left max 0 (Fifo.to_list g))
-
-let datas = Array.create history_size 0
-
+let l_max g = (List.fold_left max 0 (Fifo.to_list g))
let draw_borders mypic gcolor =
- let my_y = (ybb()) in
- let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *.
(float_of_int(xbs()))) +. (float_of_int xbl)) in
- let my_x = (xbr()) in
- let fy x = int_of_float ((((float_of_int x) /. (fydivisions())) *.
(float_of_int(ybs()))) +. (float_of_int ybt)) in
- mypic#line ~x1:(fx 0) ~y1:ybt ~x2:(fx 0) ~y2:my_y gcolor;
- mypic#line ~x1:(fx (xdivisions())) ~y1:ybt ~x2:(fx (xdivisions())) ~y2:my_y
gcolor;
- mypic#line ~x1:xbl ~y1:(fy 0) ~x2:my_x ~y2:(fy 0) gcolor;
- mypic#line ~x1:xbl ~y1:(fy (ydivisions())) ~x2:my_x ~y2:(fy (ydivisions()))
gcolor
+ mypic#line ~x1:(xbl-1) ~y1:(ybt-1) ~x2:(xbl-1) ~y2:(ybb()+1) gcolor;
+ mypic#line ~x1:(xbr()+1) ~y1:(ybt-1) ~x2:(xbr()+1) ~y2:(ybb()+1) gcolor;
+ mypic#line ~x1:(xbl-1) ~y1:(ybt-1) ~x2:(xbr()+1) ~y2:(ybt-1) gcolor;
+ mypic#line ~x1:(xbl-1) ~y1:(ybb()+1) ~x2:(xbr()+1) ~y2:(ybb()+1) gcolor
let draw_stack_borders mypic gcolor =
- let my_y = (ybb()) in
- let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *.
(float_of_int(xbs()))) +. (float_of_int xbl)) in
- let my_x = (xbr()) in
- let fy x = int_of_float ((((float_of_int x) /. (fydivisions())) *.
(float_of_int(ybs()))) +. (float_of_int ybt)) in
- mypic#line ~x1:(fx 0) ~y1:ybt ~x2:(fx 0) ~y2:my_y gcolor;
- mypic#line ~x1:(fx (xdivisions())) ~y1:ybt ~x2:(fx (xdivisions())) ~y2:my_y
gcolor;
- mypic#line ~x1:xbl ~y1:(fy 0) ~x2:my_x ~y2:(fy 0) gcolor;
- mypic#line ~x1:xbl ~y1:(fy (ydivisions())) ~x2:my_x ~y2:(fy (ydivisions()))
gcolor;
- mypic#line ~x1:xbl ~y1:(my_y - ((my_y - ybt) / 2)) ~x2:my_x ~y2:(my_y -
((my_y - ybt) / 2)) gcolor
+ draw_borders mypic gcolor;
+ mypic#line ~x1:(xbl-1) ~y1:(ybt+ybs()/2) ~x2:(xbr()+1) ~y2:(ybt+ybs()/2)
gcolor
-let draw_x_grid mypic gcolor =
+let draw_x_grid mypic gcolor gcolor2 my_xdivisons =
+ let my_sdivisions = max 1 !!html_mods_vd_gfx_subgrid in
+ let my_xsdivisons = xbs() / my_xdivisons / my_sdivisions in
let my_y = (ybb()) in
- let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *.
(float_of_int(xbs()))) +. (float_of_int xbl)) in
- for n = 1 to xdivisions() - 1 do
- mypic#dashed_line ~x1:(fx n) ~y1:ybt ~x2:(fx n) ~y2:my_y gcolor;
+ let fx x = (((x * xbs()) / my_xdivisons) + xbl + 2) in
+ let fxs x y = (fx x + my_xsdivisons * y) in
+ for n = 1 to my_xdivisons - 1 do
+ (*mypic#string ~font:Gd.Font.small ~x:(fx n) ~y:(2) ~s:(string_of_int (fx
n)) gcolor;*)
+ mypic#dashed_line ~x1:(fx n) ~y1:(ybt) ~x2:(fx n) ~y2:my_y gcolor;
+ done;
+ if my_sdivisions > 1 then
+ for n = 0 to my_xdivisons - 1 do
+ for m = 1 to my_sdivisions - 1 do
+ mypic#dashed_line ~x1:(fxs n m) ~y1:(ybt) ~x2:(fxs n m) ~y2:my_y
gcolor2;
+ done;
done
let draw_y_grid mypic gcolor =
- let my_x = (xbr()) in
- let fy x = int_of_float ((((float_of_int x) /. (fydivisions())) *.
(float_of_int(ybs()))) +. (float_of_int ybt)) in
- for n = 1 to ydivisions() - 1 do
- mypic#dashed_line ~x1:xbl ~y1:(fy n) ~x2:my_x ~y2:(fy n) gcolor;
+ let fy x = (((x * ybs()) / y_divisions()) + ybt) in
+ for n = 1 to y_divisions() - 1 do
+ mypic#dashed_line ~x1:xbl ~y1:(fy n) ~x2:(xbr()) ~y2:(fy n) gcolor;
done
let draw_arrow mypic gcolor =
- let my_x = (xbr()) in
- let my_y = (ybb()) in
+ let my_x = (xbr()+1) in
+ let my_y = (ybb()+1) in
mypic#line ~x1:(my_x - 4) ~y1:(my_y + 4) ~x2:(my_x + 4) ~y2:(my_y) gcolor;
mypic#line ~x1:(my_x - 4) ~y1:(my_y - 4) ~x2:(my_x + 4) ~y2:(my_y) gcolor;
mypic#line ~x1:(my_x - 4) ~y1:(my_y - 4) ~x2:(my_x - 4) ~y2:(my_y + 4)
gcolor;
mypic#fill ~x:(my_x - 1) ~y:(my_y - 1) gcolor;
+ mypic#fill ~x:(my_x - 3) ~y:(my_y - 1) gcolor;
mypic#fill ~x:(my_x - 1) ~y:(my_y + 1) gcolor;
mypic#fill ~x:(my_x + 1) ~y:(my_y) gcolor
let draw_tag mypic title gdown gup gcolor =
let my_sum gl = List.fold_left (+) 0 (Fifo.to_list gl) in
- let meanx gl = ((float_of_int (my_sum gl)) /. (float_of_int ((Fifo.length
gl) - 1))) in
+ let meanx gl = ((float_of_int (my_sum gl)) /. (float_of_int (Fifo.length
gl))) in
let down_bw = (string_of_float (float_of_int(int_of_float((meanx gdown) /.
1024. *. 100.)) /. 100.)) in
let up_bw = (string_of_float (float_of_int(int_of_float((meanx gup) /. 1024.
*. 100.)) /. 100.)) in
let bw_d = "Dl: " ^ down_bw ^ "KB/s "
@@ -218,16 +212,16 @@
mypic#string_up ~font:Gd.Font.giant ~x:2 ~y:((win_y / 2) + (((String.length
title) * 8) / 2)) ~s:title gcolor
let draw_top_legend mypic title tcolor gcolor scolor win_y =
- mypic#line ~x1:(xbl + 1) ~y1:9 ~x2:(xbl + 11) ~y2:9 scolor;
+ mypic#line ~x1:xbl ~y1:9 ~x2:(xbl + 10) ~y2:9 scolor;
mypic#line ~x1:xbl ~y1:8 ~x2:(xbl + 10) ~y2:8 gcolor;
mypic#string ~font:Gd.Font.small ~x:(xbl + 16) ~y:2 ~s:title tcolor
let draw_dual_top_legend mypic titlel tcolorl gcolorl scolorl titler tcolorr
gcolorr scolorr win_y =
let my_x = (xbr()) in
- mypic#line ~x1:(xbl + 1) ~y1:9 ~x2:(xbl + 11) ~y2:9 scolorl;
+ mypic#line ~x1:xbl ~y1:9 ~x2:(xbl + 10) ~y2:9 scolorl;
mypic#line ~x1:xbl ~y1:8 ~x2:(xbl + 10) ~y2:8 gcolorl;
mypic#string ~font:Gd.Font.small ~x:(xbl + 16) ~y:2 ~s:titlel tcolorl;
- mypic#line ~x1:(my_x - 1) ~y1:9 ~x2:(my_x - 11) ~y2:9 scolorr;
+ mypic#line ~x1:my_x ~y1:9 ~x2:(my_x - 10) ~y2:9 scolorr;
mypic#line ~x1:my_x ~y1:8 ~x2:(my_x - 10) ~y2:8 gcolorr;
mypic#string ~font:Gd.Font.small ~x:(my_x - (((String.length titler) * 8)) -
2) ~y:2 ~s:titler tcolorr
@@ -246,7 +240,7 @@
let my_y = (ybb() - (ybs() / 2)) in
let fy x = int_of_float ((float_of_int my_y) -. (((float_of_int x) /.
(y_fdivisions())) *. (float_of_int(ybs())))) in
let vtext n = (string_of_float (float_of_int(int_of_float((float_of_int
(my_y - (fy n))) /. (vdt_stack g) /. 1024. *. 100.)) /. 100.)) in
- for n = 1 to ((y_divisions()) - 1) do
+ for n = 1 to ((y_divisions()) / 2) do
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy n) - 12 + offset)
~s:(vtext n) gcolor;
done;
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) -
5) ~s:(legend_text) lcolor
@@ -256,151 +250,145 @@
let my_y = (ybb() - (ybs() / 2)) in
let fy x = int_of_float ((float_of_int my_y) +. (((float_of_int x) /.
(y_fdivisions())) *. (float_of_int(ybs())))) in
let vtext n = (string_of_float (float_of_int(int_of_float((float_of_int ((fy
n) - my_y)) /. (vdt_stack g) /. 1024. *. 100.)) /. 100.)) in
- for n = 1 to ((y_divisions()) - 1) do
+ for n = 1 to ((y_divisions()) / 2) do
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy n) - 12 + offset)
~s:(vtext n) gcolor;
done;
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) -
5) ~s:(legend_text) lcolor
-let draw_h_legend mypic g legend_text gcolor my_time =
+let draw_h_legend mypic g legend_text gcolor my_time basetime show_days =
let my_x = (xbr()) in
- let my_x2 = (xbs()) in
let my_y = (ybb()) in
- let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /.
(x_fdivisions())) *. (float_of_int my_x2))) in
- (* and vtext n = (string_of_int (int_of_float((float_of_int(n))*. vx ))) in
*)
- let basetime = Unix.gettimeofday () in
- let timer n = Unix.localtime (basetime -. ((float_of_int(n)) *.
float_of_int(my_time) *. vx())) in
+ let fx x = my_x + 4 - (x * (xbs ()) / x_divisions ()) in
let time_string n =
- let time = timer n in
- let h0 = string_of_int(time.Unix.tm_hour ) and (* H *)
- m0 = string_of_int(time.Unix.tm_min ) and (* M *)
- s0 = string_of_int(time.Unix.tm_sec ) in (* S *)
- (if String.length h0 = 2 then h0 else "0"^h0) ^":"^
- (if String.length m0 = 2 then m0 else "0"^m0) ^":"^
- (if String.length s0 = 2 then s0 else "0"^s0) in
-
- for n = 1 to ((x_divisions()) - 1) do
- mypic#string ~font:Gd.Font.small ~x:((fx n) - ((String.length
(time_string n) * 5) / 2)) ~y:(my_y + 5) ~s:(time_string n) gcolor;
+ let time = Unix.localtime (basetime -. float_of_int(n * my_time /
x_divisions ())) in
+ Printf.sprintf "%02d:%02d:%02d" time.Unix.tm_hour time.Unix.tm_min
time.Unix.tm_sec
+ in
+ let day_string n =
+ let time = Unix.localtime (basetime -. float_of_int(n * my_time /
x_divisions ())) in
+ Printf.sprintf "%02d.%02d." time.Unix.tm_mon time.Unix.tm_mday
+ in
+ if show_days then
+ begin
+ for n = 0 to (x_divisions() - 1) do
+ mypic#string ~font:Gd.Font.small ~x:((fx n) - (String.length
(time_string n) * 3) ) ~y:(my_y + 1) ~s:(time_string n) gcolor;
+ mypic#string ~font:Gd.Font.small ~x:((fx n) - (String.length
(day_string n) * 3) ) ~y:(my_y + 11) ~s:(day_string n) gcolor;
done;
- mypic#string ~font:Gd.Font.small ~x:((fx (x_divisions())) -
((String.length (legend_text) * 4) / 2)) ~y:(my_y + 5) ~s:(legend_text) gcolor
+ mypic#string ~font:Gd.Font.small ~x:(4) ~y:(my_y + 2) ~s:(legend_text)
gcolor;
+ mypic#string ~font:Gd.Font.small ~x:(4) ~y:(my_y + 11) ~s:("t(DD.MM.)")
gcolor
+ end
+ else
+ begin
+ for n = 0 to (x_divisions() - 1) do
+ mypic#string ~font:Gd.Font.small ~x:((fx n) - (String.length
(time_string n) * 3) ) ~y:(my_y + 5) ~s:(time_string n) gcolor;
+ done;
+ mypic#string ~font:Gd.Font.small ~x:(4) ~y:(my_y + 5) ~s:(legend_text)
gcolor
+ end
-let draw_load mypic g my_color shadow_color =
+let draw_load mypic g my_color shadow_color my_samples =
let my_x = (xbr()) in
- let my_x2 = (xbs()) in
let my_y = (ybb()) in
+ let my_s = min ((Fifo.length g)-1) my_samples in
+ let my_s2 = xbs() / my_samples / 4 in
let datas g n = List.nth (List.rev (Fifo.to_list g)) n in
- let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /.
(fxgdivisions())) *. (float_of_int my_x2)))
+ let fx x = my_x - (x * (xbs ()) / my_samples)
and y_c1 n = (my_y - (int_of_float(float_of_int(datas g n) *. (vdt_m g))))
and y_c2 n = (my_y - (int_of_float(float_of_int(datas g (n+1)) *. (vdt_m
g)))) in
(if !!html_mods_vd_gfx_fill then begin
- mypic#line ~x1:(fx 0) ~y1:my_y
- ~x2:(fx 0) ~y2:(if y_c1 0 >= my_y - 3 then
- ((y_c1 0) - 3) else ((y_c1 0))) shadow_color;
- for n = 0 to ((graph_length(g)) - 1) do
- (* trick to make sure filling will not fail *)
- if n = ((graph_length(g)) - 1) then
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 3 then
- ((y_c1 n) - 3) else ((y_c1 n))) ~x2:((fx (n+1))) ~y2:((y_c2 n))
shadow_color
- else begin
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 3 then
- ((y_c1 n) - 3) else ((y_c1 n)))
- ~x2:((fx (n+1))) ~y2:(if y_c2 n >= my_y - 3 then
- ((y_c2 n) - 3) else ((y_c2 n))) shadow_color
- end
+ if my_s2 = 0 then
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:(fx n) ~y1:(min (my_y-1)(y_c1 n)) ~x2:(fx(n+1))
~y2:(min (my_y-2)(y_c2 n)) shadow_color
+ done
+ else
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1: (fx n) ~y1:(min (my_y - 1) (y_c1 n))
~x2:((fx(n + 1)) + my_s2) ~y2:(min (my_y - 1) (y_c1 n)) shadow_color;
+ mypic#line ~x1:((fx(n + 1)) + my_s2) ~y1:(min (my_y - 1) (y_c1 n))
~x2: (fx(n + 1)) ~y2:(min (my_y - 1) (y_c2 n)) shadow_color
done;
+ if (fx my_s) > (xbl + 1) then
+ mypic#line ~x1:(fx my_s) ~y1:(min (my_y - 1) (y_c1 my_s)) ~x2:(fx my_s)
~y2:(my_y) shadow_color;
mypic#fill ~x:(my_x - 1) ~y:(my_y - 1) my_color;
end
else begin
- for n = 0 to ((graph_length(g)) - 1) do
- mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n) + 1) ~x2:((fx (n+1)) + 1)
~y2:((y_c2 n) + 1) shadow_color;
- mypic#line ~x1:(fx n) ~y1:(y_c1 n) ~x2:(fx (n+1)) ~y2:(y_c2 n) my_color
+ if my_s2 = 0 then
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:((fx n)+1) ~y1:((y_c1 n)+1) ~x2:((fx (n+1))+1)
~y2:((y_c2 n)+1) shadow_color;
+ mypic#line ~x1:( fx n) ~y1:(y_c1 n) ~x2:( fx (n+1)) ~y2:(y_c2 n)
my_color
+ done
+ else
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n)+1) ~x2:((fx(n +
1)) + 1 + my_s2) ~y2:((y_c1 n) + 1) shadow_color;
+ mypic#line ~x1:((fx(n + 1)) + 1 + my_s2) ~y1:((y_c1 n)+1) ~x2:((fx(n +
1)) + 1) ~y2:((y_c2 n) + 1) shadow_color;
+ mypic#line ~x1: (fx n) ~y1: (y_c1 n) ~x2:((fx(n +
1)) + my_s2) ~y2: (y_c1 n) my_color;
+ mypic#line ~x1:((fx(n + 1)) + my_s2) ~y1: (y_c1 n) ~x2:( fx(n +
1)) ~y2: (y_c2 n) my_color
done;
end
)
-let draw_stack_download mypic g my_color shadow_color =
+let draw_stack_download mypic g my_color shadow_color my_samples =
let my_x = (xbr()) in
let my_x2 = (xbs()) in
- let my_y = (ybb() - (ybs() / 2)) in
+ let my_y = (ybt -1 + (ybs() / 2)) in
+ let my_s = min ((Fifo.length g)-1) my_samples in
let datas g n = List.nth (List.rev (Fifo.to_list g)) n in
- let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /.
(fxgdivisions())) *. (float_of_int my_x2)))
- and y_c1 n = (my_y - (int_of_float(float_of_int(datas g n) *. (vdt_stack
g))))
- and y_c2 n = (my_y - (int_of_float(float_of_int(datas g (n+1)) *. (vdt_stack
g)))) in
+ let fx x = my_x - (x * my_x2 / my_samples) and
+ y_c1 n = my_y - int_of_float(float_of_int(datas g n) *. (vdt_stack g))
and
+ y_c2 n = my_y - int_of_float(float_of_int(datas g (n+1)) *. (vdt_stack
g))
+ in
(if !!html_mods_vd_gfx_fill then begin
- mypic#line ~x1:(fx 0) ~y1:my_y
- ~x2:(fx 0) ~y2:(if y_c1 0 >= my_y - 3 then
- ((y_c1 0) - 3) else ((y_c1 0))) shadow_color;
- for n = 0 to ((graph_length(g)) - 1) do
- (* trick to make sure filling will not fail *)
- if n = ((graph_length(g)) - 1) then
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 2 then
- ((y_c1 n) - 2) else ((y_c1 n))) ~x2:((fx (n+1))) ~y2:((y_c2 n))
shadow_color
- else begin
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 2 then
- ((y_c1 n) - 2) else ((y_c1 n)))
- ~x2:((fx (n+1))) ~y2:(if y_c2 n >= my_y - 2 then
- ((y_c2 n) - 2) else ((y_c2 n))) shadow_color
- end
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:(fx n) ~y1:(min (my_y-1) (y_c1 n)) ~x2:(fx(n+1)) ~y2:(min
(my_y-1) (y_c2 n)) shadow_color
done;
- mypic#fill ~x:(my_x - 1) ~y:(my_y - 1) my_color;
+ if (fx my_s) > (xbl+1) then
+ mypic#line ~x1:(fx my_s) ~y1:(my_y) ~x2:(fx my_s) ~y2:(min (my_y) (y_c1
my_s)) shadow_color;
+ mypic#fill ~x:(my_x) ~y:(my_y) my_color;
end
else begin
- for n = 0 to ((graph_length(g)) - 1) do
- mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n) + 1) ~x2:((fx (n+1)) + 1)
~y2:((y_c2 n) + 1) shadow_color;
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:((fx n)+1) ~y1:((y_c1 n)+1) ~x2:((fx (n+1))+1) ~y2:((y_c2
n)+1) shadow_color;
mypic#line ~x1:(fx n) ~y1:(y_c1 n) ~x2:(fx (n+1)) ~y2:(y_c2 n) my_color
done;
end
)
-let draw_stack_upload mypic g my_color shadow_color =
+let draw_stack_upload mypic g my_color shadow_color my_samples =
let my_x = (xbr()) in
let my_x2 = (xbs()) in
- let my_y = (ybb() - (ybs() / 2)) in
+ let my_y = (ybt + 1 + (ybs() / 2)) in
+ let my_s = min ((Fifo.length g)-1) my_samples in
let datas g n = List.nth (List.rev (Fifo.to_list g)) n in
- let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /.
(fxgdivisions())) *. (float_of_int my_x2)))
+ let fx x = my_x - (x * my_x2 / my_samples)
and y_c1 n = (my_y + (int_of_float(float_of_int(datas g n) *. (vdt_stack
g))))
and y_c2 n = (my_y + (int_of_float(float_of_int(datas g (n+1)) *. (vdt_stack
g)))) in
(if !!html_mods_vd_gfx_fill then begin
- mypic#line ~x1:(fx 0) ~y1:my_y
- ~x2:(fx 0) ~y2:(if y_c1 0 >= my_y - 3 then
- ((y_c1 0) - 3) else ((y_c1 0))) shadow_color;
- for n = 0 to ((graph_length(g)) - 1) do
- (* trick to make sure filling will not fail *)
- if n = ((graph_length(g)) - 1) then
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y + 2 then
- ((y_c1 n) + 2) else ((y_c1 n))) ~x2:((fx (n+1))) ~y2:((y_c2 n))
shadow_color
- else begin
- mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y + 2 then
- ((y_c1 n) + 2) else ((y_c1 n)))
- ~x2:((fx (n+1))) ~y2:(if y_c2 n >= my_y + 2 then
- ((y_c2 n) + 2) else ((y_c2 n))) shadow_color
- end
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:(fx n) ~y1:(max (my_y+1) (y_c1 n)) ~x2:(fx(n+1)) ~y2:(max
(my_y+1) (y_c2 n)) shadow_color
done;
- mypic#fill ~x:(my_x - 1) ~y:(my_y + 1) my_color;
+ if (fx my_s) > xbl+1 then
+ mypic#line ~x1:(fx my_s) ~y1:(my_y) ~x2:(fx my_s) ~y2:(max my_y (y_c1
my_s)) shadow_color;
+ mypic#fill ~x:(my_x) ~y:(my_y) my_color
end
else begin
- for n = 0 to ((graph_length(g)) - 1) do
- mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n) + 1) ~x2:((fx (n+1)) + 1)
~y2:((y_c2 n) + 1) shadow_color;
- mypic#line ~x1:(fx n) ~y1:(y_c1 n) ~x2:(fx (n+1)) ~y2:(y_c2 n) my_color
+ for n = 0 to my_s - 1 do
+ mypic#line ~x1:((fx n)+1) ~y1:(max (my_y+1)((y_c1 n)+1)) ~x2:((fx
(n+1))+1) ~y2:(max (my_y+1)((y_c2 n)+1)) shadow_color;
+ mypic#line ~x1:( fx n) ~y1:(max (my_y+1)(y_c1 n)) ~x2:( fx (n+1))
~y2:(max (my_y+1)(y_c2 n)) my_color
done;
end
)
-
-let draw_mean_line mypic g my_color gcolor =
- let my_x2 = (xbs())
- and my_y = (ybb()) in
+let draw_mean_line mypic g my_color shadow_color tcolor =
let my_sum gl = List.fold_left (+) 0 (Fifo.to_list gl) in
let meanx() = ((float_of_int (my_sum g)) /. (float_of_int ((Fifo.length
g)))) in
- let ypos = (my_y - (int_of_float((meanx()) *. (vdt_m g)))) in
+ let ypos = (ybb() - int_of_float(meanx() *. vdt_m g)) in
let vtext = (string_of_float (float_of_int(int_of_float(meanx() /. 1024. *.
100.)) /. 100.)) in
- mypic#line ~x1:xbl ~y1:(ypos - 1) ~x2:(xbl + my_x2 / 10) ~y2:(ypos - 1)
my_color;
- mypic#line ~x1:xbl ~y1:(ypos) ~x2:(xbl + my_x2 / 10) ~y2:(ypos) gcolor;
- mypic#string ~font:Gd.Font.small ~x:(xbl + 5) ~y:((ypos) + 2) ~s:(vtext)
gcolor
+ mypic#line ~x1:(xbl) ~y1:(ypos) ~x2:(xbl+1+ xbs() / x_divisions())
~y2:(ypos) my_color;
+ if ypos+1 < ybb() then
+ mypic#line ~x1:(xbl) ~y1:(ypos+1) ~x2:(xbl+1+ xbs() / x_divisions())
~y2:(ypos+1) shadow_color;
+ mypic#string ~font:Gd.Font.small ~x:(xbl) ~y:(ypos +2 ) ~s:(vtext) tcolor
let draw_mygraph mypic ttl top_title vl hl g =
(* init pic *)
(
let g_y = win_y() in
+ let mypic = Gd.create ~x:(win_x()) ~y:g_y in
(* set colors *)
let black = mypic#colors#black in
let red = mypic#colors#red in
@@ -412,11 +400,11 @@
draw_title mypic ttl black g_y;
draw_top_legend mypic top_title black red darkgrey g_y;
draw_v_legend mypic g vl black black 0;
- draw_h_legend mypic g hl black samples_time;
- draw_load mypic g green darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic g hl black history_time !history_timeflag false;
+ draw_load mypic g green darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
- (* draw_mean_line mypic gdown green black; *)
+ (* draw_mean_line mypic gdown green darkgrey black; *)
)
(* end of declarations *)
@@ -444,13 +432,13 @@
draw_borders mypic black;
draw_title mypic ttl black win_y;
draw_v_legend mypic vl black black 0;
- draw_h_legend mypic gdown hl black samples_time;
- draw_load mypic gdown green darkgrey;
- draw_load mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic gdown hl black history_time !history_timeflag false;
+ draw_load mypic gdown green darkgrey history_size;
+ draw_load mypic gup red darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
-(* draw_mean_line mypic gdown green black;*)
+ (* draw_mean_line mypic gdown green darkgrey black;*)
(* mypic#out_as_jpeg "line.jpg" ~quality:90; *)
*)
@@ -477,16 +465,16 @@
(* draw graph *)
draw_title mypic ttl black g_y;
draw_dual_top_legend mypic "download" black green darkgrey "upload" black
red darkgrey g_y;
- draw_h_legend mypic gdown hl black samples_time;
+ draw_h_legend mypic gdown hl black history_time !history_timeflag false;
(if !!html_mods_vd_gfx_stack then begin
draw_stack_borders mypic black;
draw_stack_v_top_legend mypic gdown vl black darkgreen 5;
draw_stack_v_bottom_legend mypic gup vl black darkred 5;
(* enable filling for stack graph *)
if not !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= true;
- draw_stack_download mypic gdown green darkgrey;
- draw_stack_upload mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_stack_download mypic gdown green darkgrey history_size;
+ draw_stack_upload mypic gup red darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black
end
else begin
@@ -494,13 +482,13 @@
draw_v_legend mypic gdown vl black darkgreen 0;
draw_v_legend mypic gup vl black darkred 10;
if !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= false;
- draw_load mypic gdown green darkgrey;
- draw_load mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_load mypic gdown green darkgrey history_size;
+ draw_load mypic gup red darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
(if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gdown green black;
- draw_mean_line mypic gup red black
+ draw_mean_line mypic gdown green darkgrey black;
+ draw_mean_line mypic gup red darkgrey black
);
end);
draw_arrow mypic darkred;
@@ -514,9 +502,8 @@
let do_draw_down_pic ttl top_title vl hl gdown =
(* init pic *)
(
- let g_x = win_x() in
let g_y = win_y() in
- let mypic = Gd.create ~x:g_x ~y:g_y in
+ let mypic = Gd.create ~x:(win_x()) ~y:g_y in
(* set colors *)
let white = mypic#colors#white in
@@ -532,13 +519,13 @@
draw_title mypic ttl black g_y;
draw_top_legend mypic top_title black green darkgrey g_y;
draw_v_legend mypic gdown vl black black 6;
- draw_h_legend mypic gdown hl black samples_time;
- draw_load mypic gdown green darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic gdown hl black history_time !history_timeflag false;
+ draw_load mypic gdown green darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
draw_arrow mypic darkred;
if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gdown green black;
+ draw_mean_line mypic gdown green darkgrey black;
(if !!html_mods_vd_gfx_png then
mypic#save_as_png "bw_download.png"
@@ -550,9 +537,8 @@
let do_draw_up_pic ttl top_title vl hl gup =
(* init pic *)
(
- let g_x = win_x() in
let g_y = win_y() in
- let mypic = Gd.create ~x:g_x ~y:g_y in
+ let mypic = Gd.create ~x:(win_x()) ~y:g_y in
(* set colors *)
let white = mypic#colors#white in
@@ -568,13 +554,13 @@
draw_title mypic ttl black g_y;
draw_top_legend mypic top_title black red darkgrey g_y;
draw_v_legend mypic gup vl black black 6;
- draw_h_legend mypic gup hl black samples_time;
- draw_load mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic gup hl black history_time !history_timeflag false;
+ draw_load mypic gup red darkgrey history_size;
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
draw_arrow mypic darkred;
if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gup red black;
+ draw_mean_line mypic gup red darkgrey black;
(if !!html_mods_vd_gfx_png then
mypic#save_as_png "bw_upload.png"
@@ -588,6 +574,7 @@
(
let g_y = win_y() in
let mypic = Gd.create ~x:(win_x()) ~y:g_y in
+ let x_legend_days = (int_of_float !history_h_timeflag) mod 86400 < (x_h_time
gdown) in
(* set colors *)
let white = mypic#colors#white in
@@ -606,16 +593,16 @@
draw_dual_top_legend mypic "download" black green darkgrey "upload" black
red darkgrey g_y;
draw_v_legend mypic gdown vl black darkgreen 0;
draw_v_legend mypic gup vl black darkred 10;
- draw_h_legend mypic gdown hl black samples_h_time;
+ draw_h_legend mypic gup hl black (x_h_time gdown) !history_h_timeflag
x_legend_days;
if !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= false;
- draw_load mypic gdown green darkgrey;
- draw_load mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_load mypic gdown green darkgrey (x_h_values gdown);
+ draw_load mypic gup red darkgrey (x_h_values gdown);
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
draw_arrow mypic darkred;
(if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gdown green black;
- draw_mean_line mypic gup red black
+ draw_mean_line mypic gdown green darkgrey black;
+ draw_mean_line mypic gup red darkgrey black
);
(if !!html_mods_vd_gfx_png then
mypic#save_as_png "bw_h_updown.png"
@@ -627,9 +614,9 @@
let do_draw_down_h_pic ttl top_title vl hl gdown =
(* init pic *)
(
- let g_x = win_x() in
let g_y = win_y() in
- let mypic = Gd.create ~x:g_x ~y:g_y in
+ let mypic = Gd.create ~x:(win_x()) ~y:g_y in
+ let x_legend_days = (int_of_float !history_h_timeflag) mod 86400 < (x_h_time
gdown) in
(* set colors *)
let white = mypic#colors#white in
@@ -645,13 +632,13 @@
draw_title mypic ttl black g_y;
draw_top_legend mypic top_title black green darkgrey g_y;
draw_v_legend mypic gdown vl black black 6;
- draw_h_legend mypic gdown hl black samples_h_time;
- draw_load mypic gdown green darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic gdown hl black (x_h_time gdown) !history_h_timeflag
x_legend_days;
+ draw_load mypic gdown green darkgrey (x_h_values gdown);
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
draw_arrow mypic darkred;
if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gdown green black;
+ draw_mean_line mypic gdown green darkgrey black;
(if !!html_mods_vd_gfx_png then
mypic#save_as_png "bw_h_download.png"
@@ -663,9 +650,9 @@
let do_draw_up_h_pic ttl top_title vl hl gup =
(* init pic *)
(
- let g_x = win_x() in
let g_y = win_y() in
- let mypic = Gd.create ~x:g_x ~y:g_y in
+ let x_legend_days = (int_of_float !history_h_timeflag) mod 86400 < (x_h_time
gup) in
+ let mypic = Gd.create ~x:(win_x()) ~y:g_y in
(* set colors *)
let white = mypic#colors#white in
@@ -681,13 +668,13 @@
draw_title mypic ttl black g_y;
draw_top_legend mypic top_title black red darkgrey g_y;
draw_v_legend mypic gup vl black black 6;
- draw_h_legend mypic gup hl black samples_h_time;
- draw_load mypic gup red darkgrey;
- draw_x_grid mypic black;
+ draw_h_legend mypic gup hl black (x_h_time gup) !history_h_timeflag
x_legend_days;
+ draw_load mypic gup red darkgrey (x_h_values gup);
+ draw_x_grid mypic black darkgrey (x_divisions());
draw_y_grid mypic black;
draw_arrow mypic darkred;
if !!html_mods_vd_gfx_mean then
- draw_mean_line mypic gup red black;
+ draw_mean_line mypic gup red darkgrey black;
(if !!html_mods_vd_gfx_png then
mypic#save_as_png "bw_h_upload.png"
Index: src/daemon/driver/driverMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverMain.ml,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -b -r1.130 -r1.131
--- src/daemon/driver/driverMain.ml 12 Nov 2006 12:36:14 -0000 1.130
+++ src/daemon/driver/driverMain.ml 14 Nov 2006 11:23:11 -0000 1.131
@@ -446,6 +446,23 @@
add_infinite_timer 0.1 CommonUploads.upload_download_timer;
add_infinite_timer !!buffer_writes_delay (fun _ -> Unix32.flush ());
+ history_timeflag := (Unix.time());
+ update_download_history ();
+ update_upload_history ();
+ history_h_timeflag := (Unix.time());
+ update_h_download_history ();
+ update_h_upload_history ();
+
+ add_infinite_timer (float_of_int history_step) (fun timer ->
+ history_timeflag := (Unix.time());
+ update_download_history ();
+ update_upload_history ());
+
+ add_infinite_timer (float_of_int history_h_step) (fun timer ->
+ history_h_timeflag := (Unix.time());
+ update_h_download_history ();
+ update_h_upload_history ());
+
if Autoconf.system = "mingw" then
add_infinite_timer 1. (fun timer ->
MlUnix.set_console_title (DriverInteractive.console_topic ()));
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/05
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/12
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/13
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/13
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...,
mldonkey-commits <=
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/14
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/15
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/19
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/19
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/21
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/26
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/26
- [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co..., mldonkey-commits, 2006/11/28