From: xchaos Date: Fri, 11 May 2012 11:26:50 +0000 (+0000) Subject: vylepsene formatovani tabulek (rozpracovano) X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=103d292c3e392be70875c89e6959417c694ca56d;p=svn%2FPrometheus-QoS%2F.git vylepsene formatovani tabulek (rozpracovano) git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@163 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/prometheus.c b/prometheus.c index 3657448..ba52a1a 100644 --- a/prometheus.c +++ b/prometheus.c @@ -40,7 +40,7 @@ const char *version = "0.8.3-c"; /* C source code development versions ("beta"): 0.7.9-a, 0.8.1-b, etc. */ /* C source code release versions: 0.8.0, 0.8.2, 0.8.4, etc. */ -const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2012 Michael Polak, Arachne Labs
\n"; +const char *stats_html_signature = "Statistics generated by Prometheus QoS version %s
GPL+Copyright(C)2005-2012 Michael Polak, Arachne Labs
\n"; /* ======= All path names are defined here (for RPM patch) ======= */ @@ -899,7 +899,12 @@ void parse_ip_log(int argc, char **argv) f=fopen(str,"w"); if(f) { - fprintf(f, "\n ", + fprintf(f, "
%s %slmsData transfersMin.speed
\n\ +\n\ +\n\ +\n\ +\n\ +\n ", month, year); row_odd_even = 0; @@ -907,84 +912,93 @@ void parse_ip_log(int argc, char **argv) { if(iplog->traffic) { - fprintf(f, "%s\n\ +\n\ +\n", + fprintf(f, "\n\ + \n\ + \n", iplog->traffic, iplog->traffic>>10, iplog->guaranted); total+=iplog->traffic>>10; iplog->i=i; iplog->l=total; } } - fprintf(f,"\n", total, line); + fprintf(f,"\ + \ + \ + \n", total, line); fputs("
%s %slmsData transfersMin.speed
%d%s", + fprintf(f, "%s%d%s", tr_odd_even(), i++, log_url, iplog->name, iplog->name); if(iplog->lmsid > 0) { /*base URL will be configurable soon ... */ - fprintf(f, "%04d\n", lms_url, iplog->lmsid, iplog->lmsid); + fprintf(f, "%04d\n", lms_url, iplog->lmsid, iplog->lmsid); } else if(iplog->lmsid == 0) { fputs("-------",f); } - fprintf(f, "%ld M%ld G%ld kbps
%ld M%ld G%ld kbps
Total:%ld GB%Ld kbps
Total:%ld GB%Ld kbps
\n", f); row_odd_even = 0; if(i>10) { - fputs("

\n",f); - fputs("\n",f); - fputs("\n\n",f); + fputs("

Enterprise Resource Planning (ERP)
Analytic categoryActive ClassesData transfers
\n\ +\n\ +\n\ +\n\ +\n\n",f); if_exists(iplog,iplogs,iplog->l>=total/4) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i==10) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->l>=total/2) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->l>=4*total/5) { fprintf(f,"%s\n",tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } if_exists (iplog,iplogs,iplog->i>=i/5) { fprintf(f,"%s\n",tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",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,"%s\n", tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } if_exists(iplog,iplogs,iplog->i>=i/2) { fprintf(f,"%s\n",tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\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,"%s\n",tr_odd_even()); - fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); + fprintf(f,"\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total)); } - fprintf(f,"\n"); - fprintf(f,"\n",i-1,total); + fprintf(f,"\n"); + fprintf(f,"\n",i-1,total); fputs("
Enterprise Resource Planning (ERP)
Analytic categoryActive ClassesData transfers
Top 25%% of traffic%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 10 downloaders10%d %%%ld G%d %%
10%d %%%ld G%d %%
Top 50%% of traffic%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 80%% of traffic%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 20%% downloaders%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 25%% downloaders%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 50%% downloaders%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
Top 80%% downloaders%d%d %%%ld G%d %%
%d%d %%%ld G%d %%
All users, all traffic%d100 %%%ld G100 %%
All users, all traffic%d100 %%%ld G100 %%
\n", f); } @@ -1588,7 +1602,11 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); { fprintf(f,"\n", jquery_url); } - fputs("\n\n",f); + fputs("
#groupIPsrequested
\n\n\ +\n\ +\n\ +\n\ +\n",f); fprintf(f,"\n", keywordcount); fputs("\n",f); @@ -1598,14 +1616,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); #ifdef DEBUG printf("%d k group: %d bandwidth requested: %d k\n",group->min,group->count,group->desired); #endif - fprintf(f, "%s", + fprintf(f, "%s", tr_odd_even(), count, group->min); - fprintf(f, "", + fprintf(f, "", group->count, group->desired); for_each(keyword, keywords) { - fprintf(f,"", + fprintf(f,"", keyword->html_color, group->min*keyword->data_limit); } i += group->desired; @@ -1616,12 +1634,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); printf("Total groups: %d Total bandwidth requested: %d k\nAGGREGATION: 1/%d\n", count, i, i/line); #endif - fprintf(f,"",keyword->ip_count); + fprintf(f,"",keyword->ip_count); } fprintf(f,"\n", (int)(0.5+i/line)); fprintf(f,"\n", keywordcount, total); @@ -1653,26 +1671,26 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); colspan++; } - fprintf(f,"

#groupIPsrequesteddata limits
%d%d k%d%d k%d%d k%d%d k%d M%d M
Line %Ld k",line); - fprintf(f,"%d%d k",total,i); + fprintf(f,"
Line %Ld k",line); + fprintf(f,"%d%d k",total,i); for_each(keyword, keywords) { - fprintf(f,"%d IPs%d IPs
Aggregation 1/%d%d traffic classes
\n
%s",title); + fprintf(f,"

\n\n", d); - fputs("",f); + fputs("",f); if(found_lmsid) { - fputs("\n",f); + fputs("\n",f); } - fputs("\ -\ -\ -\n",f); + fputs("\ +\ +\ +\n",f); if(qos_proxy) { - fputs("\n",f); + fputs("\n",f); } - fputs("\ -\ -\ -\ -\n\ + fputs("\ +\ +\ +\ +\n\ \n",f); row_odd_even = 0; @@ -1698,7 +1716,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); printf("%03d. %-22s %10Lu (%d/%d)\n",i ,ip->name, ip->traffic, ip->min, ip->max); #endif /* hostnames -------------------------------------- */ - fprintf(f,"%s\n",f); } - fprintf(f,"\n", ip->credit); - fprintf(f,"", + fprintf(f,"\n", ip->credit); + fprintf(f,"", ip->keyword->html_color, ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20))); - fprintf(f,"\n", ip->proxy); + fprintf(f,"\n", ip->proxy); } /* upload ---------------------------------------- */ - fprintf(f,"\n",f); /* ----------------------------------------------- */ - fprintf(f,"\n", + fprintf(f,"\n", ip->min,ip->desired,f1,ip->max,f2,f1,ip->prio,f2); total_traffic+=ip->traffic; @@ -1801,13 +1819,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } } } - fprintf(f,"", colspan-7, i); - fprintf(f,"\n", total_traffic, total_direct); + fprintf(f,"", colspan-7, i); + fprintf(f,"\n", total_traffic, total_direct); if(qos_proxy) { - fprintf(f,"\n", total_proxy); + fprintf(f,"\n", total_proxy); } - fprintf(f,"", total_upload); + fprintf(f,"", total_upload); fprintf(f,"\n
%s",title); fprintf(f," (%s)
#hostname
#hostnamelmslmscreditlimittotaldirectcreditlimittotaldirectproxyproxyuploadminimumdesiredmaximumprio
uploadminimumdesiredmaximumprio
%d%s\n", + fprintf(f,"%s%d%s\n", tr_odd_even(), ip->name, i, log_url, ip->name, ip->name); if(use_jquery_popups) { @@ -1706,13 +1724,13 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); popup_button=0; for_each(sharedip, ips) if(eq(ip->name, sharedip->sharing)) { - fprintf(f,"
%s\n", log_url, sharedip->name, sharedip->name); + fprintf(f,"
%s\n", log_url, sharedip->name, sharedip->name); popup_button++; } fputs("\n",f); if(popup_button) { - fprintf(f,"[+%d]", + fprintf(f,"[+%d]", i, i, i, popup_button); } } @@ -1721,11 +1739,11 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(found_lmsid) { - fputs("
",f); + fputs("",f); if(ip->lmsid > 0) { /*base URL will be configurable soon ... */ - fprintf(f,"%04d\n", lms_url, ip->lmsid, ip->lmsid); + fprintf(f,"%04d\n", lms_url, ip->lmsid, ip->lmsid); } else if(ip->lmsid == 0) { @@ -1733,14 +1751,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); } fputs("%Lu M%Lu M%Lu M%Lu M%s%Lu M%s", f1, ip->traffic, f2); + fprintf(f,"%s%Lu M%s", f1, ip->traffic, f2); /* download --------------------------------------- */ - fprintf(f,"%Lu M", ip->direct); + fprintf(f,"%Lu M", ip->direct); if(use_jquery_popups) { fprintf(f,"",i); @@ -1755,10 +1773,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(qos_proxy) { - fprintf(f,"%Lu M%Lu M%Lu M", ip->upload); + fprintf(f,"%Lu M", ip->upload); if(use_jquery_popups) { fprintf(f,"",i); @@ -1771,7 +1789,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fputs("%d k%d k%s%d k%s%s%d%s
%d k%d k%s%d k%s%s%d%s
%d CLASSES%Lu M%Lu M
%d CLASSES%Lu M%Lu M%Lu M%Lu M%Lu M%Lu MFUP-LIMIT %dx LOW-PRIO %dx
\n",limit_count,prio_count); row_odd_even = 0; @@ -1817,32 +1835,32 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); long long top20_perc2=0; unsigned long long top20_sum=0l; - fputs("

\n",f); - fputs("\n",f); - fputs("\n",f); + fputs("

Enterprise Resource Planning (ERP)
Analytic categoryActive ClassesData transfers
\n",f); + fputs("\n",f); + fputs("\n",f); if_exists(sum,sums,sum->l>=total_traffic/4) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\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,"%s\n", tr_odd_even()); - fprintf(f,"\n",(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\n",(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } if_exists(sum,sums,sum->l>=total_traffic/2) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\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_traffic/5) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\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) @@ -1852,29 +1870,32 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); top20_perc1=(100*sum->i+50)/active_classes; top20_sum=sum->l; top20_perc2=(100*sum->l+50)/total_traffic; - fprintf(f,"\n",top20_count,top20_perc1,top20_sum,top20_perc2); + fprintf(f,"\n",top20_count,top20_perc1,top20_sum,top20_perc2); } if_exists(sum,sums,sum->i>=(active_classes+1)/4) { fprintf(f,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\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,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\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,"%s\n", tr_odd_even()); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); + fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic); } - fprintf(f,"\n", log_url); - fprintf(f,"\n",active_classes,total_traffic); + fprintf(f,"\n", log_url); + fprintf(f,"\n\ +\n\ +\n\ +\n",active_classes,total_traffic); fputs("
Enterprise Resource Planning (ERP)
Analytic categoryActive ClassesData transfers
Top 25%% of traffic%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
Top 10 downloaders10%d %%%Lu M%Ld %%
10%d %%%Lu M%Ld %%
Top 50%% of traffic%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
Top 80%% of traffic%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
Top 25%% downloaders%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
Top 50%% downloaders%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
Top 80%% downloaders%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
All users, all traffic%d100 %%%Lu M100 %%
All users, all traffic%d100 %%%Lu M100 %%
\n", f); /* write basic ERP data to log directory */