MCPcopy Create free account
hub / github.com/microsoft/typescript-go / handleStartCPUProfile

Method handleStartCPUProfile

internal/api/session.go:780–788  ·  view source on GitHub ↗
(_ context.Context, params *ProfileParams)

Source from the content-addressed store, hash-verified

778}
779
780func (s *Session) handleStartCPUProfile(_ context.Context, params *ProfileParams) (any, error) {
781 if params == nil || params.Dir == "" {
782 return nil, fmt.Errorf("%w: dir is required", ErrClientError)
783 }
784 if err := s.cpuProfiler.StartCPUProfile(params.Dir); err != nil {
785 return nil, fmt.Errorf("%w: failed to start CPU profile: %w", ErrClientError, err)
786 }
787 return nil, nil
788}
789
790func (s *Session) handleStopCPUProfile(_ context.Context) (*ProfileResult, error) {
791 filePath, err := s.cpuProfiler.StopCPUProfile()

Callers 1

HandleRequestMethod · 0.95

Calls 2

StartCPUProfileMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected