MCPcopy Create free account
hub / github.com/google/pprof / String

Method String

profile/profile.go:556–600  ·  view source on GitHub ↗

String dumps a text representation of a profile. Intended mainly for debugging purposes.

()

Source from the content-addressed store, hash-verified

554// String dumps a text representation of a profile. Intended mainly
555// for debugging purposes.
556func (p *Profile) String() string {
557 ss := make([]string, 0, len(p.Comments)+len(p.Sample)+len(p.Mapping)+len(p.Location))
558 for _, c := range p.Comments {
559 ss = append(ss, "Comment: "+c)
560 }
561 if url := p.DocURL; url != "" {
562 ss = append(ss, fmt.Sprintf("Doc: %s", url))
563 }
564 if pt := p.PeriodType; pt != nil {
565 ss = append(ss, fmt.Sprintf("PeriodType: %s %s", pt.Type, pt.Unit))
566 }
567 ss = append(ss, fmt.Sprintf("Period: %d", p.Period))
568 if p.TimeNanos != 0 {
569 ss = append(ss, fmt.Sprintf("Time: %v", time.Unix(0, p.TimeNanos)))
570 }
571 if p.DurationNanos != 0 {
572 ss = append(ss, fmt.Sprintf("Duration: %.4v", time.Duration(p.DurationNanos)))
573 }
574
575 ss = append(ss, "Samples:")
576 var sh1 string
577 for _, s := range p.SampleType {
578 dflt := ""
579 if s.Type == p.DefaultSampleType {
580 dflt = "[dflt]"
581 }
582 sh1 = sh1 + fmt.Sprintf("%s/%s%s ", s.Type, s.Unit, dflt)
583 }
584 ss = append(ss, strings.TrimSpace(sh1))
585 for _, s := range p.Sample {
586 ss = append(ss, s.string())
587 }
588
589 ss = append(ss, "Locations")
590 for _, l := range p.Location {
591 ss = append(ss, l.string())
592 }
593
594 ss = append(ss, "Mappings")
595 for _, m := range p.Mapping {
596 ss = append(ss, m.string())
597 }
598
599 return strings.Join(ss, "\n") + "\n"
600}
601
602// string dumps a text representation of a mapping. Intended mainly
603// for debugging purposes.

Callers

nothing calls this directly

Calls 1

stringMethod · 0.45

Tested by

no test coverage detected