Skip to content

Commit 6bc7d69

Browse files
committed
Align heap sample type names with allocation profiles (#351)
1 parent cc48a98 commit 6bc7d69

2 files changed

Lines changed: 16 additions & 38 deletions

File tree

ts/src/profile-serializer.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -259,28 +259,6 @@ function createCpuValueType(table: StringTable): ValueType {
259259
});
260260
}
261261

262-
/**
263-
* @return value type for object counts (type:objects, units:count), and
264-
* adds strings used in this value type to the table.
265-
*/
266-
function createObjectCountValueType(table: StringTable): ValueType {
267-
return new ValueType({
268-
type: table.dedup('objects'),
269-
unit: table.dedup('count'),
270-
});
271-
}
272-
273-
/**
274-
* @return value type for memory allocations (type:space, units:bytes), and
275-
* adds strings used in this value type to the table.
276-
*/
277-
function createAllocationValueType(table: StringTable): ValueType {
278-
return new ValueType({
279-
type: table.dedup('space'),
280-
unit: table.dedup('bytes'),
281-
});
282-
}
283-
284262
function createInUseObjectCountValueType(table: StringTable): ValueType {
285263
return new ValueType({
286264
type: table.dedup('inuse_objects'),
@@ -646,8 +624,8 @@ export function serializeHeapProfile(
646624
createAllocatedSpaceValueType(stringTable),
647625
]
648626
: [
649-
createObjectCountValueType(stringTable),
650-
createAllocationValueType(stringTable),
627+
createInUseObjectCountValueType(stringTable),
628+
createInUseSpaceValueType(stringTable),
651629
];
652630

653631
const profile = {

ts/test/profiles-for-tests.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ export const heapProfile = new Profile({
331331
location: heapLocations,
332332
function: heapFunctions,
333333
stringTable: buildStringTable([
334-
'objects',
334+
'inuse_objects',
335335
'count',
336-
'space',
336+
'inuse_space',
337337
'bytes',
338338
'main',
339339
'function1',
@@ -442,9 +442,9 @@ export const heapProfileWithExternal = new Profile({
442442
location: heapLocationsWithExternal,
443443
function: heapFunctionsWithExternal,
444444
stringTable: buildStringTable([
445-
'objects',
445+
'inuse_objects',
446446
'count',
447-
'space',
447+
'inuse_space',
448448
'bytes',
449449
'(external)',
450450
'main',
@@ -517,9 +517,9 @@ export const anonymousFunctionHeapProfile = new Profile({
517517
location: anonymousFunctionHeapLocations,
518518
function: anonymousFunctionHeapFunctions,
519519
stringTable: buildStringTable([
520-
'objects',
520+
'inuse_objects',
521521
'count',
522-
'space',
522+
'inuse_space',
523523
'bytes',
524524
'(anonymous:L#1:C#5)',
525525
'main',
@@ -741,9 +741,9 @@ export const heapProfileIncludePath = new Profile({
741741
location: heapIncludePathLocations,
742742
function: heapIncludePathFunctions,
743743
stringTable: buildStringTable([
744-
'objects',
744+
'inuse_objects',
745745
'count',
746-
'space',
746+
'inuse_space',
747747
'bytes',
748748
'baz',
749749
'foo.ts',
@@ -805,9 +805,9 @@ export const heapProfileIncludePathWithLabels = new Profile({
805805
location: heapIncludePathLocations,
806806
function: heapIncludePathFunctions,
807807
stringTable: buildStringTable([
808-
'objects',
808+
'inuse_objects',
809809
'count',
810-
'space',
810+
'inuse_space',
811811
'bytes',
812812
'baz',
813813
'foo.ts',
@@ -871,9 +871,9 @@ export const heapProfileExcludePath = new Profile({
871871
location: heapExcludePathLocations,
872872
function: heapExcludePathFunctions,
873873
stringTable: buildStringTable([
874-
'objects',
874+
'inuse_objects',
875875
'count',
876-
'space',
876+
'inuse_space',
877877
'bytes',
878878
'baz',
879879
'foo.ts',
@@ -1043,9 +1043,9 @@ export const heapSourceProfile = new Profile({
10431043
location: heapSourceLocations,
10441044
function: heapSourceFunctions,
10451045
stringTable: buildStringTable([
1046-
'objects',
1046+
'inuse_objects',
10471047
'count',
1048-
'space',
1048+
'inuse_space',
10491049
'bytes',
10501050
'foo1',
10511051
path.join(mapDirPath, 'foo.ts'),

0 commit comments

Comments
 (0)