110 |
let ybs() = ybb() - ybt |
let ybs() = ybb() - ybt |
111 |
let vdt() = float_of_int(ybs()) /. float_of_int(vmax_auto()) |
let vdt() = float_of_int(ybs()) /. float_of_int(vmax_auto()) |
112 |
let vdt_m link = float_of_int(ybs()) /. float_of_int(vmax link) |
let vdt_m link = float_of_int(ybs()) /. float_of_int(vmax link) |
113 |
|
let vdt_stack link = float_of_int(ybs() / 2) /. float_of_int(vmax link) |
114 |
|
|
115 |
let ttl = ref "" |
let ttl = ref "" |
116 |
let vl = ref "" |
let vl = ref "" |
140 |
mypic#line ~x1:(fx (xdivisions())) ~y1:ybt ~x2:(fx (xdivisions())) ~y2:my_y gcolor; |
mypic#line ~x1:(fx (xdivisions())) ~y1:ybt ~x2:(fx (xdivisions())) ~y2:my_y gcolor; |
141 |
mypic#line ~x1:xbl ~y1:(fy 0) ~x2:my_x ~y2:(fy 0) gcolor; |
mypic#line ~x1:xbl ~y1:(fy 0) ~x2:my_x ~y2:(fy 0) gcolor; |
142 |
mypic#line ~x1:xbl ~y1:(fy (ydivisions())) ~x2:my_x ~y2:(fy (ydivisions())) gcolor |
mypic#line ~x1:xbl ~y1:(fy (ydivisions())) ~x2:my_x ~y2:(fy (ydivisions())) gcolor |
143 |
|
|
144 |
|
let draw_stack_borders mypic gcolor = |
145 |
|
let my_y = (ybb()) in |
146 |
|
let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *. (float_of_int(xbs()))) +. (float_of_int xbl)) in |
147 |
|
let my_x = (xbr()) in |
148 |
|
let fy x = int_of_float ((((float_of_int x) /. (fydivisions())) *. (float_of_int(ybs()))) +. (float_of_int ybt)) in |
149 |
|
mypic#line ~x1:(fx 0) ~y1:ybt ~x2:(fx 0) ~y2:my_y gcolor; |
150 |
|
mypic#line ~x1:(fx (xdivisions())) ~y1:ybt ~x2:(fx (xdivisions())) ~y2:my_y gcolor; |
151 |
|
mypic#line ~x1:xbl ~y1:(fy 0) ~x2:my_x ~y2:(fy 0) gcolor; |
152 |
|
mypic#line ~x1:xbl ~y1:(fy (ydivisions())) ~x2:my_x ~y2:(fy (ydivisions())) gcolor; |
153 |
|
mypic#line ~x1:xbl ~y1:(my_y - ((my_y - ybt) / 2)) ~x2:my_x ~y2:(my_y - ((my_y - ybt) / 2)) gcolor |
154 |
|
|
155 |
let draw_x_grid mypic gcolor = |
let draw_x_grid mypic gcolor = |
156 |
let my_y = (ybb()) in |
let my_y = (ybb()) in |
157 |
let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *. (float_of_int(xbs()))) +. (float_of_int xbl)) in |
let fx x = int_of_float ((((float_of_int x) /. (fxdivisions())) *. (float_of_int(xbs()))) +. (float_of_int xbl)) in |
215 |
done; |
done; |
216 |
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) - 5) ~s:(legend_text) lcolor |
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) - 5) ~s:(legend_text) lcolor |
217 |
|
|
218 |
|
let draw_stack_v_top_legend mypic g legend_text lcolor gcolor offset = |
219 |
|
let my_x = (xbr()) in |
220 |
|
let my_y = (ybb() - (ybs() / 2)) in |
221 |
|
let fy x = int_of_float ((float_of_int my_y) -. (((float_of_int x) /. (y_fdivisions())) *. (float_of_int(ybs())))) in |
222 |
|
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 |
223 |
|
for n = 1 to ((y_divisions()) - 1) do |
224 |
|
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy n) - 12 + offset) ~s:(vtext n) gcolor; |
225 |
|
done; |
226 |
|
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) - 5) ~s:(legend_text) lcolor |
227 |
|
|
228 |
|
let draw_stack_v_bottom_legend mypic g legend_text lcolor gcolor offset = |
229 |
|
let my_x = (xbr()) in |
230 |
|
let my_y = (ybb() - (ybs() / 2)) in |
231 |
|
let fy x = int_of_float ((float_of_int my_y) +. (((float_of_int x) /. (y_fdivisions())) *. (float_of_int(ybs())))) in |
232 |
|
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 |
233 |
|
for n = 1 to ((y_divisions()) - 1) do |
234 |
|
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy n) - 12 + offset) ~s:(vtext n) gcolor; |
235 |
|
done; |
236 |
|
mypic#string ~font:Gd.Font.small ~x:(my_x + 5) ~y:((fy (y_divisions())) - 5) ~s:(legend_text) lcolor |
237 |
|
|
238 |
let draw_h_legend mypic g legend_text gcolor my_time = |
let draw_h_legend mypic g legend_text gcolor my_time = |
239 |
let my_x = (xbr()) in |
let my_x = (xbr()) in |
240 |
let my_x2 = (xbs()) in |
let my_x2 = (xbs()) in |
293 |
end |
end |
294 |
) |
) |
295 |
|
|
296 |
|
let draw_stack_download mypic g my_color shadow_color = |
297 |
|
let my_x = (xbr()) in |
298 |
|
let my_x2 = (xbs()) in |
299 |
|
let my_y = (ybb() - (ybs() / 2)) in |
300 |
|
let my_y2 = (ybs() / 2) in |
301 |
|
let datas g n = List.nth (List.rev (Fifo2.to_list g)) n in |
302 |
|
let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /. (fxgdivisions())) *. (float_of_int my_x2))) |
303 |
|
and y_c1 n = (my_y - (int_of_float(float_of_int(datas g n) *. (vdt_stack g)))) |
304 |
|
and y_c2 n = (my_y - (int_of_float(float_of_int(datas g (n+1)) *. (vdt_stack g)))) in |
305 |
|
(if !!html_mods_vd_gfx_fill then begin |
306 |
|
mypic#line ~x1:(fx 0) ~y1:my_y |
307 |
|
~x2:(fx 0) ~y2:(if y_c1 0 >= my_y - 3 then |
308 |
|
((y_c1 0) - 3) else ((y_c1 0))) shadow_color; |
309 |
|
for n = 0 to ((graph_length(g)) - 1) do |
310 |
|
(* trick to make sure filling will not fail *) |
311 |
|
if n = ((graph_length(g)) - 1) then |
312 |
|
mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 2 then |
313 |
|
((y_c1 n) - 2) else ((y_c1 n))) ~x2:((fx (n+1))) ~y2:((y_c2 n)) shadow_color |
314 |
|
else begin |
315 |
|
mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y - 2 then |
316 |
|
((y_c1 n) - 2) else ((y_c1 n))) |
317 |
|
~x2:((fx (n+1))) ~y2:(if y_c2 n >= my_y - 2 then |
318 |
|
((y_c2 n) - 2) else ((y_c2 n))) shadow_color |
319 |
|
end |
320 |
|
done; |
321 |
|
mypic#fill ~x:(my_x - 1) ~y:(my_y - 1) my_color; |
322 |
|
end |
323 |
|
else begin |
324 |
|
for n = 0 to ((graph_length(g)) - 1) do |
325 |
|
mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n) + 1) ~x2:((fx (n+1)) + 1) ~y2:((y_c2 n) + 1) shadow_color; |
326 |
|
mypic#line ~x1:(fx n) ~y1:(y_c1 n) ~x2:(fx (n+1)) ~y2:(y_c2 n) my_color |
327 |
|
done; |
328 |
|
end |
329 |
|
) |
330 |
|
|
331 |
|
let draw_stack_upload mypic g my_color shadow_color = |
332 |
|
let my_x = (xbr()) in |
333 |
|
let my_x2 = (xbs()) in |
334 |
|
let my_y = (ybb() - (ybs() / 2)) in |
335 |
|
let my_y2 = (ybs() / 2) in |
336 |
|
let datas g n = List.nth (List.rev (Fifo2.to_list g)) n in |
337 |
|
let fx x = int_of_float((float_of_int my_x) -. (((float_of_int x) /. (fxgdivisions())) *. (float_of_int my_x2))) |
338 |
|
and y_c1 n = (my_y + (int_of_float(float_of_int(datas g n) *. (vdt_stack g)))) |
339 |
|
and y_c2 n = (my_y + (int_of_float(float_of_int(datas g (n+1)) *. (vdt_stack g)))) in |
340 |
|
(if !!html_mods_vd_gfx_fill then begin |
341 |
|
mypic#line ~x1:(fx 0) ~y1:my_y |
342 |
|
~x2:(fx 0) ~y2:(if y_c1 0 >= my_y - 3 then |
343 |
|
((y_c1 0) - 3) else ((y_c1 0))) shadow_color; |
344 |
|
for n = 0 to ((graph_length(g)) - 1) do |
345 |
|
(* trick to make sure filling will not fail *) |
346 |
|
if n = ((graph_length(g)) - 1) then |
347 |
|
mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y + 2 then |
348 |
|
((y_c1 n) + 2) else ((y_c1 n))) ~x2:((fx (n+1))) ~y2:((y_c2 n)) shadow_color |
349 |
|
else begin |
350 |
|
mypic#line ~x1:((fx n)) ~y1:(if y_c1 n >= my_y + 2 then |
351 |
|
((y_c1 n) + 2) else ((y_c1 n))) |
352 |
|
~x2:((fx (n+1))) ~y2:(if y_c2 n >= my_y + 2 then |
353 |
|
((y_c2 n) + 2) else ((y_c2 n))) shadow_color |
354 |
|
end |
355 |
|
done; |
356 |
|
mypic#fill ~x:(my_x - 1) ~y:(my_y + 1) my_color; |
357 |
|
end |
358 |
|
else begin |
359 |
|
for n = 0 to ((graph_length(g)) - 1) do |
360 |
|
mypic#line ~x1:((fx n) + 1) ~y1:((y_c1 n) + 1) ~x2:((fx (n+1)) + 1) ~y2:((y_c2 n) + 1) shadow_color; |
361 |
|
mypic#line ~x1:(fx n) ~y1:(y_c1 n) ~x2:(fx (n+1)) ~y2:(y_c2 n) my_color |
362 |
|
done; |
363 |
|
end |
364 |
|
) |
365 |
|
|
366 |
|
|
367 |
let draw_mean_line mypic g my_color gcolor = |
let draw_mean_line mypic g my_color gcolor = |
368 |
let my_x = (xbr()) |
let my_x = (xbr()) |
369 |
and my_x2 = (xbs()) |
and my_x2 = (xbs()) |
459 |
if !!html_mods_vd_gfx_transparent then |
if !!html_mods_vd_gfx_transparent then |
460 |
mypic#colors#set_transparent white; |
mypic#colors#set_transparent white; |
461 |
(* draw graph *) |
(* draw graph *) |
|
draw_borders mypic black; |
|
462 |
draw_title mypic ttl black g_y; |
draw_title mypic ttl black g_y; |
463 |
draw_dual_top_legend mypic "download" black green darkgrey "upload" black red darkgrey g_y; |
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; |
|
464 |
draw_h_legend mypic gdown hl black samples_time; |
draw_h_legend mypic gdown hl black samples_time; |
465 |
if !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= false; |
(if !!html_mods_vd_gfx_stack then begin |
466 |
draw_load mypic gdown green darkgrey; |
draw_stack_borders mypic black; |
467 |
draw_load mypic gup red darkgrey; |
draw_stack_v_top_legend mypic gdown vl black darkgreen 5; |
468 |
draw_x_grid mypic black; |
draw_stack_v_bottom_legend mypic gup vl black darkred 5; |
469 |
draw_y_grid mypic black; |
(* enable filling for stack graph *) |
470 |
draw_arrow mypic darkred; |
if not !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= true; |
471 |
(if !!html_mods_vd_gfx_mean then |
draw_stack_download mypic gdown green darkgrey; |
472 |
draw_mean_line mypic gdown green black; |
draw_stack_upload mypic gup red darkgrey; |
473 |
draw_mean_line mypic gup red black |
draw_x_grid mypic black; |
474 |
); |
draw_y_grid mypic black |
475 |
|
end |
476 |
|
else begin |
477 |
|
draw_borders mypic black; |
478 |
|
draw_v_legend mypic gdown vl black darkgreen 0; |
479 |
|
draw_v_legend mypic gup vl black darkred 10; |
480 |
|
if !!html_mods_vd_gfx_fill then html_mods_vd_gfx_fill =:= false; |
481 |
|
draw_load mypic gdown green darkgrey; |
482 |
|
draw_load mypic gup red darkgrey; |
483 |
|
draw_x_grid mypic black; |
484 |
|
draw_y_grid mypic black; |
485 |
|
(if !!html_mods_vd_gfx_mean then |
486 |
|
draw_mean_line mypic gdown green black; |
487 |
|
draw_mean_line mypic gup red black |
488 |
|
); |
489 |
|
end); |
490 |
|
draw_arrow mypic darkred; |
491 |
(if !!html_mods_vd_gfx_png then |
(if !!html_mods_vd_gfx_png then |
492 |
mypic#save_as_png "bw_updown.png" |
mypic#save_as_png "bw_updown.png" |
493 |
else |
else |