Skip to content

Commit e69c916

Browse files
Handle possible duplicate thread events per thread Id. (#61)
1 parent 5b32c5f commit e69c916

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

PerfettoCds/Pipeline/CompositeDataCookers/PerfettoCpuSchedEventCooker.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@ void PopulateCpuWakeEvents(IDataExtensionRetrieval requiredData, ProcessedEventD
143143
var schedWakeData = requiredData.QueryOutput<ProcessedEventData<PerfettoFtraceEvent>>(new DataOutputPath(PerfettoPluginConstants.FtraceEventCookerPath, nameof(PerfettoFtraceEventCooker.FtraceEvents)))
144144
.Where(f => f.Name == "sched_wakeup");
145145

146-
Dictionary<long, PerfettoThreadEvent> tidToThreadMap = threadData.ToDictionary(t => t.Tid);
147-
Dictionary<long, PerfettoProcessEvent> upidToProcessMap = processData.ToDictionary(p => p.Upid);
146+
Dictionary<long, PerfettoThreadEvent> tidToThreadMap = threadData
147+
.ToLookup(t => t.Tid)
148+
.ToDictionary(tg => tg.Key, tg => tg.Last());
149+
Dictionary<long, PerfettoProcessEvent> upidToProcessMap = processData
150+
.ToLookup(p => p.Upid)
151+
.ToDictionary(pg => pg.Key, pg => pg.Last());
148152

149153
// Create events out of the joined results
150154
foreach (var wake in schedWakeData)

0 commit comments

Comments
 (0)