Skip to content

Commit

Permalink
kram-profile - fix Win profiling
Browse files Browse the repository at this point in the history
macOS uses tid = 259 for the build profiles, but Win uses a random tid
  • Loading branch information
alecazam committed Mar 17, 2024
1 parent 841736b commit b536046
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kram-profile/kram-profile/kram_profileApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,9 @@ func computeEventParentsAndDurSub(_ events: inout [CatapultEvent]) {
var root = 0;

// skip the thread names
var buildThreadId = Int.max
while events[sortedIndices[root]].ph! == "M" {
buildThreadId = min(buildThreadId, events[sortedIndices[root]].tid!)
root += 1
}

Expand All @@ -1142,9 +1144,8 @@ func computeEventParentsAndDurSub(_ events: inout [CatapultEvent]) {
// This only works on a per thread basis, but build events only have a single thread
// annoying that it's not tid == 0. So this is the build event specific code. Would
// need to run this logic for each unique tid in the events array.
// TODO: generalize so can use on perf effects. Memory doesn't need.
let kBuildEventTid = 259
if ev2.tid != kBuildEventTid { continue }
// TODO: generalize so can use on perf effects. Memory doesn't need this call.
if ev2.tid != buildThreadId { continue }

// walk up the stack of parents, to find one that this event is within
while root != -1 {
Expand Down

0 comments on commit b536046

Please sign in to comment.