From 60a8251d24edd7db28a2490a5cbc8bc98d305eed Mon Sep 17 00:00:00 2001 From: xchaos Date: Sun, 27 Nov 2011 23:41:58 +0000 Subject: [PATCH] ERP summary logging git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@150 251d49ef-1d17-4917-a970-b30cf55b089b --- prometheus.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/prometheus.c b/prometheus.c index 4c63dfe..f158e32 100644 --- a/prometheus.c +++ b/prometheus.c @@ -1672,6 +1672,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); if(active_classes>10) { + int top20_count=0,top20_perc1=0; + long long top20_perc2=0; + unsigned long long top20_sum=0l; + fputs("

\n",f); fputs("\n",f); fputs("\n",f); @@ -1700,10 +1704,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); } - if_exists (sum,sums,sum->i>=(active_classes+1)/5) + if_exists(sum,sums,sum->i>=(active_classes+1)/5) { fprintf(f,"\n"); - fprintf(f,"\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total); + top20_count=sum->i; + top20_perc1=(100*sum->i+50)/active_classes; + top20_sum=sum->l; + top20_perc2=(100*sum->l+50)/total; + fprintf(f,"\n",top20_count,top20_perc1,top20_sum,top20_perc2); } if_exists(sum,sums,sum->i>=(active_classes+1)/4) @@ -1727,7 +1735,21 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version); fprintf(f,"\n"); fprintf(f,"\n",active_classes,total); fputs("
Enterprise Research and Planning (ERP)
Analytic categoryActive ClassesData transfers
%d%d %%%Lu M%Ld %%
Top 20%% downloaders%d%d %%%Lu M%Ld %%
%d%d %%%Lu M%Ld %%
All users, all traffic%d100 %%%Lu M100 %%
\n", f); + + /*write basic ERP data to log directory*/ + if(!just_preview) + { + sprintf(str,"%s/ERP.log",log_dir); + iplog=fopen(str,"a"); + if(iplog) + { + fprintf(iplog,"%ld\t%d\t%d %%\t%Lu\t%Ld %%\t%d\t%Lu\t%s", + time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, active_classes, total, d); /* d = date*/ + fclose(iplog); + } + } } + fprintf(f, stats_html_signature, version); fclose(f); } -- 2.30.2