mldonkey-commits
[Top][All Lists]
Advanced

[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, 28 Nov 2006 23:15:21 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       06/11/28 23:15:21

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonGlobals.ml commonOptions.ml 
        src/daemon/driver: driverCommands.ml driverGraphics_gd.ml 
                           driverMain.ml 

Log message:
        patch #5597

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1116&r2=1.1117
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonGlobals.ml?cvsroot=mldonkey&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/common/commonOptions.ml?cvsroot=mldonkey&r1=1.189&r2=1.190
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.201&r2=1.202
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverGraphics_gd.ml?cvsroot=mldonkey&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverMain.ml?cvsroot=mldonkey&r1=1.132&r2=1.133

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1116
retrieving revision 1.1117
diff -u -b -r1.1116 -r1.1117
--- distrib/ChangeLog   28 Nov 2006 11:56:11 -0000      1.1116
+++ distrib/ChangeLog   28 Nov 2006 23:15:21 -0000      1.1117
@@ -14,6 +14,10 @@
 ChangeLog
 =========
 
+2006/11/29
+5597: GD: New option html_mods_vd_gfx_h_intervall
+      (compute values for hourly graph every x minutes) (skeeve)
+
 2006/11/28
 5591: EDK: Fix small file search result parsing
 

Index: src/daemon/common/commonGlobals.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonGlobals.ml,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- src/daemon/common/commonGlobals.ml  21 Nov 2006 22:34:33 -0000      1.76
+++ src/daemon/common/commonGlobals.ml  28 Nov 2006 23:15:21 -0000      1.77
@@ -620,8 +620,9 @@
 
 let history_step = 5
 let history_size = 720
-let history_h_step = history_size * history_step
-let history_h_size = 720
+let history_size_for_h_graph = ref 0 (* history_size * 
!!html_mods_vd_gfx_h_intervall / 60 *)
+let history_h_step = ref 0 (* 60 * !!html_mods_vd_gfx_h_intervall <= 
history_size * history_step *)
+let history_h_size = 1440
 let history_timeflag = ref 0.
 let history_h_timeflag = ref 0.
 
@@ -656,7 +657,12 @@
   done
 
 let update_h_download_history () =
-  Fifo.put download_h_history ((List.fold_left (+) 0 (Fifo.to_list 
download_history)) / ((Fifo.length download_history)));
+  if (!history_h_step = history_size * history_step) or ( (Fifo.length 
download_history) <= (!history_size_for_h_graph+1)) then 
+    Fifo.put download_h_history ((List.fold_left (+) 0 (Fifo.to_list 
download_history)) / ((Fifo.length download_history))) 
+  else 
+    Fifo.put download_h_history ((List.fold_left (+) 0 
+                 (snd (List2.cut ((Fifo.length download_history) - 
!history_size_for_h_graph - 1) (Fifo.to_list download_history)))) 
+      / (!history_size_for_h_graph + 1) );
   let len = ref (Fifo.length download_h_history) in
   while !len > history_h_size+1 do
     ignore (Fifo.take download_h_history);
@@ -664,7 +670,13 @@
   done
 
 let update_h_upload_history () =
-  Fifo.put upload_h_history ((List.fold_left (+) 0 (Fifo.to_list 
upload_history)) / ((Fifo.length upload_history)));
+       (* Fifo.put upload_h_history ((Fifo.length upload_history) / 720); *)
+  if (!history_h_step = history_size * history_step) or ((Fifo.length 
upload_history) <= (!history_size_for_h_graph+1)) then 
+    Fifo.put upload_h_history ((List.fold_left (+) 0 (Fifo.to_list 
upload_history)) / ((Fifo.length upload_history))) 
+  else 
+    Fifo.put upload_h_history ((List.fold_left (+) 0 
+                       (snd (List2.cut ((Fifo.length upload_history) - 
!history_size_for_h_graph - 1) (Fifo.to_list upload_history)))) 
+      / (!history_size_for_h_graph+1) );
   let len = ref (Fifo.length upload_h_history) in
   while !len > history_h_size+1 do
     ignore (Fifo.take upload_h_history);

Index: src/daemon/common/commonOptions.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/common/commonOptions.ml,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -b -r1.189 -r1.190
--- src/daemon/common/commonOptions.ml  21 Nov 2006 22:34:33 -0000      1.189
+++ src/daemon/common/commonOptions.ml  28 Nov 2006 23:15:21 -0000      1.190
@@ -806,6 +806,11 @@
   "Graph y size in vd output ( 200 < y < 1200 )"
     int_option 200
 
+let html_mods_vd_gfx_h_intervall = define_expert_option current_section 
["html_mods_vd_gfx_h_intervall"]
+  "compute values for hourly graph every 1,2,3,4,5,10,15,20,30,60 min
+       Changes to this option require a core restart."
+     int_option 60
+
 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
@@ -1794,11 +1799,17 @@
   option_hook client_buffer_size (fun _ ->
       TcpBufferedSocket.max_buffer_size := max 10000000 !!client_buffer_size
   );
-  if Autoconf.has_gd then
+  if Autoconf.has_gd then begin
     option_hook html_mods_vd_gfx_png (fun _ ->
       if not Autoconf.has_gd_png && !!html_mods_vd_gfx_png then 
html_mods_vd_gfx_png =:= false;
       if not Autoconf.has_gd_jpg && not !!html_mods_vd_gfx_png then 
html_mods_vd_gfx_png =:= true
+       );
+       option_hook html_mods_vd_gfx_h_intervall (fun _ -> 
+       let values = [1; 2; 3; 4; 5; 10; 15; 20; 30; 60] in 
+       let v = List.find ((<=) (min !!html_mods_vd_gfx_h_intervall 60)) values 
in 
+       if v <> !!html_mods_vd_gfx_h_intervall then 
html_mods_vd_gfx_h_intervall =:= v 
     )
+       end
 
 let verbose_msg_clients = ref false
 let verbose_msg_raw = ref false

Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -b -r1.201 -r1.202
--- src/daemon/driver/driverCommands.ml 26 Nov 2006 13:54:09 -0000      1.201
+++ src/daemon/driver/driverCommands.ml 28 Nov 2006 23:15:21 -0000      1.202
@@ -1731,6 +1731,7 @@
                        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_intervall;
                        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;

Index: src/daemon/driver/driverGraphics_gd.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverGraphics_gd.ml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- src/daemon/driver/driverGraphics_gd.ml      14 Nov 2006 11:23:11 -0000      
1.2
+++ src/daemon/driver/driverGraphics_gd.ml      28 Nov 2006 23:15:21 -0000      
1.3
@@ -68,7 +68,7 @@
 (* set some vars *) 
 
 let history_time = history_size * history_step
-let history_h_time = history_h_size * history_h_step
+let history_h_time() = history_h_size * !history_h_step
 
 (* define margins *)
 let left_margin = 20
@@ -91,42 +91,41 @@
   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)
        
+let round_h_up x =
+  let v = min x 90720 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
+       
 (* 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 (
+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))
+                 (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)
+             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
     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 ())))
+         round_h_down (history_h_time() / (60 * x_divisions ())))
 
 let vmax link = (detected_link_capacity link)
 
 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)
+let x_h_values g = ((x_h_time g) / !history_h_step)
 
 (* calculate y-values *)
 let y_divisions () = ((win_y() - top_margin - bottom_margin)) / 50 * 2
@@ -265,7 +264,7 @@
   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
+    Printf.sprintf "%02d.%02d." time.Unix.tm_mday time.Unix.tm_mon
   in
   if show_days then
     begin

Index: src/daemon/driver/driverMain.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverMain.ml,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -b -r1.132 -r1.133
--- src/daemon/driver/driverMain.ml     19 Nov 2006 23:04:59 -0000      1.132
+++ src/daemon/driver/driverMain.ml     28 Nov 2006 23:15:21 -0000      1.133
@@ -452,13 +452,15 @@
   history_h_timeflag := (Unix.time()); 
   update_h_download_history (); 
   update_h_upload_history ();
+  history_size_for_h_graph := history_size * !!html_mods_vd_gfx_h_intervall / 
60;
+  history_h_step := 60 * !!html_mods_vd_gfx_h_intervall;
                
   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 -> 
+  add_infinite_timer (float_of_int !history_h_step) (fun timer -> 
     history_h_timeflag := (Unix.time()); 
     update_h_download_history (); 
     update_h_upload_history ());




reply via email to

[Prev in Thread] Current Thread [Next in Thread]