istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/ctrlz/topics/assets/templates/mem.html (about) 1 {{ define "content" }} 2 3 <p> 4 This information is gathered from the Go runtime and represents the ongoing memory consumption 5 of this process. Please refer to the <a href="https://golang.org/pkg/runtime/#MemStats">Go documentation on the MemStats type</a> 6 for more information about all of these values. 7 </p> 8 9 <table> 10 <thead> 11 <tr> 12 <th>Counter</th> 13 <th>Value</th> 14 <th>Description</th> 15 </tr> 16 </thead> 17 <tbody> 18 <tr> 19 <td>HeapInuse</td> 20 <td id="HeapInuse">{{.HeapInuse}} bytes</td> 21 <td>Bytes in in-use spans.</td> 22 </tr> 23 24 <tr> 25 <td>Total Alloc</td> 26 <td id="TotalAlloc">{{.TotalAlloc}} bytes</td> 27 <td>Cumulative bytes allocated for heap objects.</td> 28 </tr> 29 30 <tr> 31 <td>Sys</td> 32 <td id="Sys">{{.Sys}} bytes</td> 33 <td>Total bytes of memory obtained from the OS.</td> 34 </tr> 35 36 <tr> 37 <td>Lookups</td> 38 <td id="Lookups">{{.Lookups}} lookups</td> 39 <td>Number of pointer lookups performed by the runtime.</td> 40 </tr> 41 42 <tr> 43 <td>Mallocs</td> 44 <td id="Mallocs">{{.Mallocs}} objects</td> 45 <td>Cumulative count of heap objects allocated.</td> 46 </tr> 47 48 <tr> 49 <td>Frees</td> 50 <td id="Frees">{{.Frees}} objects</td> 51 <td>Cumulative count of heap objects freed.</td> 52 </tr> 53 54 <tr> 55 <td>Live</td> 56 <td id="Live">0 objects</td> 57 <td>Count of live heap objects.</td> 58 </tr> 59 60 <tr> 61 <td>HeapAlloc</td> 62 <td id="HeapAlloc">{{.HeapAlloc}} bytes</td> 63 <td>Allocated heap objects.</td> 64 </tr> 65 66 <tr> 67 <td>HeapSys</td> 68 <td id="HeapSys">{{.HeapSys}} bytes</td> 69 <td>Heap memory obtained from the OS.</td> 70 </tr> 71 72 <tr> 73 <td>HeapIdle</td> 74 <td id="HeapIdle">{{.HeapIdle}} bytes</td> 75 <td>Bytes in idle (unused) spans.</td> 76 </tr> 77 78 <tr> 79 <td>HeapReleased</td> 80 <td id="HeapReleased">{{.HeapReleased}} bytes</td> 81 <td>Physical memory returned to the OS.</td> 82 </tr> 83 84 <tr> 85 <td>HeapObjects</td> 86 <td id="HeapObjects">{{.HeapObjects}} objects</td> 87 <td>Number of allocated heap objects.</td> 88 </tr> 89 90 <tr> 91 <td>StackInuse</td> 92 <td id="StackInuse">{{.StackInuse}} bytes</td> 93 <td>Bytes in stack spans.</td> 94 </tr> 95 96 <tr> 97 <td>StackSys</td> 98 <td id="StackSys">{{.StackSys}} bytes</td> 99 <td>Stack memory obtained from the OS.</td> 100 </tr> 101 102 <tr> 103 <td>NextGC</td> 104 <td id="NextGC">{{.NextGC}} bytes</td> 105 <td>Target heap size of the next GC cycle.</td> 106 </tr> 107 108 <tr> 109 <td>LastGC</td> 110 <td id="LastGC"></td> 111 <td>The time the last garbage collection finished.</td> 112 </tr> 113 114 <script> 115 // we do this so there's a useful date in the table, which avoids things shifting around during initial paint 116 let d = new Date().toLocaleString(); 117 document.getElementById("LastGC").innerText = d; 118 </script> 119 120 <tr> 121 <td>PauseTotalNs</td> 122 <td id="PauseTotalNs">{{.PauseTotalNs}} ns</td> 123 <td>Cumulative time spent in GC stop-the-world pauses.</td> 124 </tr> 125 126 <tr> 127 <td>NumGC</td> 128 <td id="NumGC">{{.NumGC}} GC cycles</td> 129 <td>Completed GC cycles.</td> 130 </tr> 131 132 <tr> 133 <td>NumForcedGC</td> 134 <td id="NumForcedGC">{{.NumForcedGC}} GC cycles</td> 135 <td>GC cycles that were forced by the application calling the GC function.</td> 136 </tr> 137 138 <tr> 139 <td>GCCPUFraction</td> 140 <td id="GCCPUFraction"></td> 141 <td>Fraction of this program's available CPU time used by the GC since the program started.</td> 142 </tr> 143 </tbody> 144 </table> 145 146 <br> 147 <button class="btn btn-istio" onclick="forceCollection()">Force Garbage Collection</button> 148 149 {{ template "last-refresh" .}} 150 151 <script> 152 "use strict"; 153 154 function refreshMemStats() { 155 let url = window.location.protocol + "//" + window.location.host + "/memj/"; 156 157 let ajax = new XMLHttpRequest(); 158 ajax.onload = onload; 159 ajax.onerror = onerror; 160 ajax.open("GET", url, true); 161 ajax.send(); 162 163 function onload() { 164 if (this.status === 200) { // request succeeded 165 let ms = JSON.parse(this.responseText); 166 document.getElementById("HeapInuse").innerText = ms.HeapInuse.toLocaleString() + " bytes"; 167 document.getElementById("TotalAlloc").innerText = ms.TotalAlloc.toLocaleString() + " bytes"; 168 document.getElementById("Sys").innerText = ms.Sys.toLocaleString() + " bytes"; 169 document.getElementById("Lookups").innerText = ms.Lookups.toLocaleString() + " lookups"; 170 document.getElementById("Mallocs").innerText = ms.Mallocs.toLocaleString() + " objects"; 171 document.getElementById("Frees").innerText = ms.Frees.toLocaleString() + " objects"; 172 document.getElementById("Live").innerText = (ms.Mallocs - ms.Frees).toLocaleString() + " objects"; 173 document.getElementById("HeapAlloc").innerText = ms.HeapAlloc.toLocaleString() + " bytes"; 174 document.getElementById("HeapSys").innerText = ms.HeapSys.toLocaleString() + " bytes"; 175 document.getElementById("HeapIdle").innerText = ms.HeapIdle.toLocaleString() + " bytes"; 176 document.getElementById("HeapReleased").innerText = ms.HeapReleased.toLocaleString() + " bytes"; 177 document.getElementById("HeapObjects").innerText = ms.HeapObjects.toLocaleString() + " objects"; 178 document.getElementById("StackInuse").innerText = ms.StackInuse.toLocaleString() + " bytes"; 179 document.getElementById("StackSys").innerText = ms.StackSys.toLocaleString() + " bytes"; 180 document.getElementById("NextGC").innerText = ms.NextGC.toLocaleString() + " bytes"; 181 document.getElementById("PauseTotalNs").innerText = ms.PauseTotalNs.toLocaleString() + " ns"; 182 document.getElementById("NumGC").innerText = ms.NumGC.toLocaleString() + " GC cycles"; 183 document.getElementById("NumForcedGC").innerText = ms.NumForcedGC.toLocaleString() + " GC cycles"; 184 185 let d = new Date(ms.LastGC / 1000000).toLocaleString(); 186 document.getElementById("LastGC").innerText = d; 187 188 let frac = ms.GCCPUFraction; 189 if (frac < 0) { 190 frac = 0.0; 191 } 192 let percent = (frac * 100).toFixed(2); 193 document.getElementById("GCCPUFraction").innerText = percent + "%"; 194 195 updateRefreshTime(); 196 } 197 } 198 199 function onerror(e) { 200 console.error(e); 201 } 202 } 203 204 function forceCollection() { 205 let url = window.location.protocol + "//" + window.location.host + "/memj/forcecollection"; 206 207 let ajax = new XMLHttpRequest(); 208 ajax.onload = onload; 209 ajax.onerror = onerror; 210 ajax.open("PUT", url, true); 211 ajax.send(); 212 213 function onload() { 214 } 215 216 function onerror(e) { 217 console.error(e); 218 } 219 } 220 221 refreshMemStats(); 222 window.setInterval(refreshMemStats, 1000); 223 224 </script> 225 226 {{ end }}