Commit Graph

3 Commits

Author SHA1 Message Date
Qi Xiao
ffbd734367 pkg/pprof: Support -allocsprofile. 2022-11-26 12:56:43 +00:00
Qi Xiao
79207b39b6 Fix recording of CPU profiles when using cmd/withprof/elvish.
pprof.Program.Run called pprof.StopCPUProfile in a defer, so the profile will
only capture the extent of that method.

In order to capture an actual Elvish session pprof.StopCPUProfile needs to be
called before the overall program terminates. This is done by allowing the
special "next program" error to carry cleanup functions.

This fixes #1605.
2022-11-26 12:05:39 +00:00
Qi Xiao
33a04f8dc1 Revamp flag handling in pkg/prog.
Instead of putting all possible flags in prog.Flags, flags are now registered by
the individual subprograms. The 3 flags -sock, -db and -json are shared by
multiple subprograms and still handled by the prog package.

This new design allows separating the support for -cpuprofile into a separate
subprogram, which is no longer included by the default entry point, making the
binary slightly smaller. A new entrypoint "withpprof" is created.

Also include the LSP subprogram in the nodaemon entry point.
2022-02-05 14:52:29 +00:00