Пример #1
0
func (b *bazil) Setup() (ok bool) {
	if b.Config.Debug {
		log := jog.New(nil)
		fuse.Debug = log.Event
	}

	if b.Config.CPUProfile != "" {
		f, err := os.Create(b.Config.CPUProfile)
		if err != nil {
			log.Printf("cpu profiling: %v", err)
			return false
		}
		err = pprof.StartCPUProfile(f)
		if err != nil {
			log.Printf("cpu profiling: %v", err)
			return false
		}
	}

	u := &httpunix.HTTPUnixTransport{
		DialTimeout:           100 * time.Millisecond,
		RequestTimeout:        1 * time.Second,
		ResponseHeaderTimeout: 1 * time.Second,
	}
	u.RegisterLocation("bazil", filepath.Join(b.Config.DataDir.String(), "control"))
	b.Control = http.Client{
		Transport: u,
	}

	return true
}
Пример #2
0
func (b *bazil) Setup() (ok bool) {
	if b.Config.Debug {
		log := jog.New(nil)
		fuse.Debug = log.Event
	}

	if b.Config.CPUProfile != "" {
		f, err := os.Create(b.Config.CPUProfile)
		if err != nil {
			log.Printf("cpu profiling: %v", err)
			return false
		}
		err = pprof.StartCPUProfile(f)
		if err != nil {
			log.Printf("cpu profiling: %v", err)
			return false
		}
	}
	return true
}