X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7d4e2e418a987a454d18902a937fc91bed69ce75..0348478eba20e59c3305dd5eda702d9192b45058:/lib/mount/command.go diff --git a/lib/mount/command.go b/lib/mount/command.go index f99e6da231..e92af24075 100644 --- a/lib/mount/command.go +++ b/lib/mount/command.go @@ -8,6 +8,9 @@ import ( "flag" "io" "log" + "net/http" + // pprof is only imported to register its HTTP handlers + _ "net/http/pprof" "os" "git.arvados.org/arvados.git/sdk/go/arvados" @@ -24,7 +27,7 @@ type cmd struct { // not be called more than once, or when ready is already // closed. ready chan struct{} - // It is safe to call Unmount ounly after ready has been + // It is safe to call Unmount only after ready has been // closed. Unmount func() (ok bool) } @@ -38,6 +41,8 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st flags := flag.NewFlagSet(prog, flag.ContinueOnError) ro := flags.Bool("ro", false, "read-only") experimental := flags.Bool("experimental", false, "acknowledge this is an experimental command, and should not be used in production (required)") + blockCache := flags.Int("block-cache", 4, "read cache size (number of 64MiB blocks)") + pprof := flags.String("pprof", "", "serve Go profile data at `[addr]:port`") err := flags.Parse(args) if err != nil { logger.Print(err) @@ -47,6 +52,11 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st logger.Printf("error: experimental command %q used without --experimental flag", prog) return 2 } + if *pprof != "" { + go func() { + log.Println(http.ListenAndServe(*pprof, nil)) + }() + } client := arvados.NewClientFromEnv() ac, err := arvadosclient.New(client) @@ -59,6 +69,7 @@ func (c *cmd) RunCommand(prog string, args []string, stdin io.Reader, stdout, st logger.Print(err) return 1 } + kc.BlockCache = &keepclient.BlockCache{MaxBlocks: *blockCache} host := fuse.NewFileSystemHost(&keepFS{ Client: client, KeepClient: kc,