1 2biggraph = "arg=rpctotal&graph=diff" 3 4graphname = new Array( 5 "arg=*&graph=diskbw", 6 "<b>disk</b> bytes/second", 7 "arg=*&graph=netbw", 8 "<b>network</b> bytes/second", 9 "arg=*&graph=iobw", 10 "total: <b>disk+net</b> bytes/second", 11 12 "arg=apartreadbyte&graph=diff", 13 "arena read bytes/second", 14 "arg=apartwritebyte&graph=diff", 15 "arena write bytes/second", 16 17 "arg=bloomfalsemiss&graph=pctdiff&arg2=bloomlookup&max=100", 18 "bloom false hit %", 19 "arg=bloomhit&graph=pctdiff&arg2=bloomlookup&max=100", 20 "bloom miss %", 21 "arg=bloomlookuptime&graph=divdiff&arg2=bloomlookup", 22 "bloom lookup time", 23 "arg=bloomones&graph=pct&arg2=bloombits&max=100", 24 "bloom usage %", 25 26 "arg=dcachedirty&graph=pct&arg2=dcachesize&max=100", 27 "dcache dirty %", 28 "arg=dcachehit&graph=pctdiff&arg2=dcachelookup&max=100", 29 "dcache hit %", 30 "arg=dcachelookuptime&graph=divdiff&arg2=dcachelookup", 31 "dcache lookup time", 32 "arg=dcachelookup&graph=diff", 33 "dcache lookups/second", 34 "arg=dcachewrite&graph=diff", 35 "dcache writes/second", 36 37 "arg=icachedirty&graph=pct&arg2=icachesize&max=100", 38 "icache dirty %", 39 "arg=icachehit&graph=pctdiff&arg2=icachelookup&max=100", 40 "icache hit %", 41 "arg=icachelookuptime&graph=divdiff&arg2=icachelookup", 42 "icache lookup time", 43 "arg=icacheprefetch&graph=diff", 44 "icache prefetches/second", 45 "arg=icachewrite&graph=diff", 46 "icache writes/second", 47 48 "arg=isectreadbyte&graph=diff", 49 "isect read bytes/second", 50 "arg=isectwritebyte&graph=diff", 51 "isect write bytes/second", 52 53 "arg=lcachehit&graph=pctdiff&arg2=lcachelookup&max=100", 54 "lump cache hit %", 55 "arg=lcachelookuptime&graph=divdiff&arg2=lcachelookup", 56 "lump cache lookup time", 57 "arg=lcachewrite&graph=diff", 58 "lcache writes/second", 59 60 "arg=rpcreadbyte&graph=diff", 61 "read RPC bytes/second", 62 "arg=rpctotal&graph=diff", 63 "RPCs/second", 64 "arg=rpcwritebyte&graph=diff", 65 "write RPC bytes/second", 66 "arg=rpcreadtime&graph=divdiff&arg2=rpcread", 67 "read RPC time", 68 "arg=rpcwritetime&graph=divdiff&arg2=rpcwrite", 69 "write RPC time", 70 "arg=rpcreadcachedtime&graph=divdiff&arg2=rpcreadcached", 71 "cached read RPC time", 72 "arg=rpcreaduncachedtime&graph=divdiff&arg2=rpcreaduncached", 73 "uncached read RPC time", 74 "arg=rpcwritenewtime&graph=divdiff&arg2=rpcwritenew", 75 "fresh write RPC time", 76 "arg=rpcwriteoldtime&graph=divdiff&arg2=rpcwriteold", 77 "dup write RPC time", 78 79 "arg=sumreadbyte&graph=diff", 80 "checksum bytes/second", 81 82 "arg=dblockstall", 83 "threads stalled: dblock", 84 "arg=dcachestall", 85 "threads stalled: dcache", 86 "arg=icachestall", 87 "threads stalled: icache", 88 "arg=lumpstall", 89 "threads stalled: lump", 90 91 "arg=END" 92) 93 94column0 = new Array( 95 "column0", 96 "!bandwidth", 97 "arg=*&graph=iobw", 98 "arg=*&graph=netbw", 99 "arg=rpcreadbyte&graph=diff", 100 "arg=rpcwritebyte&graph=diff", 101 "arg=*&graph=diskbw", 102 "arg=isectreadbyte&graph=diff", 103 "arg=isectwritebyte&graph=diff", 104 "arg=apartreadbyte&graph=diff", 105 "arg=apartwritebyte&graph=diff", 106 "arg=sumreadbyte&graph=diff", 107 108 "!bloom filter", 109 "arg=bloomhit&graph=pctdiff&arg2=bloomlookup&max=100", 110 "arg=bloomfalsemiss&graph=pctdiff&arg2=bloomlookup&max=100", 111 "arg=bloomones&graph=pct&arg2=bloombits&max=100", 112 113 "END" 114) 115 116column1 = new Array( 117 "column1", 118 "!icache", 119 "arg=icachedirty&graph=pct&arg2=icachesize&max=100", 120 "arg=icachehit&graph=pctdiff&arg2=icachelookup&max=100", 121 "arg=icachewrite&graph=diff", 122 "arg=icacheprefetch&graph=diff", 123 124 "!dcache", 125 "arg=dcachedirty&graph=pct&arg2=dcachesize&max=100", 126 "arg=dcachehit&graph=pctdiff&arg2=dcachelookup&max=100", 127 "arg=dcachelookup&graph=diff", 128 "arg=dcachewrite&graph=diff", 129 130 "!lump cache", 131 "arg=lcachehit&graph=pctdiff&arg2=lcachelookup&max=100", 132 "arg=lcachewrite&graph=diff", 133 134 "END" 135) 136 137column2 = new Array( 138 "column2", 139 140 "!stalls", 141 "arg=icachestall", 142 "arg=dcachestall", 143 "arg=dblockstall", 144 "arg=lumpstall", 145 146 "!timings", 147 "arg=bloomlookuptime&graph=divdiff&arg2=bloomlookup", 148 "arg=icachelookuptime&graph=divdiff&arg2=icachelookup", 149 "arg=lcachelookuptime&graph=divdiff&arg2=lcachelookup", 150 "arg=dcachelookuptime&graph=divdiff&arg2=dcachelookup", 151 "arg=rpcreadtime&graph=divdiff&arg2=rpcread", 152 "arg=rpcwritetime&graph=divdiff&arg2=rpcwrite", 153 "arg=rpcreadcachedtime&graph=divdiff&arg2=rpcreadcached", 154 "arg=rpcreaduncachedtime&graph=divdiff&arg2=rpcreaduncached", 155 "arg=rpcwritenewtime&graph=divdiff&arg2=rpcwritenew", 156 "arg=rpcwriteoldtime&graph=divdiff&arg2=rpcwriteold", 157 158 "END" 159) 160 161col0info = new Array(column0.length) 162col1info = new Array(column1.length) 163col2info = new Array(column2.length) 164 165function cleardebug() { 166 var p = document.getElementById("debug") 167 p.innerHTML = "" 168} 169 170function debug(s) { 171 var p = document.getElementById("debug") 172 if(p.innerHTML == "") 173 p.innerHTML = "<a href=\"javascript:cleardebug()\">clear</a>\n" 174 p.innerHTML += "<br>"+s 175} 176 177function Ginfo(y, fill, name) { 178 var g = new Object() 179 g.y = y 180 g.fill = fill 181 g.name = name 182 return g 183} 184 185function cleartable(t) { 186 for(var i=t.rows.length-1; i>=0; i--) 187 t.deleteRow(i) 188} 189 190function textofname(name) 191{ 192 for(var i=0; i<graphname.length; i+=2) 193 if(name == graphname[i]) 194 return graphname[i+1] 195} 196 197function graphrow(row, span, name, dt, wid, ht, fill, text) { 198 var url = "/graph?"+name 199 url = url+"&min=0" 200 url = url+"&t0=-"+dt 201 url = url+"&wid="+wid 202 url = url+"&ht="+ht 203 url = url+"&fill="+fill 204 205 var s = "<td colSpan="+span 206 s = s+" valign=bottom" 207 s = s+" align=center" 208 s = s+" width="+wid 209 s = s+" height="+ht 210 s = s+" style=\"background-image: url("+url+");\"" 211 s = s+">"+textofname(name)+text+"</td>" 212 row.innerHTML = s 213} 214 215 216function graphcell(cell, name, dt, wid, ht, fill) { 217 cell.vAlign = "bottom" 218 cell.align = "center" 219 cell.width = wid 220 cell.height = ht 221} 222 223function redraw() { 224 redrawgraphs() 225 redrawsettings() 226} 227 228function redrawgraphs() { 229 var t = document.getElementById("statgraphs") 230 231 cleartable(t) 232 for(var i=0; i<4; i++) 233 t.insertRow(i) 234 235 graphrow(t.rows[0], 3, biggraph, 86400, 900, 30, 0, " – showing 24 hours") 236 graphrow(t.rows[1], 3, biggraph, 3600, 900, 30, 1, " – showing 1 hour") 237 t.rows[2].innerHTML = "<td height=10></td>" 238 239 var r = t.rows[3] 240 graphtable(r.insertCell(0), column0, col0info, 0) 241 graphtable(r.insertCell(1), column1, col1info, 2) 242 graphtable(r.insertCell(2), column2, col2info, 4) 243} 244 245function graphtable(bigcell, list, infolist, fill) { 246 bigcell.innerHTML = "<table id=\""+list[0]+"\"></table>" 247 bigcell.vAlign = "top" 248 var t = document.getElementById(list[0]) 249 t.onclick = columnclick 250 251 for(var i=1; i<list.length; i++){ 252 var r = t.insertRow(t.rows.length) 253 name = list[i] 254 infolist[i] = Ginfo(t.offsetHeight, fill, name) 255 if(name == "END") 256 break 257 if(name.substring(0,1) == "!"){ 258 name = name.substring(1) 259 if(i > 1){ 260 r.innerHTML = "<td height=10></td>" 261 r = t.insertRow(t.rows.length) 262 } 263 r.innerHTML = "<td align=center><b>"+name+"</b>" 264 }else{ 265 graphrow(r, 1, name, 600, 300, 30, fill++, "") 266 } 267 } 268} 269 270function xpos(obj) { 271 var x = 0 272 if(obj.fixedx) 273 return obj.fixedx 274 if(obj.offsetParent){ 275 while(obj.offsetParent){ 276 x += obj.offsetLeft 277 obj = obj.offsetParent 278 } 279 }else if(obj.x) 280 x = obj.x 281 return x 282} 283 284function ypos(obj) { 285 var y = 0 286 if(obj.fixedy) 287 return obj.fixedy 288 if(obj.offsetParent){ 289 while(obj.offsetParent){ 290 y += obj.offsetTop 291 obj = obj.offsetParent 292 } 293 }else if(obj.y) 294 y = obj.y 295 return y 296} 297 298function scrollleft() { 299 return document.body.scrollLeft 300} 301 302function scrolltop() { 303 return document.body.scrollTop 304} 305 306function columnclick(e) { 307 if(e.which && e.which != 1) 308 return; 309 var g = findgraph(scrollleft()+e.clientX, scrolltop()+e.clientY) 310 if(g && g.name.substring(0,1) != "!"){ 311 biggraph = g.name 312 var t = document.getElementById("statgraphs") 313 graphrow(t.rows[0], 3, biggraph, 86400, 900, 30, 0, " – showing 24 hours") 314 graphrow(t.rows[1], 3, biggraph, 3600, 900, 30, 1, " – showing 1 hour") 315 } 316} 317 318function findgraph(x, y) { 319 var g 320 321 if(g = findgraphin(x, y, "column2", col2info)) 322 return g 323 if(g = findgraphin(x, y, "column1", col1info)) 324 return g 325 if(g = findgraphin(x, y, "column0", col0info)) 326 return g 327 return 328} 329 330function findgraphin(x, y, tname, info) { 331 var t = document.getElementById(tname) 332 if(x < xpos(t)) 333 return 334 y = y - ypos(t) 335 for(var i=info.length-2; i>=1; i--){ 336 if(y > info[i].y) 337 return info[i] 338 } 339 return 340} 341 342function setof(name, val, list) { 343 var s = "" 344 for(var i=0; i<list.length; i++){ 345 if(val == list[i]) 346 s = s+" <b>"+val+"</b>" 347 else 348 s = s+" <a href=\"javascript:set('"+name+"', '"+list[i]+"')\">"+list[i]+"</a>" 349 } 350 return s 351} 352 353function loglinks(list) { 354 var s = "" 355 for(var i=0; i<list.length; i++){ 356 s = s+" <a href=\"/log/"+list[i]+"\">"+list[i]+"</a>" 357 } 358 return s 359} 360 361first = 1 362function redrawsettings() { 363 if(first){ 364 loadsettings() 365 first = 0 366 } 367 var s = "" 368 s = s+"<font size=-1>\n" 369 s = s+"logging:"+setof("logging", logging, loggingchoices) 370 s = s+" " 371 s = s+"stats:"+setof("stats", stats, statschoices) 372 s = s+"\n<p/>\n" 373 s = s+"compression:"+setof("compress", compress, compresschoices1) 374 s = s+"<br>"+setof("compress", compress, compresschoices2) 375 s = s+"\n<p/>\n" 376 s = s+"<a href=/index>index</a> | <a href=/storage>storage</a> | " 377 s = s+"log:"+loglinks(logs) 378 s = s+"</font>" 379 document.getElementById("settings").innerHTML = s 380} 381 382function set(name, value) { 383 eval(name+"= \""+value+"\"") 384 redrawsettings() 385 // Works in FireFox, not in Safari 386 parent.hidden.location.href = "/set/"+name+"/"+value 387} 388