mirror of
https://github.com/JaCoB1123/dupe-finder.git
synced 2025-05-17 21:51:56 +02:00
Add Flag to enable cpu profiling
This commit is contained in:
parent
29fa093184
commit
594a88c3ec
12
main.go
12
main.go
@ -6,9 +6,11 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -21,10 +23,20 @@ var promptForDelete = flag.Bool("delete-prompt", false, "Ask which file to keep
|
||||
var moveToFolder = flag.String("move-files", "", "Move files to <path> instead of deleting them")
|
||||
var force = flag.Bool("force", false, "Actually delete files. Without this options, the files to be deleted are only printed")
|
||||
var verbose = flag.Bool("verbose", false, "Output additional information")
|
||||
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if *cpuprofile != "" {
|
||||
f, err := os.Create(*cpuprofile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
pprof.StartCPUProfile(f)
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
||||
if *verbose {
|
||||
printConfiguration()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user