\r
if(active_classes>10)\r
{\r
+ int top20_count=0,top20_perc1=0;\r
+ long long top20_perc2=0;\r
+ unsigned long long top20_sum=0l;\r
+ \r
fputs("<a name=\"erp\"></a><p><table border><tr><th colspan=\"5\">Enterprise Research and Planning (ERP)</th></tr>\n",f);\r
fputs("<tr><td>Analytic category</td>\n",f);\r
fputs("<td colspan=\"2\" align=\"center\">Active Classes</td><td colspan=\"2\" align=\"center\">Data transfers</td></tr>\n",f);\r
fprintf(f,"<td align=\"right\">%d</td><td align=\"right\">%d %%</td><td align=\"right\">%Lu M</td><th align=\"right\">%Ld %%</th></tr>\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total);\r
}\r
\r
- if_exists (sum,sums,sum->i>=(active_classes+1)/5)\r
+ if_exists(sum,sums,sum->i>=(active_classes+1)/5)\r
{\r
fprintf(f,"<tr><td>Top 20%% downloaders</td>\n");\r
- fprintf(f,"<td align=\"right\">%d</td><th align=\"right\">%d %%</th><td align=\"right\">%Lu M</td><td align=\"right\">%Ld %%</td></tr>\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total);\r
+ top20_count=sum->i;\r
+ top20_perc1=(100*sum->i+50)/active_classes;\r
+ top20_sum=sum->l;\r
+ top20_perc2=(100*sum->l+50)/total;\r
+ fprintf(f,"<td align=\"right\">%d</td><th align=\"right\">%d %%</th><td align=\"right\">%Lu M</td><td align=\"right\">%Ld %%</td></tr>\n",top20_count,top20_perc1,top20_sum,top20_perc2);\r
}\r
\r
if_exists(sum,sums,sum->i>=(active_classes+1)/4)\r
fprintf(f,"<tr><td>All users, all traffic</td>\n");\r
fprintf(f,"<th align=\"right\">%d</th><th align=\"right\">100 %%</th><th align=\"right\">%Lu M</th><th align=\"right\">100 %%</th></tr>\n",active_classes,total);\r
fputs("</table>\n", f);\r
+\r
+ /*write basic ERP data to log directory*/\r
+ if(!just_preview)\r
+ {\r
+ sprintf(str,"%s/ERP.log",log_dir);\r
+ iplog=fopen(str,"a");\r
+ if(iplog)\r
+ {\r
+ fprintf(iplog,"%ld\t%d\t%d %%\t%Lu\t%Ld %%\t%d\t%Lu\t%s",\r
+ time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, active_classes, total, d); /* d = date*/\r
+ fclose(iplog);\r
+ }\r
+ }\r
}\r
+\r
fprintf(f, stats_html_signature, version);\r
fclose(f);\r
}\r