From: xchaos Date: Sun, 10 Jun 2012 09:19:16 +0000 (+0000) Subject: source code + html output formatting X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=9690db8ed1b8015caade68d5d074bdd918d21d7b;p=svn%2FPrometheus-QoS%2F.git source code + html output formatting git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@185 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/prometheus.c b/prometheus.c index f12de15..3e4cb83 100644 --- a/prometheus.c +++ b/prometheus.c @@ -958,7 +958,11 @@ void parse_ip_log(int argc, char **argv) if_exists(iplog,iplogs,iplog->l>=total/4) { fprintf(f,"%sTop 25%% of traffic\n", tr_odd_even()); - fprintf(f,"%d%d %%%ld G%d %%\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"%d\n\ +%d %%\n\ +%ld GB\n\ +%d %%\n", + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i==10) @@ -966,9 +970,9 @@ void parse_ip_log(int argc, char **argv) fprintf(f,"%sTop 10 downloaders\n", tr_odd_even()); fprintf(f,"10\n\ %d %%\n\ -%ld G\n\ +%ld GB\n\ %d %%\n", - (100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->l>=total/2) @@ -976,7 +980,7 @@ void parse_ip_log(int argc, char **argv) fprintf(f,"%sTop 50%% of traffic\n", tr_odd_even()); fprintf(f,"%d\n\ %d %%\n\ -%ld G\n\ +%ld GB\n\ %d %%\n", iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } @@ -986,9 +990,9 @@ void parse_ip_log(int argc, char **argv) fprintf(f,"%sTop 80%% of traffic\n",tr_odd_even()); fprintf(f,"%d\n\ %d %%\n\ -%ld G\n\ +%ld GB\n\ %d %%\n", - iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists (iplog,iplogs,iplog->i>=i/5) @@ -996,15 +1000,19 @@ void parse_ip_log(int argc, char **argv) fprintf(f,"%sTop 20%% downloaders\n",tr_odd_even()); fprintf(f,"%d\n\ %d %%\n\ -%ld G\n\ +%ld GB\n\ %d %%\n", - iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i>=i/4) { fprintf(f,"%sTop 25%% downloaders\n", tr_odd_even()); - fprintf(f,"%d%d %%%ld G%d %%\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"%d\n\ +%d %%\n\ +%ld GB\n\ +%d %%\n", + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i>=i/2) @@ -1012,19 +1020,25 @@ void parse_ip_log(int argc, char **argv) fprintf(f,"%sTop 50%% downloaders\n",tr_odd_even()); fprintf(f,"%d\n\ %d %%\n\ -%ld G%d %%\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); +%ld GB\n\ +%d %%\n", + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i>=4*i/5) { fprintf(f,"%sTop 80%% downloaders\n",tr_odd_even()); - fprintf(f,"%d%d %%%ld G%d %%\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"%d\n\ +%d %%\n\ +%ld GB\n\ +%d %%\n", + iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total)); } fprintf(f,"All users, all traffic\n", log_url); fprintf(f,"%d\n\ 100 %%\n\ -%ld G\n\ +%ld GB\n\ 100 %%\n",i-1,total); fputs("\n", f); } @@ -1924,7 +1938,11 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if_exists(sum,sums,sum->l>=total_traffic/4) { fprintf(f,"%sTop 25%% of traffic\n", tr_odd_even()); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"%d\n\ +%d %%\n\ +%Lu MB\n\ +%Ld %%\n", + sum->i, (100*sum->i+50)/active_classes, sum->l, (100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->i==10) @@ -1934,7 +1952,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); %d %%\n\ %Lu MB\n\ %Ld %%\n", - (100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + (100*sum->i+50)/active_classes, sum->l, (100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->l>=total_traffic/2) @@ -2004,7 +2022,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f,"All users, all traffic\n", log_url); fprintf(f,"%d\n\ 100 %%\n\ -%Lu M\n\ +%Lu MB\n\ 100 %%\n",active_classes,total_traffic); fputs("\n", f);