source code + html output formatting
[svn/Prometheus-QoS/.git] / prometheus.c
index f12de15..3e4cb83 100644 (file)
@@ -958,7 +958,11 @@ void parse_ip_log(int argc, char **argv)
    if_exists(iplog,iplogs,iplog->l>=total/4)\r
    {\r
     fprintf(f,"%s<td>Top 25%% of traffic</td>\n", tr_odd_even());\r
-    fprintf(f,"<td style=\"text-align: right\">%d</td><td style=\"text-align: right\">%d %%</td><td style=\"text-align: right\">%ld G</td><td style=\"text-align: right\">%d %%</td></tr>\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+    fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
+<td style=\"text-align: right\">%d %%</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
+<td style=\"text-align: right\">%d %%</td></tr>\n",\r
+              iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
    \r
    if_exists(iplog,iplogs,iplog->i==10)\r
@@ -966,9 +970,9 @@ void parse_ip_log(int argc, char **argv)
     fprintf(f,"%s<td>Top 10 downloaders</td>\n", tr_odd_even());\r
     fprintf(f,"<td style=\"text-align: right\"><strong>10</strong></td>\n\\r
 <td style=\"text-align: right\">%d %%</td>\n\\r
-<td style=\"text-align: right\">%ld G</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
 <td style=\"text-align: right\">%d %%</td></tr>\n",\r
-               (100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+               (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    if_exists(iplog,iplogs,iplog->l>=total/2)\r
@@ -976,7 +980,7 @@ void parse_ip_log(int argc, char **argv)
     fprintf(f,"%s<td>Top 50%% of traffic</td>\n", tr_odd_even());\r
     fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
 <td style=\"text-align: right\">%d %%</td>\n\\r
-<td style=\"text-align: right\">%ld G</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
 <td style=\"text-align: right\"><strong>%d %%</strong></td></tr>\n",\r
               iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
    }\r
@@ -986,9 +990,9 @@ void parse_ip_log(int argc, char **argv)
     fprintf(f,"%s<td>Top 80%% of traffic</td>\n",tr_odd_even());\r
     fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
 <td style=\"text-align: right\">%d %%</td>\n\\r
-<td style=\"text-align: right\">%ld G</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
 <td style=\"text-align: right\"><strong>%d %%</strong></td></tr>\n",\r
-              iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+              iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    if_exists (iplog,iplogs,iplog->i>=i/5)\r
@@ -996,15 +1000,19 @@ void parse_ip_log(int argc, char **argv)
     fprintf(f,"%s<td>Top 20%% downloaders</td>\n",tr_odd_even());\r
     fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
 <td style=\"text-align: right\"><strong>%d %%</strong></td>\n\\r
-<td style=\"text-align: right\">%ld G</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
 <td style=\"text-align: right\">%d %%</td></tr>\n",\r
-              iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+              iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    if_exists(iplog,iplogs,iplog->i>=i/4)\r
    {\r
     fprintf(f,"%s<td>Top 25%% downloaders</td>\n", tr_odd_even());\r
-    fprintf(f,"<td style=\"text-align: right\">%d</td><td style=\"text-align: right\">%d %%</td><td style=\"text-align: right\">%ld G</td><td style=\"text-align: right\">%d %%</td></tr>\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+    fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
+<td style=\"text-align: right\">%d %%</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
+<td style=\"text-align: right\">%d %%</td></tr>\n",\r
+               iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    if_exists(iplog,iplogs,iplog->i>=i/2)\r
@@ -1012,19 +1020,25 @@ void parse_ip_log(int argc, char **argv)
     fprintf(f,"%s<td>Top 50%% downloaders</td>\n",tr_odd_even());\r
     fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
 <td style=\"text-align: right\"><strong>%d %%</strong></td>\n\\r
-<td style=\"text-align: right\">%ld G</td><td style=\"text-align: right\">%d %%</td></tr>\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
+<td style=\"text-align: right\">%d %%</td></tr>\n",\r
+              iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    if_exists(iplog,iplogs,iplog->i>=4*i/5)\r
    {\r
     fprintf(f,"%s<td>Top 80%% downloaders</td>\n",tr_odd_even());\r
-    fprintf(f,"<td style=\"text-align: right\">%d</td><td style=\"text-align: right\">%d %%</td><td style=\"text-align: right\">%ld G</td><td style=\"text-align: right\">%d %%</td></tr>\n",iplog->i,(100*iplog->i+50)/i,iplog->l,(int)((100*iplog->l+50)/total));\r
+    fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
+<td style=\"text-align: right\">%d %%</td>\n\\r
+<td style=\"text-align: right\">%ld GB</td>\n\\r
+<td style=\"text-align: right\">%d %%</td></tr>\n",\r
+              iplog->i, (100*iplog->i+50)/i, iplog->l, (int)((100*iplog->l+50)/total));\r
    }\r
 \r
    fprintf(f,"</tbody><thead><tr><th><a class=\"blue\" target=\"_blank\" href=\"%sERP.log\">All users, all traffic</a></th>\n", log_url);\r
    fprintf(f,"<th style=\"text-align: right\">%d</th>\n\\r
 <th style=\"text-align: right\">100 %%</th>\n\\r
-<th style=\"text-align: right\">%ld G</th>\n\\r
+<th style=\"text-align: right\">%ld GB</th>\n\\r
 <th style=\"text-align: right\">100 %%</th></tr>\n",i-1,total);\r
    fputs("</thead></table>\n", f);\r
   }\r
@@ -1924,7 +1938,11 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    if_exists(sum,sums,sum->l>=total_traffic/4)\r
    {\r
     fprintf(f,"%s<td>Top 25%% of traffic</td>\n", tr_odd_even());\r
-    fprintf(f,"<td style=\"text-align: right\">%d</td><td style=\"text-align: right\">%d %%</td><td style=\"text-align: right\">%Lu M</td><td style=\"text-align: right\">%Ld %%</td></tr>\n",sum->i,(100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic);\r
+    fprintf(f,"<td style=\"text-align: right\">%d</td>\n\\r
+<td style=\"text-align: right\">%d %%</td>\n\\r
+<td style=\"text-align: right\">%Lu MB</td>\n\\r
+<td style=\"text-align: right\">%Ld %%</td></tr>\n",\r
+              sum->i, (100*sum->i+50)/active_classes, sum->l, (100*sum->l+50)/total_traffic);\r
    }\r
    \r
    if_exists(sum,sums,sum->i==10)\r
@@ -1934,7 +1952,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 <td style=\"text-align: right\">%d %%</td>\n\\r
 <td style=\"text-align: right\">%Lu MB</td>\n\\r
 <td style=\"text-align: right\">%Ld %%</td></tr>\n",\r
-              (100*sum->i+50)/active_classes,sum->l,(100*sum->l+50)/total_traffic);\r
+              (100*sum->i+50)/active_classes, sum->l, (100*sum->l+50)/total_traffic);\r
    }\r
 \r
    if_exists(sum,sums,sum->l>=total_traffic/2)\r
@@ -2004,7 +2022,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    fprintf(f,"<thead><tr><th><a class=\"blue\" target=\"_blank\" href=\"%sERP.log\">All users, all traffic</a></th>\n", log_url);\r
    fprintf(f,"<th style=\"text-align: right\">%d</th>\n\\r
 <th style=\"text-align: right\">100 %%</th>\n\\r
-<th style=\"text-align: right\">%Lu M</th>\n\\r
+<th style=\"text-align: right\">%Lu MB</th>\n\\r
 <th style=\"text-align: right\">100 %%</th></tr>\n",active_classes,total_traffic);\r
    fputs("</thead></table>\n", f);\r
 \r
This page took 0.202217 seconds and 4 git commands to generate.