forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render Pixi flamegraph using Elasticsearch as data source (#44)
* Add comments * Add stricter typing * Collate stack frame metadata * Split grouping frames and creating a hash defaultGroupBy previously did both and now we have separate methods. * Decode file ID from base64 URL * Rename creation methods We use creation methods to construct instances of certain types. Sometimes these instances allow for no arguments, thus, the created instance is an instance with sensible defaults. To make the intent clearer for readers and also to adhere to the conventions used throughout the Kibana codebase, I renamed the creation methods to use 'create*' instead of 'build*'.
- Loading branch information
Showing
6 changed files
with
279 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { | ||
createCallerCalleeIntermediateNode, | ||
fromCallerCalleeIntermediateNode, | ||
} from './callercallee'; | ||
import { createStackFrameMetadata, hashFrameGroup } from './profiling'; | ||
|
||
describe('Caller-callee operations', () => { | ||
test('1', () => { | ||
const parentFrame = createStackFrameMetadata({ | ||
FileID: '6bc50d345244d5956f93a1b88f41874d', | ||
FrameType: 3, | ||
AddressOrLine: 971740, | ||
FunctionName: 'epoll_wait', | ||
SourceID: 'd670b496cafcaea431a23710fb5e4f58', | ||
SourceLine: 30, | ||
ExeFileName: 'libc-2.26.so', | ||
Index: 1, | ||
}); | ||
const parent = createCallerCalleeIntermediateNode(parentFrame, 10); | ||
|
||
const childFrame = createStackFrameMetadata({ | ||
FileID: '8d8696a4fd51fa88da70d3fde138247d', | ||
FrameType: 3, | ||
AddressOrLine: 67000, | ||
FunctionName: 'epoll_poll', | ||
SourceID: 'f0a7901dcefed6cc8992a324b9df733c', | ||
SourceLine: 150, | ||
ExeFileName: 'auditd', | ||
Index: 0, | ||
}); | ||
const child = createCallerCalleeIntermediateNode(childFrame, 10); | ||
|
||
const root = createCallerCalleeIntermediateNode(createStackFrameMetadata(), 10); | ||
root.callees.set(hashFrameGroup(child.frameGroup), child); | ||
root.callees.set(hashFrameGroup(parent.frameGroup), parent); | ||
|
||
const graph = fromCallerCalleeIntermediateNode(root); | ||
|
||
// Modify original frames to verify graph does not contain references | ||
parent.samples = 30; | ||
child.samples = 20; | ||
|
||
expect(graph.Callees[0].Samples).toEqual(10); | ||
expect(graph.Callees[1].Samples).toEqual(10); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.