Skip to content

Commit

Permalink
Fix rendering issue
Browse files Browse the repository at this point in the history
  • Loading branch information
viglia committed Jan 30, 2024
1 parent ae30cb5 commit b67f875
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions internal/profile/android.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (m AndroidMethod) ExtractPackageNameAndSimpleMethodNameFromAndroidMethod()
}

func (m AndroidMethod) FullMethodNameFromAndroidMethod() (string, error) {
// when we we're dealing with js frame that were "converted"
// to android methods (react-native) we don't have class name
if m.ClassName == "" {
return m.Name, nil
}
var builder strings.Builder
builder.WriteString(m.ClassName)
// "<init>" refers to the constructor in which case it's more readable to omit the method name. Note the method name
Expand Down
11 changes: 8 additions & 3 deletions internal/profile/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (p LegacyProfile) CallTrees() (map[uint64][]*nodetree.Node, error) {
if p.Trace == nil {
return nil, ErrProfileHasNoTrace
}
_, ok := p.Trace.(Android)
_, ok := p.Trace.(*Android)
// this is to handle only the Reactnative (android + js)
// use case. If it's an Android profile but there is no
// js profile, we'll skip this entirely
Expand Down Expand Up @@ -176,7 +176,7 @@ func (p LegacyProfile) IsSampleFormat() bool {
}

func (p *LegacyProfile) Speedscope() (speedscope.Output, error) {
t, ok := p.Trace.(Android)
t, ok := p.Trace.(*Android)
// this is to handle only the Reactnative (android + js)
// use case. If it's an Android profile but there is no
// js profile, we'll skip this entirely
Expand Down Expand Up @@ -494,8 +494,13 @@ func getEventTimeFromElapsedNanoseconds(ns uint64) EventTime {
}

func unmarshalSampleProfile(p json.RawMessage) (sample.Trace, error) {
var objmap map[string]json.RawMessage
err := json.Unmarshal(p, &objmap)
if err != nil {
return sample.Trace{}, err
}
var st sample.Trace
err := json.Unmarshal(p, &st)
err = json.Unmarshal(objmap["profile"], &st)
if err != nil {
return sample.Trace{}, err
}
Expand Down

0 comments on commit b67f875

Please sign in to comment.