src/client/debug.go
func (c APIClient) Profile(profile string, duration time.Duration, w io.Writer) error {
	var d *types.Duration
	if duration != 0 {
		d = types.DurationProto(duration)
	}
	profileClient, err := c.DebugClient.Profile(c.Ctx(), &debug.ProfileRequest{
		Profile:  profile,
		Duration: d,
	})
	if err != nil {
		return grpcutil.ScrubGRPC(err)
	}
	return grpcutil.ScrubGRPC(grpcutil.WriteFromStreamingBytesClient(profileClient, w))
}
func (c APIClient) Profile(profile string, duration time.Duration, w io.Writer) error {
	var d *types.Duration
	if duration != 0 {
		d = types.DurationProto(duration)
	}
	profileClient, err := c.DebugClient.Profile(c.Ctx(), &debug.ProfileRequest{
		Profile:  profile,
		Duration: d,
	})
	if err != nil {
		return grpcutil.ScrubGRPC(err)
	}
	return grpcutil.ScrubGRPC(grpcutil.WriteFromStreamingBytesClient(profileClient, w))
}
// Profile writes a pprof profile for pachd to w.