From: xchaos Date: Mon, 28 Nov 2011 14:22:29 +0000 (+0000) Subject: ještě ERP X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=b014f18189d582cd408e0c488ef734a070500e5b;p=svn%2FPrometheus-QoS%2F.git ještě ERP git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@152 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/prometheus.c b/prometheus.c index c3461ca..5420588 100644 --- a/prometheus.c +++ b/prometheus.c @@ -947,6 +947,7 @@ program int just_preview=FALSE; /* preview - generate just stats */ int just_logs=FALSE; /* just parse logs */ int run=FALSE; + int total=0; char *chain_forward, *chain_postrouting; char *althosts=NULL; @@ -1502,7 +1503,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(f) { - int total=0; + int count=1; i=0; @@ -1551,7 +1552,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); i=1; if(f) { - unsigned long long total=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum=0; + unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum=0; int active_classes=0; int colspan; FILE *iplog; @@ -1631,7 +1632,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f,"%Lu M\n", ip->upload); fprintf(f,"%d k%d k%s%d k%s%s%d%s\n", ip->min,ip->desired,f1,ip->max,f2,f1,ip->prio,f2); - total+=ip->traffic; + total_traffic+=ip->traffic; total_direct+=ip->direct; total_proxy+=ip->proxy; total_upload+=ip->upload; @@ -1661,7 +1662,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } fprintf(f,"SUMMARY:",colspan-7); fprintf(f,"%Lu M\ - %Lu M\n", total, total_direct); + %Lu M\n", total_traffic, total_direct); if(qos_proxy) { fprintf(f,"%Lu M\n", total_proxy); @@ -1679,28 +1680,28 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fputs("Analytic category\n",f); fputs("Active ClassesData transfers\n",f); - if_exists(sum,sums,sum->l>=total/4) + if_exists(sum,sums,sum->l>=total_traffic/4) { fprintf(f,"Top 25%% of traffic\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"%d%d %%%Lu M%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) { fprintf(f,"Top 10 downloaders\n"); - fprintf(f,"10%d %%%Lu M%Ld %%\n",(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"10%d %%%Lu M%Ld %%\n",(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } - if_exists(sum,sums,sum->l>=total/2) + if_exists(sum,sums,sum->l>=total_traffic/2) { fprintf(f,"Top 50%% of traffic\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } - if_exists(sum,sums,sum->l>=4*total/5) + if_exists(sum,sums,sum->l>=4*total_traffic/5) { fprintf(f,"Top 80%% of traffic\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->i>=(active_classes+1)/5) @@ -1709,30 +1710,30 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); top20_count=sum->i; top20_perc1=(100*sum->i+50)/active_classes; top20_sum=sum->l; - top20_perc2=(100*sum->l+50)/total; + top20_perc2=(100*sum->l+50)/total_traffic; fprintf(f,"%d%d %%%Lu M%Ld %%\n",top20_count,top20_perc1,top20_sum,top20_perc2); } if_exists(sum,sums,sum->i>=(active_classes+1)/4) { fprintf(f,"Top 25%% downloaders\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->i>=(active_classes+1)/2) { fprintf(f,"Top 50%% downloaders\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->i>=4*(active_classes+1)/5) { fprintf(f,"Top 80%% downloaders\n"); - fprintf(f,"%d%d %%%Lu M%Ld %%\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + 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,"All users, all traffic\n", log_url); - fprintf(f,"%d100 %%%Lu M100 %%\n",active_classes,total); + fprintf(f,"%d100 %%%Lu M100 %%\n",active_classes,total_traffic); fputs("\n", f); /* write basic ERP data to log directory */ @@ -1742,8 +1743,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); iplog=fopen(str,"a"); if(iplog) { - fprintf(iplog,"%ld\t%d\t%d %%\t%Lu M\t%Ld %%\t%d\t%Lu M\t%s", - time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, active_classes, total, d); /* d = date*/ + fprintf(iplog,"%ld\t%d\t%d %%\t%Lu M\t%Ld %%\t%d\t%Lu M\t%d\t%s", + time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, active_classes, total_traffic, total, d); /* d = date*/ fclose(iplog); } }