Changeset 1343 for trunk/pdns/pdns/ws.cc
- Timestamp:
- 03/29/09 23:34:17 (12 months ago)
- Files:
-
- 1 modified
-
trunk/pdns/pdns/ws.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/ws.cc
r1303 r1343 105 105 int printed=0; 106 106 for(vector<pair<string,int> >::const_iterator i=ring.begin();limit && i!=ring.end();++i,--limit) { 107 ret<<"<tr><td>"<<i->first<<"</td><td>"<<i->second<<"</td><td align=right>"<< (boost::format("%.01f") % (i->second*100.0/tot))<<"%</td>"<<endl;107 ret<<"<tr><td>"<<i->first<<"</td><td>"<<i->second<<"</td><td align=right>"<< StatWebServer::makePercentage(i->second*100.0/tot)<<"</td>"<<endl; 108 108 printed+=i->second; 109 109 } 110 110 ret<<"<tr><td colspan=3></td></tr>"<<endl; 111 111 if(printed!=tot) 112 ret<<"<tr><td><b>Rest:</b></td><td><b>"<<tot-printed<<"</b></td><td align=right><b>"<< (boost::format("%.01f") % ((tot-printed)*100.0/tot))<<"%</b></td>"<<endl;112 ret<<"<tr><td><b>Rest:</b></td><td><b>"<<tot-printed<<"</b></td><td align=right><b>"<< StatWebServer::makePercentage((tot-printed)*100.0/tot)<<"</b></td>"<<endl; 113 113 114 114 ret<<"<tr><td><b>Total:</b></td><td><b>"<<tot<<"</td><td align=right><b>100%</b></td>"; … … 135 135 ret<<"<tr><td>"<<*i<<"</td><td>"<<arg()[*i]<<"</td><td>"<<arg().getHelp(*i)<<"</td>"<<endl; 136 136 } 137 } 138 139 string StatWebServer::makePercentage(const double& val) 140 { 141 return (boost::format("%.01f%%") % val).str(); 137 142 } 138 143 … … 179 184 180 185 if(sws->d_cachemisses.get10()+sws->d_cachehits.get10()>0) 181 ret<<"Cache hitrate, 1, 5, 10 minute averages: "<< setprecision(2)<<182 (sws->d_cachehits.get1()*100.0)/((sws->d_cachehits.get1())+(sws->d_cachemisses.get1()))<<"%, "<<183 (sws->d_cachehits.get5()*100.0)/((sws->d_cachehits.get5())+(sws->d_cachemisses.get5()))<<"%, "<<184 (sws->d_cachehits.get10()*100.0)/((sws->d_cachehits.get10())+(sws->d_cachemisses.get10()))<<185 " %<br>"<<endl;186 ret<<"Cache hitrate, 1, 5, 10 minute averages: "<< 187 makePercentage((sws->d_cachehits.get1()*100.0)/((sws->d_cachehits.get1())+(sws->d_cachemisses.get1())))<<", "<< 188 makePercentage((sws->d_cachehits.get5()*100.0)/((sws->d_cachehits.get5())+(sws->d_cachemisses.get5())))<<", "<< 189 makePercentage((sws->d_cachehits.get10()*100.0)/((sws->d_cachehits.get10())+(sws->d_cachemisses.get10())))<< 190 "<br>"<<endl; 186 191 187 192 if(sws->d_qcachemisses.get10()+sws->d_qcachehits.get10()>0) 188 193 ret<<"Backend query cache hitrate, 1, 5, 10 minute averages: "<<setprecision(2)<< 189 (sws->d_qcachehits.get1()*100.0)/((sws->d_qcachehits.get1())+(sws->d_qcachemisses.get1()))<<"%, "<<190 (sws->d_qcachehits.get5()*100.0)/((sws->d_qcachehits.get5())+(sws->d_qcachemisses.get5()))<<"%, "<<191 (sws->d_qcachehits.get10()*100.0)/((sws->d_qcachehits.get10())+(sws->d_qcachemisses.get10()))<<192 " %<br>"<<endl;194 makePercentage((sws->d_qcachehits.get1()*100.0)/((sws->d_qcachehits.get1())+(sws->d_qcachemisses.get1())))<<", "<< 195 makePercentage((sws->d_qcachehits.get5()*100.0)/((sws->d_qcachehits.get5())+(sws->d_qcachemisses.get5())))<<", "<< 196 makePercentage((sws->d_qcachehits.get10()*100.0)/((sws->d_qcachehits.get10())+(sws->d_qcachemisses.get10())))<< 197 "<br>"<<endl; 193 198 194 199 ret<<"Backend query load, 1, 5, 10 minute averages: "<<setprecision(3)<<