pool is created on demand (#6)

This commit is contained in:
Pavel Vorobyov
2019-12-19 16:13:43 +03:00
committed by GitHub
parent 93e477ed62
commit 91f776275d
7 changed files with 32 additions and 12 deletions

View File

@@ -50,7 +50,6 @@ func (c *Cli) runAlias(name string, argsLine string, args ...string) {
}
func exterpolate(al *alias, argsLine string, args ...string) (string, error) {
fmt.Println(al, argsLine, args)
res := ""
for i := 0; i < len(al.proxy); i++ {
if i < len(al.proxy)-1 && al.proxy[i] == '#' {

View File

@@ -134,6 +134,7 @@ func New(cfg *config.XCConfig, backend store.Backend) (*Cli, error) {
remote.SetConnectTimeout(cli.connectTimeout)
remote.SetDebug(cli.debug)
remote.SetUsePasswordManager(cli.usePasswordMgr)
remote.SetNumThreads(cli.sshThreads)
// interpreter
cli.setInterpreter("none", cfg.Interpreter)

View File

@@ -5,6 +5,7 @@ import (
"os"
"os/exec"
"os/signal"
"runtime"
"strconv"
"syscall"
@@ -53,6 +54,7 @@ func (c *Cli) setupCmdHandlers() {
c.handlers["distribute_type"] = c.doDistributeType
c.handlers["_passmgr_debug"] = c.doPassmgrDebug
c.handlers["version"] = c.doVersion
c.handlers["goruntime"] = c.doGoruntime
commands := make([]string, len(c.handlers))
i := 0
@@ -478,3 +480,19 @@ func (c *Cli) doPRunScript(name string, argsLine string, args ...string) {
func (c *Cli) doPassmgrDebug(name string, argsLine string, args ...string) {
passmgr.PrintDebug()
}
func (c *Cli) doGoruntime(name string, argsLine string, args ...string) {
var ms runtime.MemStats
numGr := runtime.NumGoroutine()
runtime.ReadMemStats(&ms)
term.Warnf("Heap Allocations: %d\n", ms.HeapAlloc)
term.Warnf("Heap Objects: %d\n", ms.HeapObjects)
term.Warnf("Heap In Use: %d\n", ms.HeapInuse)
term.Warnf("Mallocs: %d\n", ms.Mallocs)
term.Warnf("Frees: %d\n", ms.Frees)
term.Warnf("Last GC TStamp: %d\n", ms.LastGC/1_000_000_000)
term.Warnf("Next GC HeapSize: %d\n", ms.NextGC)
term.Warnf("Num GC: %d\n", ms.NumGC)
term.Warnf("Num Forced GC: %d\n\n", ms.NumForcedGC)
term.Warnf("Goroutines: %d\n", numGr)
}