summaryrefslogtreecommitdiffstats
path: root/src/options_no_pprof.go
diff options
context:
space:
mode:
authorCharlie Vieth <charlie.vieth@gmail.com>2024-04-13 01:58:11 -0400
committerGitHub <noreply@github.com>2024-04-13 14:58:11 +0900
commit3c877c504b6102daf5dcc1083b1f1a7db88d304c (patch)
tree7072b889071948a6bfb6d980d43367745a37490f /src/options_no_pprof.go
parent892d1acccb705e5547be1b3b6fad8b6d480c290b (diff)
Enable profiling options when 'pprof' tag is set (#2813)
This commit enables cpu, mem, block, and mutex profling of the FZF executable. To support flushing the profiles at program exit it adds util.AtExit to register "at exit" functions and mandates that util.Exit is used instead of os.Exit to stop the program. Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
Diffstat (limited to 'src/options_no_pprof.go')
-rw-r--r--src/options_no_pprof.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/options_no_pprof.go b/src/options_no_pprof.go
new file mode 100644
index 00000000..1a19bc63
--- /dev/null
+++ b/src/options_no_pprof.go
@@ -0,0 +1,11 @@
+//go:build !pprof
+// +build !pprof
+
+package fzf
+
+func (o *Options) initProfiling() error {
+ if o.CPUProfile != "" || o.MEMProfile != "" || o.BlockProfile != "" || o.MutexProfile != "" {
+ errorExit("error: profiling not supported: FZF must be built with '-tags=pprof' to enable profiling")
+ }
+ return nil
+}