code: func (p *Profiler) DumpSnapshot() error {
  	if p.Dir == "" {
  		return nil
  	}
  
  	if p.ProfileHeap {
  		if err := p.dumpHeapProfile(); err != nil {
  			return errors.Annotate(err, "failed to dump heap profile").Err()
  		}
  	}
  
  	return nil
  }
docs: // DumpSnapshot dumps a profile snapshot to the configured output directory. If
  // no output directory is configured, nothing will happen.