firefox-devtools / firefox-devtools/profiler

Consider generalizing our sample data structure to an EventTable

Open
#2,165 1 comment 0 reactions 0 assignees View on GitHub
discussion
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

I'm capturing this in a discussion issue to make sure we don't lose it, but Markus and I were chatting on slack about how to deal with all of the different types of sample data we are getting.

* Allocations
* Point in time sample
* Diffing point in time
* Tracing data

```js
type EventTable = {
time: number[],
stack: Array,
weight?: Array,
weightType?: 'bytes' | 'duration' | 'diff',
length: number,
};

// Compute call tree would take the structural type of an EventTable instead
// of a specific implementation
function computeCallTreeTiming(events: EventTable, ...) {
...
}

// Then threads would have one or more event tables.
type Thread = {|
events: {
timeSamples: CpuTimeSamplesTable
jsAllocations: JSAllocationSamplesTable,
...
},
...,
|};

// Each EventTable would then have its own specific implementation.
type JSAllocationSamplesTable = {|
// EventTable implementation:
time: Milliseconds[],
stack: Array,
weight: number[],
weightType: 'bytes',

// The rest of the data
className: string[],
typeName: string[],
coarseType: string[],
inNursery: boolean[],
length: number,
|};
```

The call tree could then apply the weight if it is there, and style the `` and tooltips according to the weight type.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-186)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.