Skip to content

Commit

Permalink
fix: Return the duration measured by the profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
phacops committed Sep 27, 2024
1 parent cc149a0 commit 8074fa0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions internal/profile/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ type AndroidEvent struct {

type (
Android struct {
Clock Clock `json:"clock"`
Events []AndroidEvent `json:"events,omitempty"`
Methods []AndroidMethod `json:"methods,omitempty"`
StartTime uint64 `json:"start_time,omitempty"`
Threads []AndroidThread `json:"threads,omitempty"`
Clock Clock `json:"clock"`
ElapsedTime uint64 `json:"elapsed_time,omitempty"`
Events []AndroidEvent `json:"events,omitempty"`
Methods []AndroidMethod `json:"methods,omitempty"`
StartTime uint64 `json:"start_time,omitempty"`
Threads []AndroidThread `json:"threads,omitempty"`
}

Clock string
Expand Down Expand Up @@ -361,10 +362,7 @@ func (p Android) DurationNS() uint64 {
if len(p.Events) == 0 {
return 0
}
buildTimestamp := p.TimestampGetter()
startTS := buildTimestamp(p.Events[0].Time)
endTS := buildTimestamp(p.Events[len(p.Events)-1].Time)
return endTS - startTS
return p.ElapsedTime
}

func generateFingerprint(stack []*nodetree.Node) uint64 {
Expand Down

0 comments on commit 8074fa0

Please sign in to comment.