all repos

clerk @ c9588167d41ff39eba84ee402abf78d836e30bb0

missing tooling for ledger/hledger
1 files changed, 24 insertions(+), 0 deletions(-)
run profiler; hide it behind debug build tag
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-09-05 21:17:03 +0300
Authored at: 2026-09-05 20:36:50 +0300
Change ID: zutkwluwnnyoxkwxqwnywvnxznrqkzon
Parent: 3143815
A internal/cli/pprof_debug.go
ยทยทยท
        
        1
        +//go:build debug

      
        
        2
        +

      
        
        3
        +package cli

      
        
        4
        +

      
        
        5
        +import (

      
        
        6
        +	"fmt"

      
        
        7
        +	"net/http"

      
        
        8
        +	"os"

      
        
        9
        +

      
        
        10
        +	_ "net/http/pprof"

      
        
        11
        +)

      
        
        12
        +

      
        
        13
        +func init() {

      
        
        14
        +	addr := os.Getenv("CLERK_PPROF")

      
        
        15
        +	if addr == "" {

      
        
        16
        +		addr = "localhost:6969"

      
        
        17
        +	}

      
        
        18
        +	go func() {

      
        
        19
        +		fmt.Printf("pprof: http://%s/debug/pprof\n", addr)

      
        
        20
        +		if err := http.ListenAndServe(addr, nil); err != nil {

      
        
        21
        +			fmt.Fprintf(os.Stderr, "pprof: %v\n", err)

      
        
        22
        +		}

      
        
        23
        +	}()

      
        
        24
        +}