| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dc38a45 commit 399b340
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -197,6 +197,7 @@ Returns an object with the following properties: | |||
| 197 | 197 | * `total_global_handles_size` {number} | |
| 198 | 198 | * `used_global_handles_size` {number} | |
| 199 | 199 | * `external_memory` {number} | |
| 200 | + * `total_allocated_bytes` {number} | ||
| 200 | 201 | ||
| 201 | 202 | `total_heap_size` The value of total\_heap\_size is the number of bytes V8 has | |
| 202 | 203 | allocated for the heap. This can grow if used\_heap needs more memory. | |
@@ -250,6 +251,9 @@ used memory size of V8 global handles. | |||
| 250 | 251 | `external_memory` The value of external\_memory is the memory size of array | |
| 251 | 252 | buffers and external strings. | |
| 252 | 253 | ||
| 254 | + `total_allocated_bytes` The value of total allocated bytes since the Isolate | ||
| 255 | + creation | ||
| 256 | + | ||
| 253 | 257 | <!-- eslint-skip --> | |
| 254 | 258 | ||
| 255 | 259 | ```js | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -136,6 +136,7 @@ const { | |||
| 136 | 136 | kTotalGlobalHandlesSizeIndex, | |
| 137 | 137 | kUsedGlobalHandlesSizeIndex, | |
| 138 | 138 | kExternalMemoryIndex, | |
| 139 | + kTotalAllocatedBytes, | ||
| 139 | 140 | ||
| 140 | 141 | // Properties for heap spaces statistics buffer extraction. | |
| 141 | 142 | kHeapSpaces, | |
@@ -246,6 +247,7 @@ function getHeapStatistics() { | |||
| 246 | 247 | total_global_handles_size: buffer[kTotalGlobalHandlesSizeIndex], | |
| 247 | 248 | used_global_handles_size: buffer[kUsedGlobalHandlesSizeIndex], | |
| 248 | 249 | external_memory: buffer[kExternalMemoryIndex], | |
| 250 | + total_allocated_bytes: buffer[kTotalAllocatedBytes], | ||
| 249 | 251 | }; | |
| 250 | 252 | } | |
| 251 | 253 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,7 +73,8 @@ using v8::Value; | |||
| 73 | 73 | V(10, number_of_detached_contexts, kNumberOfDetachedContextsIndex) \ | |
| 74 | 74 | V(11, total_global_handles_size, kTotalGlobalHandlesSizeIndex) \ | |
| 75 | 75 | V(12, used_global_handles_size, kUsedGlobalHandlesSizeIndex) \ | |
| 76 | - V(13, external_memory, kExternalMemoryIndex) | ||
| 76 | + V(13, external_memory, kExternalMemoryIndex) \ | ||
| 77 | + V(14, total_allocated_bytes, kTotalAllocatedBytes) | ||
| 77 | 78 | ||
| 78 | 79 | #define V(a, b, c) +1 | |
| 79 | 80 | static constexpr size_t kHeapStatisticsPropertiesCount = | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1263,6 +1263,7 @@ void Worker::GetHeapStatistics(const FunctionCallbackInfo<Value>& args) { | |||
| 1263 | 1263 | "total_global_handles_size", | |
| 1264 | 1264 | "used_global_handles_size", | |
| 1265 | 1265 | "external_memory", | |
| 1266 | + "total_allocated_bytes", | ||
| 1266 | 1267 | }; | |
| 1267 | 1268 | tmpl = DictionaryTemplate::New(isolate, heap_stats_names); | |
| 1268 | 1269 | env->set_heap_statistics_template(tmpl); | |
@@ -1283,7 +1284,8 @@ void Worker::GetHeapStatistics(const FunctionCallbackInfo<Value>& args) { | |||
| 1283 | 1284 | Number::New(isolate, heap_stats->number_of_detached_contexts()), | |
| 1284 | 1285 | Number::New(isolate, heap_stats->total_global_handles_size()), | |
| 1285 | 1286 | Number::New(isolate, heap_stats->used_global_handles_size()), | |
| 1286 | - Number::New(isolate, heap_stats->external_memory())}; | ||
| 1287 | + Number::New(isolate, heap_stats->external_memory()), | ||
| 1288 | + Number::New(isolate, heap_stats->total_allocated_bytes())}; | ||
| 1287 | 1289 | ||
| 1288 | 1290 | Local<Object> obj; | |
| 1289 | 1291 | if (!NewDictionaryInstanceNullProto( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ const keys = [ | |||
| 12 | 12 | 'number_of_detached_contexts', | |
| 13 | 13 | 'number_of_native_contexts', | |
| 14 | 14 | 'peak_malloced_memory', | |
| 15 | + 'total_allocated_bytes', | ||
| 15 | 16 | 'total_available_size', | |
| 16 | 17 | 'total_global_handles_size', | |
| 17 | 18 | 'total_heap_size', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,7 @@ if (isMainThread) { | |||
| 40 | 40 | `total_global_handles_size`, | |
| 41 | 41 | `used_global_handles_size`, | |
| 42 | 42 | `external_memory`, | |
| 43 | + `total_allocated_bytes`, | ||
| 43 | 44 | ].sort(); | |
| 44 | 45 | assert.deepStrictEqual(keys, Object.keys(stats).sort()); | |
| 45 | 46 | for (const key of keys) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments