Beispiel #1
0
// fetch fetches the current profile and the symbols from the target program.
func (r *report) fetch(force bool, secs time.Duration) error {
	r.mu.Lock()
	defer r.mu.Unlock()
	if r.p != nil && !force {
		return nil
	}
	if secs == 0 {
		secs = 60 * time.Second
	}
	url := fmt.Sprintf("%s/debug/_gom?view=profile&name=%s", *target, r.name)
	p, err := fetch.FetchProfile(url, secs)
	if err != nil {
		return err
	}
	if err := symbolz.Symbolize(fmt.Sprintf("%s/debug/_gom?view=symbol", *target), fetch.PostURL, p); err != nil {
		return err
	}
	r.p = p
	return nil
}
Beispiel #2
0
// Fetch fetches the current profile and the symbols from the target program.
func (r *report) Fetch(force bool, secs int) error {
	r.mu.Lock()
	defer r.mu.Unlock()
	if r.p != nil && !force {
		return nil
	}
	if secs == 0 {
		secs = r.secs
	}
	url := fmt.Sprintf("%s/debug/pprof/%s?seconds=%d", *target, r.name, secs)
	p, err := fetch.FetchProfile(url, 60*time.Second)
	if err != nil {
		return err
	}
	if err := symbolz.Symbolize(fmt.Sprintf("%s/debug/pprof/symbol", *target), fetch.PostURL, p); err != nil {
		return err
	}
	r.p = p
	return nil
}