Skip to content

Commit f4f354f

Browse files
authored
Merge pull request #233 from mstange/fxprof-v48
Make fxprof-processed-profile output version 48
2 parents e894983 + 039b74c commit f4f354f

File tree

3 files changed

+47
-76
lines changed

3 files changed

+47
-76
lines changed

fxprof-processed-profile/src/counters.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,7 @@ impl<'a> Serialize for SerializableCounter<'a> {
7070
map.serialize_entry("description", &self.counter.description)?;
7171
map.serialize_entry("mainThreadIndex", &self.main_thread_index)?;
7272
map.serialize_entry("pid", &self.counter.pid)?;
73-
map.serialize_entry(
74-
"sampleGroups",
75-
&[SerializableCounterSampleGroup(self.counter)],
76-
)?;
77-
map.end()
78-
}
79-
}
80-
81-
struct SerializableCounterSampleGroup<'a>(&'a Counter);
82-
83-
impl<'a> Serialize for SerializableCounterSampleGroup<'a> {
84-
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
85-
let mut map = serializer.serialize_map(None)?;
86-
map.serialize_entry("id", &0)?; // It's not clear what the meaning of this ID is.
87-
map.serialize_entry("samples", &self.0.samples)?;
73+
map.serialize_entry("samples", &self.counter.samples)?;
8874
map.end()
8975
}
9076
}

fxprof-processed-profile/src/profile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl<'a> Serialize for SerializableProfileMeta<'a> {
705705
}),
706706
)?;
707707
map.serialize_entry("interval", &(self.0.interval.as_secs_f64() * 1000.0))?;
708-
map.serialize_entry("preprocessedProfileVersion", &46)?;
708+
map.serialize_entry("preprocessedProfileVersion", &48)?;
709709
map.serialize_entry("processType", &0)?;
710710
map.serialize_entry("product", &self.0.product)?;
711711
map.serialize_entry(

fxprof-processed-profile/tests/integration_tests/main.rs

Lines changed: 45 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ fn profile_without_js() {
342342
"name": []
343343
},
344344
"interval": 1.0,
345-
"preprocessedProfileVersion": 46,
345+
"preprocessedProfileVersion": 48,
346346
"processType": 0,
347347
"product": "test",
348348
"sampleUnits": {
@@ -974,29 +974,24 @@ fn profile_without_js() {
974974
"description": "Amount of allocated memory",
975975
"mainThreadIndex": 0,
976976
"pid": "123",
977-
"sampleGroups": [
978-
{
979-
"id": 0,
980-
"samples": {
981-
"length": 3,
982-
"count": [
983-
0.0,
984-
1000.0,
985-
800.0
986-
],
987-
"number": [
988-
0,
989-
2,
990-
1
991-
],
992-
"time": [
993-
0.0,
994-
1.0,
995-
2.0
996-
]
997-
}
998-
}
999-
]
977+
"samples": {
978+
"length": 3,
979+
"count": [
980+
0.0,
981+
1000.0,
982+
800.0
983+
],
984+
"number": [
985+
0,
986+
2,
987+
1
988+
],
989+
"time": [
990+
0.0,
991+
1.0,
992+
2.0
993+
]
994+
}
1000995
}
1001996
]
1002997
}
@@ -1071,7 +1066,7 @@ fn profile_with_js() {
10711066
"name": []
10721067
},
10731068
"interval": 1.0,
1074-
"preprocessedProfileVersion": 46,
1069+
"preprocessedProfileVersion": 48,
10751070
"processType": 0,
10761071
"product": "test with js",
10771072
"sampleUnits": {
@@ -1327,7 +1322,7 @@ fn profile_counters_with_sorted_processes() {
13271322
"name": []
13281323
},
13291324
"interval": 1.0,
1330-
"preprocessedProfileVersion": 46,
1325+
"preprocessedProfileVersion": 48,
13311326
"processType": 0,
13321327
"product": "test",
13331328
"sampleUnits": {
@@ -1522,47 +1517,37 @@ fn profile_counters_with_sorted_processes() {
15221517
"description": "Amount of allocated memory",
15231518
"mainThreadIndex": 1,
15241519
"pid": "123",
1525-
"sampleGroups": [
1526-
{
1527-
"id": 0,
1528-
"samples": {
1529-
"length": 1,
1530-
"count": [
1531-
0.0
1532-
],
1533-
"number": [
1534-
0
1535-
],
1536-
"time": [
1537-
1.0
1538-
]
1539-
}
1540-
}
1541-
]
1520+
"samples": {
1521+
"length": 1,
1522+
"count": [
1523+
0.0
1524+
],
1525+
"number": [
1526+
0
1527+
],
1528+
"time": [
1529+
1.0
1530+
]
1531+
}
15421532
},
15431533
{
15441534
"category": "Memory 2",
15451535
"name": "malloc",
15461536
"description": "Amount of allocated memory",
15471537
"mainThreadIndex": 1,
15481538
"pid": "123",
1549-
"sampleGroups": [
1550-
{
1551-
"id": 0,
1552-
"samples": {
1553-
"length": 1,
1554-
"count": [
1555-
0.0
1556-
],
1557-
"number": [
1558-
0
1559-
],
1560-
"time": [
1561-
0.0
1562-
]
1563-
}
1564-
}
1565-
]
1539+
"samples": {
1540+
"length": 1,
1541+
"count": [
1542+
0.0
1543+
],
1544+
"number": [
1545+
0
1546+
],
1547+
"time": [
1548+
0.0
1549+
]
1550+
}
15661551
}
15671552
]
15681553
}

0 commit comments

Comments
 (0)