89 |
let count_seen c = |
let count_seen c = |
90 |
stats_all.brand_seen <- stats_all.brand_seen + 1; |
stats_all.brand_seen <- stats_all.brand_seen + 1; |
91 |
(match c.client_brand with |
(match c.client_brand with |
|
Brand_unknown -> () (* be careful, raising an exception here will |
|
|
abort all other operations after that point for this client...*) |
|
92 |
| b -> |
| b -> |
93 |
stats_by_brand.(brand_to_int b).brand_seen <- |
stats_by_brand.(brand_to_int b).brand_seen <- |
94 |
stats_by_brand.(brand_to_int b).brand_seen + 1; |
stats_by_brand.(brand_to_int b).brand_seen + 1; |
98 |
let count_banned c = |
let count_banned c = |
99 |
stats_all.brand_banned <- stats_all.brand_banned + 1; |
stats_all.brand_banned <- stats_all.brand_banned + 1; |
100 |
(match c.client_brand with |
(match c.client_brand with |
|
Brand_unknown -> () |
|
101 |
| b -> |
| b -> |
102 |
stats_by_brand.(brand_to_int b).brand_banned <- |
stats_by_brand.(brand_to_int b).brand_banned <- |
103 |
stats_by_brand.(brand_to_int b).brand_banned + 1; |
stats_by_brand.(brand_to_int b).brand_banned + 1; |
107 |
let count_filerequest c = |
let count_filerequest c = |
108 |
stats_all.brand_filerequest <- stats_all.brand_filerequest + 1; |
stats_all.brand_filerequest <- stats_all.brand_filerequest + 1; |
109 |
(match c.client_brand with |
(match c.client_brand with |
|
Brand_unknown -> () |
|
110 |
| b -> |
| b -> |
111 |
stats_by_brand.(brand_to_int b).brand_filerequest <- |
stats_by_brand.(brand_to_int b).brand_filerequest <- |
112 |
stats_by_brand.(brand_to_int b).brand_filerequest + 1; |
stats_by_brand.(brand_to_int b).brand_filerequest + 1; |
119 |
stats_all.brand_download <- Int64.add stats_all.brand_download v; |
stats_all.brand_download <- Int64.add stats_all.brand_download v; |
120 |
bt_download_counter := Int64.add !bt_download_counter v; |
bt_download_counter := Int64.add !bt_download_counter v; |
121 |
(match c.client_brand with |
(match c.client_brand with |
|
Brand_unknown -> () |
|
122 |
| b -> |
| b -> |
123 |
stats_by_brand.(brand_to_int b).brand_download <- |
stats_by_brand.(brand_to_int b).brand_download <- |
124 |
Int64.add stats_by_brand.(brand_to_int b).brand_download v; |
Int64.add stats_by_brand.(brand_to_int b).brand_download v; |
131 |
stats_all.brand_upload <- Int64.add stats_all.brand_upload v; |
stats_all.brand_upload <- Int64.add stats_all.brand_upload v; |
132 |
bt_upload_counter := Int64.add !bt_upload_counter v; |
bt_upload_counter := Int64.add !bt_upload_counter v; |
133 |
(match c.client_brand with |
(match c.client_brand with |
|
Brand_unknown -> () |
|
134 |
| b -> |
| b -> |
135 |
stats_by_brand.(brand_to_int b).brand_upload <- |
stats_by_brand.(brand_to_int b).brand_upload <- |
136 |
Int64.add stats_by_brand.(brand_to_int b).brand_upload v; |
Int64.add stats_by_brand.(brand_to_int b).brand_upload v; |
163 |
Printf.bprintf buf "You haven't connected to any client yet\n" |
Printf.bprintf buf "You haven't connected to any client yet\n" |
164 |
else begin |
else begin |
165 |
Printf.bprintf buf "\n Successful Connections: %18d\n" stats_all.brand_seen; |
Printf.bprintf buf "\n Successful Connections: %18d\n" stats_all.brand_seen; |
166 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
167 |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
168 |
(brand_to_string (brand_of_int i)) |
(brand_to_string (brand_of_int i)) |
169 |
stats_by_brand.(i).brand_seen |
stats_by_brand.(i).brand_seen |
175 |
Printf.bprintf buf "You weren't asked for any file yet\n" |
Printf.bprintf buf "You weren't asked for any file yet\n" |
176 |
else begin |
else begin |
177 |
Printf.bprintf buf "\nTotal filerequests received: %18d\n" stats_all.brand_filerequest; |
Printf.bprintf buf "\nTotal filerequests received: %18d\n" stats_all.brand_filerequest; |
178 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
179 |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
180 |
(brand_to_string (brand_of_int i)) |
(brand_to_string (brand_of_int i)) |
181 |
stats_by_brand.(i).brand_filerequest |
stats_by_brand.(i).brand_filerequest |
189 |
Printf.bprintf buf "\n Total downloads: %18s (%5.1f KB/s)\n" |
Printf.bprintf buf "\n Total downloads: %18s (%5.1f KB/s)\n" |
190 |
(Int64.to_string stats_all.brand_download) |
(Int64.to_string stats_all.brand_download) |
191 |
((Int64.to_float stats_all.brand_download) /. (float_of_int uptime) /. 1024.0); |
((Int64.to_float stats_all.brand_download) /. (float_of_int uptime) /. 1024.0); |
192 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
193 |
Printf.bprintf buf "%27s: %18s (%5.1f %%)\n" |
Printf.bprintf buf "%27s: %18s (%5.1f %%)\n" |
194 |
(brand_to_string (brand_of_int i)) |
(brand_to_string (brand_of_int i)) |
195 |
(Int64.to_string stats_by_brand.(i).brand_download) |
(Int64.to_string stats_by_brand.(i).brand_download) |
203 |
Printf.bprintf buf "\n Total uploads: %18s (%5.1f KB/s)\n" |
Printf.bprintf buf "\n Total uploads: %18s (%5.1f KB/s)\n" |
204 |
(Int64.to_string stats_all.brand_upload) |
(Int64.to_string stats_all.brand_upload) |
205 |
((Int64.to_float stats_all.brand_upload) /. (float_of_int uptime) /. 1024.0); |
((Int64.to_float stats_all.brand_upload) /. (float_of_int uptime) /. 1024.0); |
206 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
207 |
Printf.bprintf buf "%27s: %18s (%5.1f %%)\n" |
Printf.bprintf buf "%27s: %18s (%5.1f %%)\n" |
208 |
(brand_to_string (brand_of_int i)) |
(brand_to_string (brand_of_int i)) |
209 |
(Int64.to_string stats_by_brand.(i).brand_upload) |
(Int64.to_string stats_by_brand.(i).brand_upload) |
215 |
Printf.bprintf buf "You didn't ban any client yet\n" |
Printf.bprintf buf "You didn't ban any client yet\n" |
216 |
else begin |
else begin |
217 |
Printf.bprintf buf "\n Total bans: %18d\n" stats_all.brand_banned; |
Printf.bprintf buf "\n Total bans: %18d\n" stats_all.brand_banned; |
218 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
219 |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
Printf.bprintf buf "%27s: %18d (%5.1f %%)\n" |
220 |
(brand_to_string (brand_of_int i)) |
(brand_to_string (brand_of_int i)) |
221 |
stats_by_brand.(i).brand_banned |
stats_by_brand.(i).brand_banned |
308 |
let counter = ref 0 in |
let counter = ref 0 in |
309 |
let showTotal = ref false in |
let showTotal = ref false in |
310 |
|
|
311 |
for i=1 to brand_count do |
for i=0 to brand_count do |
312 |
if i=brand_count then showTotal := true; |
if i=brand_count then showTotal := true; |
313 |
if !showTotal || ( stats_by_brand.(i).brand_seen > 0 ) then begin |
if !showTotal || ( stats_by_brand.(i).brand_seen > 0 ) then begin |
314 |
incr counter; |
incr counter; |
400 |
stats_html_header buf; |
stats_html_header buf; |
401 |
|
|
402 |
showTotal := false; |
showTotal := false; |
403 |
for i=1 to brand_count do |
for i=0 to brand_count do |
404 |
if i=brand_count then showTotal := true; |
if i=brand_count then showTotal := true; |
405 |
if !showTotal || ( !!gstats_by_brand.(i).brand_seen > 0 ) then begin |
if !showTotal || ( !!gstats_by_brand.(i).brand_seen > 0 ) then begin |
406 |
incr counter; |
incr counter; |
475 |
Printf.bprintf buf "Client Brand| seen | Downloads | Uploads | Banned | Requests\n"; |
Printf.bprintf buf "Client Brand| seen | Downloads | Uploads | Banned | Requests\n"; |
476 |
Printf.bprintf buf "------------+--------------+--------------------+--------------------+------------+--------------\n"; |
Printf.bprintf buf "------------+--------------+--------------------+--------------------+------------+--------------\n"; |
477 |
|
|
478 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
479 |
if stats_by_brand.(i).brand_seen > 0 then (* dont print server stats *) |
if stats_by_brand.(i).brand_seen > 0 then (* dont print server stats *) |
480 |
let brandstr = brand_to_string (brand_of_int i) in |
let brandstr = brand_to_string (brand_of_int i) in |
481 |
|
|
516 |
Printf.bprintf buf "Client Brand| seen | Downloads | Uploads | Banned | Requests\n"; |
Printf.bprintf buf "Client Brand| seen | Downloads | Uploads | Banned | Requests\n"; |
517 |
Printf.bprintf buf "------------+--------------+--------------------+--------------------+------------+--------------\n"; |
Printf.bprintf buf "------------+--------------+--------------------+--------------------+------------+--------------\n"; |
518 |
|
|
519 |
for i=1 to brand_count-1 do |
for i=0 to brand_count-1 do |
520 |
if !!gstats_by_brand.(i).brand_seen > 0 then (* dont print server stats *) |
if !!gstats_by_brand.(i).brand_seen > 0 then (* dont print server stats *) |
521 |
let brandstr = brand_to_string (brand_of_int i) in |
let brandstr = brand_to_string (brand_of_int i) in |
522 |
|
|