ERP summary logging
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 27 Nov 2011 23:41:58 +0000 (23:41 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Sun, 27 Nov 2011 23:41:58 +0000 (23:41 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@150 251d49ef-1d17-4917-a970-b30cf55b089b

prometheus.c

index 4c63dfe..f158e32 100644 (file)
@@ -1672,6 +1672,10 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 \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
@@ -1700,10 +1704,14 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     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
@@ -1727,7 +1735,21 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    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
This page took 0.130653 seconds and 4 git commands to generate.