553 |
(* if t.monitored then begin |
(* if t.monitored then begin |
554 |
lprintf "write: direct written %d\n" nw; |
lprintf "write: direct written %d\n" nw; |
555 |
end; *) |
end; *) |
556 |
tcp_uploaded_bytes := Int64.add !tcp_uploaded_bytes (Int64.of_int nw); |
tcp_uploaded_bytes := !tcp_uploaded_bytes ++ (Int64.of_int nw); |
557 |
(match t.write_control with |
(match t.write_control with |
558 |
None -> () |
None -> () |
559 |
| Some bc -> |
| Some bc -> |
560 |
bc.moved_bytes <- |
bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nw)); |
|
Int64.add bc.moved_bytes (Int64.of_int nw)); |
|
561 |
if t.nwrite = 0 then begin |
if t.nwrite = 0 then begin |
562 |
(* if t.connecting then |
(* if t.connecting then |
563 |
lprintf "WRITE BEFORE CONNECTION.......\n"; |
lprintf "WRITE BEFORE CONNECTION.......\n"; |
697 |
end; |
end; |
698 |
*) |
*) |
699 |
|
|
700 |
tcp_downloaded_bytes := Int64.add !tcp_downloaded_bytes (Int64.of_int nread); |
tcp_downloaded_bytes := !tcp_downloaded_bytes ++ (Int64.of_int nread); |
701 |
(match t.read_control with |
(match t.read_control with |
702 |
None -> () | Some bc -> |
None -> () | Some bc -> |
703 |
bc.moved_bytes <- |
bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nread)); |
|
Int64.add bc.moved_bytes (Int64.of_int nread)); |
|
704 |
|
|
705 |
t.nread <- t.nread + nread; |
t.nread <- t.nread + nread; |
706 |
if nread > 0 then begin |
if nread > 0 then begin |
753 |
|
|
754 |
(* if t.monitored then |
(* if t.monitored then |
755 |
(lprintf "written %d\n" nw; ); *) |
(lprintf "written %d\n" nw; ); *) |
756 |
tcp_uploaded_bytes := Int64.add !tcp_uploaded_bytes (Int64.of_int nw); |
tcp_uploaded_bytes := !tcp_uploaded_bytes ++ (Int64.of_int nw); |
757 |
(match t.write_control with |
(match t.write_control with |
758 |
None -> () |
None -> () |
759 |
| Some bc -> |
| Some bc -> |
760 |
bc.moved_bytes <- |
bc.moved_bytes <- bc.moved_bytes ++ (Int64.of_int nw)); |
|
Int64.add bc.moved_bytes (Int64.of_int nw)); |
|
761 |
if t.nwrite = 0 then begin |
if t.nwrite = 0 then begin |
762 |
(* lprintf "add_connect_latency at %f\n" (current_time ()); *) |
(* lprintf "add_connect_latency at %f\n" (current_time ()); *) |
763 |
add_connect_latency t.host t.connect_time; |
add_connect_latency t.host t.connect_time; |
957 |
if bc.total_bytes = 0 then -1 else |
if bc.total_bytes = 0 then -1 else |
958 |
let sum = ref Int64.zero in |
let sum = ref Int64.zero in |
959 |
for i = 0 to 3600-1 do |
for i = 0 to 3600-1 do |
960 |
sum := Int64.add !sum (Int64.of_int bc.lost_bytes.(i)); |
sum := !sum ++ (Int64.of_int bc.lost_bytes.(i)); |
961 |
done; |
done; |
962 |
Int64.to_int (Int64.div !sum (Int64.of_int 3600)) |
Int64.to_int (!sum // 3600L) |
963 |
|
|
964 |
let moved_bytes bc = bc.moved_bytes |
let moved_bytes bc = bc.moved_bytes |
965 |
|
|