vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 1 | $(function() { |
vinayakb | 29e62b5 | 2012-01-31 20:04:11 +0000 | [diff] [blame] | 2 | $('#tabs').tabs(); |
| 3 | |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 4 | var options = { |
| 5 | lines : { |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 6 | show : true, |
| 7 | fill : true |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 8 | }, |
| 9 | points : { |
| 10 | show : false |
| 11 | }, |
| 12 | xaxis : { |
| 13 | tickDecimals : 0, |
| 14 | tickSize : 0 |
| 15 | } |
| 16 | }; |
| 17 | |
vinayakb | 6d92ffd | 2012-02-06 01:19:36 +0000 | [diff] [blame] | 18 | function computeRate(array, rrdPtr) { |
| 19 | return (array[(rrdPtr + 1) % array.length] - array[rrdPtr]) / 10; |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 20 | } |
| 21 | |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 22 | function onDataReceived(data) { |
| 23 | var result = data.result; |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 24 | $('#node-id')[0].innerHTML = result['node-id']; |
| 25 | $('#arch')[0].innerHTML = result['arch']; |
| 26 | $('#os-name')[0].innerHTML = result['os-name']; |
| 27 | $('#os-version')[0].innerHTML = result['os-version']; |
| 28 | $('#num-processors')[0].innerHTML = result['num-processors']; |
vinayakb | 4492225 | 2012-02-01 07:07:31 +0000 | [diff] [blame] | 29 | $('#vm-name')[0].innerHTML = result['vm-name']; |
| 30 | $('#vm-version')[0].innerHTML = result['vm-version']; |
| 31 | $('#vm-vendor')[0].innerHTML = result['vm-vendor']; |
| 32 | $('#classpath')[0].innerHTML = result['classpath']; |
| 33 | $('#library-path')[0].innerHTML = result['library-path']; |
| 34 | $('#boot-classpath')[0].innerHTML = result['boot-classpath']; |
| 35 | var argsHTML = ""; |
| 36 | var args = result['input-arguments']; |
| 37 | for ( var i = 0; i < args.length; ++i) { |
| 38 | if (argsHTML != "") { |
| 39 | argsHTML += "<br/>"; |
| 40 | } |
| 41 | argsHTML += "<span>" + args[i] + "</span>"; |
| 42 | } |
| 43 | $('#input-arguments')[0].innerHTML = argsHTML; |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 44 | var sysLoad = result['system-load-averages']; |
| 45 | var heapUsageInitSizes = result['heap-init-sizes']; |
| 46 | var heapUsageUsedSizes = result['heap-used-sizes']; |
| 47 | var heapUsageCommittedSizes = result['heap-committed-sizes']; |
| 48 | var heapUsageMaxSizes = result['heap-max-sizes']; |
| 49 | var nonheapUsageInitSizes = result['nonheap-init-sizes']; |
| 50 | var nonheapUsageUsedSizes = result['nonheap-used-sizes']; |
| 51 | var nonheapUsageCommittedSizes = result['nonheap-committed-sizes']; |
| 52 | var nonheapUsageMaxSizes = result['nonheap-max-sizes']; |
| 53 | var threadCounts = result['thread-counts']; |
| 54 | var peakThreadCounts = result['peak-thread-counts']; |
| 55 | var gcCollectionCounts = result['gc-collection-counts']; |
| 56 | var gcCollectionTimes = result['gc-collection-times']; |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 57 | var netPayloadBytesRead = result['net-payload-bytes-read']; |
| 58 | var netPayloadBytesWritten = result['net-payload-bytes-written']; |
| 59 | var netSignalingBytesRead = result['net-signaling-bytes-read']; |
| 60 | var netSignalingBytesWritten = result['net-signaling-bytes-written']; |
vinayakb | 6d92ffd | 2012-02-06 01:19:36 +0000 | [diff] [blame] | 61 | var ipcMessagesSent = result['ipc-messages-sent']; |
| 62 | var ipcMessageBytesSent = result['ipc-message-bytes-sent']; |
| 63 | var ipcMessagesReceived = result['ipc-messages-received']; |
| 64 | var ipcMessageBytesReceived = result['ipc-message-bytes-received']; |
| 65 | |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 66 | var sysLoadArray = []; |
| 67 | var heapUsageInitSizesArray = []; |
| 68 | var heapUsageUsedSizesArray = []; |
| 69 | var heapUsageCommittedSizesArray = []; |
| 70 | var heapUsageMaxSizesArray = []; |
| 71 | var nonheapUsageInitSizesArray = []; |
| 72 | var nonheapUsageUsedSizesArray = []; |
| 73 | var nonheapUsageCommittedSizesArray = []; |
| 74 | var nonheapUsageMaxSizesArray = []; |
| 75 | var threadCountsArray = []; |
| 76 | var peakThreadCountsArray = []; |
| 77 | var gcCollectionCountsArray = []; |
| 78 | var gcCollectionTimesArray = []; |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 79 | var netPayloadReadBWArray = []; |
| 80 | var netPayloadWriteBWArray = []; |
| 81 | var netSignalingReadBWArray = []; |
| 82 | var netSignalingWriteBWArray = []; |
vinayakb | 6d92ffd | 2012-02-06 01:19:36 +0000 | [diff] [blame] | 83 | var ipcMessageSendRateArray = []; |
| 84 | var ipcMessageBytesSendRateArray = []; |
| 85 | var ipcMessageReceiveRateArray = []; |
| 86 | var ipcMessageBytesReceiveRateArray = []; |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 87 | var gcChartsDiv = document.getElementById('gc-charts'); |
| 88 | for ( var i = 0; i < gcCollectionCounts.length; ++i) { |
| 89 | gcCollectionCountsArray.push([]); |
| 90 | gcCollectionTimesArray.push([]); |
| 91 | var gcCollectionCountDiv = document.createElement('div'); |
| 92 | gcCollectionCountDiv.id = 'gc-collection-count-' + i; |
| 93 | gcCollectionCountDiv.style = "jqplot-target time-chart"; |
| 94 | gcChartsDiv.appendChild(gcCollectionCountDiv); |
| 95 | var gcCollectionTimeDiv = document.createElement('div'); |
| 96 | gcCollectionTimeDiv.id = 'gc-collection-time-' + i; |
| 97 | gcChartsDiv.appendChild(gcCollectionTimeDiv); |
| 98 | } |
| 99 | var rrdPtr = result['rrd-ptr']; |
| 100 | for ( var i = 0; i < sysLoad.length; ++i) { |
| 101 | sysLoadArray.push([ i, sysLoad[rrdPtr] ]); |
| 102 | heapUsageInitSizesArray.push([ i, heapUsageInitSizes[rrdPtr] / (1024 * 1024) ]); |
| 103 | heapUsageUsedSizesArray.push([ i, heapUsageUsedSizes[rrdPtr] / (1024 * 1024) ]); |
| 104 | heapUsageCommittedSizesArray.push([ i, heapUsageCommittedSizes[rrdPtr] / (1024 * 1024) ]); |
| 105 | heapUsageMaxSizesArray.push([ i, heapUsageMaxSizes[rrdPtr] / (1024 * 1024) ]); |
| 106 | nonheapUsageInitSizesArray.push([ i, nonheapUsageInitSizes[rrdPtr] / (1024 * 1024) ]); |
| 107 | nonheapUsageUsedSizesArray.push([ i, nonheapUsageUsedSizes[rrdPtr] / (1024 * 1024) ]); |
| 108 | nonheapUsageCommittedSizesArray.push([ i, nonheapUsageCommittedSizes[rrdPtr] / (1024 * 1024) ]); |
| 109 | nonheapUsageMaxSizesArray.push([ i, nonheapUsageMaxSizes[rrdPtr] / (1024 * 1024) ]); |
| 110 | threadCountsArray.push([ i, threadCounts[rrdPtr] ]); |
| 111 | peakThreadCountsArray.push([ i, peakThreadCounts[rrdPtr] ]); |
| 112 | for ( var j = 0; j < gcCollectionCounts.length; ++j) { |
| 113 | gcCollectionCountsArray[j].push([ i, gcCollectionCounts[j][rrdPtr] ]); |
| 114 | } |
| 115 | for ( var j = 0; j < gcCollectionTimes.length; ++j) { |
| 116 | gcCollectionTimesArray[j].push([ i, gcCollectionTimes[j][rrdPtr] ]); |
| 117 | } |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 118 | if (i < sysLoad.length - 1) { |
vinayakb | 6d92ffd | 2012-02-06 01:19:36 +0000 | [diff] [blame] | 119 | netPayloadReadBWArray.push([ i, computeRate(netPayloadBytesRead, rrdPtr) ]); |
| 120 | netPayloadWriteBWArray.push([ i, computeRate(netPayloadBytesWritten, rrdPtr) ]); |
| 121 | netSignalingReadBWArray.push([ i, computeRate(netSignalingBytesRead, rrdPtr) ]); |
| 122 | netSignalingWriteBWArray.push([ i, computeRate(netSignalingBytesWritten, rrdPtr) ]); |
| 123 | ipcMessageSendRateArray.push([ i, computeRate(ipcMessagesSent, rrdPtr) ]); |
| 124 | ipcMessageBytesSendRateArray.push([ i, computeRate(ipcMessageBytesSent, rrdPtr) ]); |
| 125 | ipcMessageReceiveRateArray.push([ i, computeRate(ipcMessagesReceived, rrdPtr) ]); |
| 126 | ipcMessageBytesReceiveRateArray.push([ i, computeRate(ipcMessageBytesReceived, rrdPtr) ]); |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 127 | } |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 128 | rrdPtr = (rrdPtr + 1) % sysLoad.length; |
| 129 | } |
| 130 | |
| 131 | $.plot($('#system-load-chart'), [ { |
| 132 | label : 'System Load', |
| 133 | data : sysLoadArray |
| 134 | } ], options); |
| 135 | |
| 136 | var gcNames = result['gc-names']; |
| 137 | for ( var i = 0; i < gcCollectionCounts.length; ++i) { |
| 138 | $('#gc-collection-count-' + i).addClass("time-chart"); |
| 139 | $.plot($('#gc-collection-count-' + i), [ { |
| 140 | label : gcNames[i] + ' Collection Count', |
| 141 | data : gcCollectionCountsArray[i] |
| 142 | } ], options); |
| 143 | |
| 144 | $('#gc-collection-time-' + i).addClass("time-chart"); |
| 145 | $.plot($('#gc-collection-time-' + i), [ { |
| 146 | label : gcNames[i] + ' Collection Time (ms)', |
| 147 | data : gcCollectionTimesArray[i] |
| 148 | } ], options); |
| 149 | } |
| 150 | |
| 151 | $.plot($('#heap-usage-chart'), [ { |
| 152 | label : 'Heap Usage Initial Size (MB)', |
| 153 | data : heapUsageInitSizesArray |
| 154 | }, { |
| 155 | label : 'Heap Usage Used Size (MB)', |
| 156 | data : heapUsageUsedSizesArray |
| 157 | }, { |
| 158 | label : 'Heap Usage Committed Size (MB)', |
| 159 | data : heapUsageCommittedSizesArray |
| 160 | }, { |
| 161 | label : 'Heap Usage Max Size (MB)', |
| 162 | data : heapUsageMaxSizesArray |
| 163 | } ], options); |
| 164 | |
| 165 | $.plot($('#nonheap-usage-chart'), [ { |
| 166 | label : 'Non-Heap Usage Initial Size (MB)', |
| 167 | data : nonheapUsageInitSizesArray |
| 168 | }, { |
| 169 | label : 'Non-Heap Usage Used Size (MB)', |
| 170 | data : nonheapUsageUsedSizesArray |
| 171 | }, { |
| 172 | label : 'Non-Heap Usage Committed Size (MB)', |
| 173 | data : nonheapUsageCommittedSizesArray |
| 174 | }, { |
| 175 | label : 'Non-Heap Usage Max Size (MB)', |
| 176 | data : nonheapUsageMaxSizesArray |
| 177 | } ], options); |
| 178 | |
| 179 | $.plot($('#thread-chart'), [ { |
| 180 | label : 'Thread Count', |
| 181 | data : threadCountsArray |
| 182 | }, { |
| 183 | label : 'Peak Thread Count', |
| 184 | data : peakThreadCountsArray |
| 185 | } ], options); |
vinayakb | 31970ed | 2012-01-31 18:57:48 +0000 | [diff] [blame] | 186 | |
| 187 | $.plot($('#net-payload-bandwidth'), [ { |
| 188 | label : 'Payload Read Bandwidth (bytes/sec)', |
| 189 | data : netPayloadReadBWArray |
| 190 | }, { |
| 191 | label : 'Payload Write Bandwidth (bytes/sec)', |
| 192 | data : netPayloadWriteBWArray |
| 193 | } ], options); |
| 194 | |
| 195 | $.plot($('#net-signaling-bandwidth'), [ { |
| 196 | label : 'Signaling Read Bandwidth (bytes/sec)', |
| 197 | data : netSignalingReadBWArray |
| 198 | }, { |
| 199 | label : 'Signaling Write Bandwidth (bytes/sec)', |
| 200 | data : netSignalingWriteBWArray |
| 201 | } ], options); |
vinayakb | 6d92ffd | 2012-02-06 01:19:36 +0000 | [diff] [blame] | 202 | |
| 203 | $.plot($('#ipc-messages'), [ { |
| 204 | label : 'IPC Messages Send Rate (messages/sec)', |
| 205 | data : ipcMessageSendRateArray |
| 206 | }, { |
| 207 | label : 'IPC Messages Receive Rate (messages/sec)', |
| 208 | data : ipcMessageReceiveRateArray |
| 209 | } ], options); |
| 210 | |
| 211 | $.plot($('#ipc-message-bytes'), [ { |
| 212 | label : 'IPC Message Send Bandwidth (bytes/sec)', |
| 213 | data : ipcMessageBytesSendRateArray |
| 214 | }, { |
| 215 | label : 'IPC Message Receive Bandwidth (bytes/sec)', |
| 216 | data : ipcMessageBytesReceiveRateArray |
| 217 | } ], options); |
vinayakb | 4e8fe23 | 2012-01-31 11:32:32 +0000 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | function fetchData() { |
| 221 | $.ajax({ |
| 222 | url : '/rest/nodes/' + $.getURLParam('node-id'), |
| 223 | method : 'GET', |
| 224 | dataType : 'json', |
| 225 | success : onDataReceived |
| 226 | }); |
| 227 | |
| 228 | setTimeout(fetchData, 10000); |
| 229 | } |
| 230 | |
| 231 | fetchData(); |
| 232 | }); |