GeezerVison is showing github.com — trace_events: add new categories · nodejs/node@210cbcb
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/inspector/tracing_agent.cc +8-5Lines changed: 8 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -174,24 +174,27 @@ DispatchResponse TracingAgent::getCategories( | 174 | 174 | std::unique_ptr<protocol::Array<String>>* categories) { | 175 | 175 | *categories = Array<String>::create(); | 176 | 176 | protocol::Array<String>* categories_list = categories->get(); | | 177 | + // In alphabetical order | 177 | 178 | categories_list->addItem("node"); | 178 | 179 | categories_list->addItem("node.async_hooks"); | 179 | 180 | categories_list->addItem("node.bootstrap"); | 180 | 181 | categories_list->addItem("node.console"); | 181 | 182 | categories_list->addItem("node.dns.native"); | 182 | | - categories_list->addItem("node.net.native"); | 183 | 183 | categories_list->addItem("node.environment"); | 184 | | - categories_list->addItem("node.fs.sync"); | 185 | | - categories_list->addItem("node.fs_dir.sync"); | 186 | 184 | categories_list->addItem("node.fs.async"); | | 185 | + categories_list->addItem("node.fs.sync"); | 187 | 186 | categories_list->addItem("node.fs_dir.async"); | | 187 | + categories_list->addItem("node.fs_dir.sync"); | | 188 | + categories_list->addItem("node.http"); | | 189 | + categories_list->addItem("node.net.native"); | 188 | 190 | categories_list->addItem("node.perf"); | 189 | | - categories_list->addItem("node.perf.usertiming"); | 190 | 191 | categories_list->addItem("node.perf.timerify"); | | 192 | + categories_list->addItem("node.perf.usertiming"); | 191 | 193 | categories_list->addItem("node.promises.rejections"); | | 194 | + categories_list->addItem("node.threadpoolwork.async"); | | 195 | + categories_list->addItem("node.threadpoolwork.sync"); | 192 | 196 | categories_list->addItem("node.vm.script"); | 193 | 197 | categories_list->addItem("v8"); | 194 | | - categories_list->addItem("node.http"); | 195 | 198 | return DispatchResponse::OK(); | 196 | 199 | } | 197 | 200 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-inspector-tracing-domain.js +27-25Lines changed: 27 additions & 25 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -10,12 +10,6 @@ const { Session } = require('inspector'); | 10 | 10 |
| 11 | 11 | const session = new Session(); | 12 | 12 |
| 13 | | -function compareIgnoringOrder(array1, array2) { | 14 | | - const set = new Set(array1); | 15 | | - const test = set.size === array2.length && array2.every((el) => set.has(el)); | 16 | | - assert.ok(test, `[${array1}] differs from [${array2}]`); | 17 | | -} | 18 | | - | 19 | 13 | function post(message, data) { | 20 | 14 | return new Promise((resolve, reject) => { | 21 | 15 | session.post(message, data, (err, result) => { | @@ -48,25 +42,33 @@ async function test() { | 48 | 42 | session.on('NodeTracing.dataCollected', (n) => traceNotification = n); | 49 | 43 | session.on('NodeTracing.tracingComplete', () => tracingComplete = true); | 50 | 44 | const { categories } = await post('NodeTracing.getCategories'); | 51 | | - compareIgnoringOrder(['node', | 52 | | - 'node.async_hooks', | 53 | | - 'node.bootstrap', | 54 | | - 'node.console', | 55 | | - 'node.dns.native', | 56 | | - 'node.net.native', | 57 | | - 'node.environment', | 58 | | - 'node.fs.sync', | 59 | | - 'node.fs_dir.sync', | 60 | | - 'node.fs.async', | 61 | | - 'node.fs_dir.async', | 62 | | - 'node.perf', | 63 | | - 'node.perf.usertiming', | 64 | | - 'node.perf.timerify', | 65 | | - 'node.promises.rejections', | 66 | | - 'node.vm.script', | 67 | | - 'v8', | 68 | | - 'node.http', | 69 | | - ], categories); | | 45 | + const expectedCategories = [ | | 46 | + 'node', | | 47 | + 'node.async_hooks', | | 48 | + 'node.bootstrap', | | 49 | + 'node.console', | | 50 | + 'node.dns.native', | | 51 | + 'node.environment', | | 52 | + 'node.fs.async', | | 53 | + 'node.fs.sync', | | 54 | + 'node.fs_dir.async', | | 55 | + 'node.fs_dir.sync', | | 56 | + 'node.http', | | 57 | + 'node.net.native', | | 58 | + 'node.perf', | | 59 | + 'node.perf.timerify', | | 60 | + 'node.perf.usertiming', | | 61 | + 'node.promises.rejections', | | 62 | + 'node.threadpoolwork.async', | | 63 | + 'node.threadpoolwork.sync', | | 64 | + 'node.vm.script', | | 65 | + 'v8', | | 66 | + ].sort(); | | 67 | + assert.ok(categories.length === expectedCategories.length); | | 68 | + categories.forEach((category, index) => { | | 69 | + const value = expectedCategories[index]; | | 70 | + assert.ok(category === value, `${category} is out of order, expect ${value}`); | | 71 | + }); | 70 | 72 |
| 71 | 73 | const traceConfig = { includedCategories: ['v8'] }; | 72 | 74 | await post('NodeTracing.start', { traceConfig }); | |
|