mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-14 23:33:18 +00:00
Add the global -profile option to enable profiling
This commit is contained in:
@@ -16,6 +16,9 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
_ "net/http/pprof"
|
||||||
|
|
||||||
"github.com/gilbertchen/cli"
|
"github.com/gilbertchen/cli"
|
||||||
|
|
||||||
@@ -138,6 +141,15 @@ func setGlobalOptions(context *cli.Context) {
|
|||||||
ScriptEnabled = false
|
ScriptEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
address := context.GlobalString("profile")
|
||||||
|
if address != "" {
|
||||||
|
go func() {
|
||||||
|
http.ListenAndServe(address, nil)
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
duplicacy.RunInBackground = context.GlobalBool("background")
|
duplicacy.RunInBackground = context.GlobalBool("background")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1302,7 +1314,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "dry-run",
|
Name: "dry-run",
|
||||||
Usage: "Dry run for testing, don't backup anything. Use with -stats and -d",
|
Usage: "dry run for testing, don't backup anything. Use with -stats and -d",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "vss",
|
Name: "vss",
|
||||||
@@ -1811,6 +1823,12 @@ func main() {
|
|||||||
Name: "background",
|
Name: "background",
|
||||||
Usage: "read passwords, tokens, or keys only from keychain/keyring or env",
|
Usage: "read passwords, tokens, or keys only from keychain/keyring or env",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "profile",
|
||||||
|
Value: "",
|
||||||
|
Usage: "enable the profiling tool and listen on the specified address:port",
|
||||||
|
Argument: "<address:port>",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
app.HideVersion = true
|
app.HideVersion = true
|
||||||
|
|||||||
Reference in New Issue
Block a user