Skip to content

Commit

Permalink
Merge branch 'main' into llvm-symbolizer-startline
Browse files Browse the repository at this point in the history
  • Loading branch information
aalexand authored Sep 10, 2024
2 parents a088559 + a0b0bb1 commit 659b4d1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion browsertests/testdata/testfixture.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TestFixture records log messages and errors in an array that will
// be returned to Go code. Each element in the result array is either
// an array of the form ["LOG", ...]", or ["ERROR", ...].
// an array of the form ["LOG", ...], or ["ERROR", ...].
class TestFixture {
constructor() {
this.context = ""; // Added to front of all log and error messages.
Expand Down
3 changes: 3 additions & 0 deletions internal/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,9 @@ func ProfileLabels(rpt *Report) []string {
if o.SampleType != "" {
label = append(label, "Type: "+o.SampleType)
}
if url := prof.DocURL; url != "" {
label = append(label, "Doc: "+url)
}
if prof.TimeNanos != 0 {
const layout = "Jan 2, 2006 at 3:04pm (MST)"
label = append(label, "Time: "+time.Unix(0, prof.TimeNanos).Format(layout))
Expand Down
19 changes: 19 additions & 0 deletions internal/report/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package report

import (
"bytes"
"fmt"
"os"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -576,3 +577,21 @@ func TestDocURL(t *testing.T) {
})
}
}

func TestDocURLInLabels(t *testing.T) {
const url = "http://example.com/pprof-help"
profile := testProfile.Copy()
profile.DocURL = url
rpt := New(profile, &Options{
OutputFormat: Text,
Symbol: regexp.MustCompile(`.`),
TrimPath: "/some/path",
SampleValue: func(v []int64) int64 { return v[1] },
SampleUnit: testProfile.SampleType[1].Unit,
})

labels := fmt.Sprintf("%v", ProfileLabels(rpt))
if !strings.Contains(labels, url) {
t.Errorf("expected URL %q not found in %s", url, labels)
}
}
2 changes: 1 addition & 1 deletion profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ func (p *Profile) HasFileLines() bool {

// Unsymbolizable returns true if a mapping points to a binary for which
// locations can't be symbolized in principle, at least now. Examples are
// "[vdso]", [vsyscall]" and some others, see the code.
// "[vdso]", "[vsyscall]" and some others, see the code.
func (m *Mapping) Unsymbolizable() bool {
name := filepath.Base(m.File)
return strings.HasPrefix(name, "[") || strings.HasPrefix(name, "linux-vdso") || strings.HasPrefix(m.File, "/dev/dri/") || m.File == "//anon"
Expand Down

0 comments on commit 659b4d1

Please sign in to comment.