github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/protocol/keybase1/pprof.go (about)

     1  // Auto-generated to Go types and interfaces using avdl-compiler v1.4.10 (https://github.com/keybase/node-avdl-compiler)
     2  //   Input file: avdl/keybase1/pprof.avdl
     3  
     4  package keybase1
     5  
     6  import (
     7  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
     8  	context "golang.org/x/net/context"
     9  	"time"
    10  )
    11  
    12  type ProcessorProfileArg struct {
    13  	SessionID              int         `codec:"sessionID" json:"sessionID"`
    14  	ProfileFile            string      `codec:"profileFile" json:"profileFile"`
    15  	ProfileDurationSeconds DurationSec `codec:"profileDurationSeconds" json:"profileDurationSeconds"`
    16  }
    17  
    18  type HeapProfileArg struct {
    19  	SessionID   int    `codec:"sessionID" json:"sessionID"`
    20  	ProfileFile string `codec:"profileFile" json:"profileFile"`
    21  }
    22  
    23  type LogProcessorProfileArg struct {
    24  	SessionID              int         `codec:"sessionID" json:"sessionID"`
    25  	LogDirForMobile        string      `codec:"logDirForMobile" json:"logDirForMobile"`
    26  	ProfileDurationSeconds DurationSec `codec:"profileDurationSeconds" json:"profileDurationSeconds"`
    27  }
    28  
    29  type TraceArg struct {
    30  	SessionID            int         `codec:"sessionID" json:"sessionID"`
    31  	TraceFile            string      `codec:"traceFile" json:"traceFile"`
    32  	TraceDurationSeconds DurationSec `codec:"traceDurationSeconds" json:"traceDurationSeconds"`
    33  }
    34  
    35  type LogTraceArg struct {
    36  	SessionID            int         `codec:"sessionID" json:"sessionID"`
    37  	LogDirForMobile      string      `codec:"logDirForMobile" json:"logDirForMobile"`
    38  	TraceDurationSeconds DurationSec `codec:"traceDurationSeconds" json:"traceDurationSeconds"`
    39  }
    40  
    41  type PprofInterface interface {
    42  	ProcessorProfile(context.Context, ProcessorProfileArg) error
    43  	HeapProfile(context.Context, HeapProfileArg) error
    44  	LogProcessorProfile(context.Context, LogProcessorProfileArg) error
    45  	Trace(context.Context, TraceArg) error
    46  	LogTrace(context.Context, LogTraceArg) error
    47  }
    48  
    49  func PprofProtocol(i PprofInterface) rpc.Protocol {
    50  	return rpc.Protocol{
    51  		Name: "keybase.1.pprof",
    52  		Methods: map[string]rpc.ServeHandlerDescription{
    53  			"processorProfile": {
    54  				MakeArg: func() interface{} {
    55  					var ret [1]ProcessorProfileArg
    56  					return &ret
    57  				},
    58  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    59  					typedArgs, ok := args.(*[1]ProcessorProfileArg)
    60  					if !ok {
    61  						err = rpc.NewTypeError((*[1]ProcessorProfileArg)(nil), args)
    62  						return
    63  					}
    64  					err = i.ProcessorProfile(ctx, typedArgs[0])
    65  					return
    66  				},
    67  			},
    68  			"heapProfile": {
    69  				MakeArg: func() interface{} {
    70  					var ret [1]HeapProfileArg
    71  					return &ret
    72  				},
    73  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    74  					typedArgs, ok := args.(*[1]HeapProfileArg)
    75  					if !ok {
    76  						err = rpc.NewTypeError((*[1]HeapProfileArg)(nil), args)
    77  						return
    78  					}
    79  					err = i.HeapProfile(ctx, typedArgs[0])
    80  					return
    81  				},
    82  			},
    83  			"logProcessorProfile": {
    84  				MakeArg: func() interface{} {
    85  					var ret [1]LogProcessorProfileArg
    86  					return &ret
    87  				},
    88  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
    89  					typedArgs, ok := args.(*[1]LogProcessorProfileArg)
    90  					if !ok {
    91  						err = rpc.NewTypeError((*[1]LogProcessorProfileArg)(nil), args)
    92  						return
    93  					}
    94  					err = i.LogProcessorProfile(ctx, typedArgs[0])
    95  					return
    96  				},
    97  			},
    98  			"trace": {
    99  				MakeArg: func() interface{} {
   100  					var ret [1]TraceArg
   101  					return &ret
   102  				},
   103  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   104  					typedArgs, ok := args.(*[1]TraceArg)
   105  					if !ok {
   106  						err = rpc.NewTypeError((*[1]TraceArg)(nil), args)
   107  						return
   108  					}
   109  					err = i.Trace(ctx, typedArgs[0])
   110  					return
   111  				},
   112  			},
   113  			"logTrace": {
   114  				MakeArg: func() interface{} {
   115  					var ret [1]LogTraceArg
   116  					return &ret
   117  				},
   118  				Handler: func(ctx context.Context, args interface{}) (ret interface{}, err error) {
   119  					typedArgs, ok := args.(*[1]LogTraceArg)
   120  					if !ok {
   121  						err = rpc.NewTypeError((*[1]LogTraceArg)(nil), args)
   122  						return
   123  					}
   124  					err = i.LogTrace(ctx, typedArgs[0])
   125  					return
   126  				},
   127  			},
   128  		},
   129  	}
   130  }
   131  
   132  type PprofClient struct {
   133  	Cli rpc.GenericClient
   134  }
   135  
   136  func (c PprofClient) ProcessorProfile(ctx context.Context, __arg ProcessorProfileArg) (err error) {
   137  	err = c.Cli.Call(ctx, "keybase.1.pprof.processorProfile", []interface{}{__arg}, nil, 0*time.Millisecond)
   138  	return
   139  }
   140  
   141  func (c PprofClient) HeapProfile(ctx context.Context, __arg HeapProfileArg) (err error) {
   142  	err = c.Cli.Call(ctx, "keybase.1.pprof.heapProfile", []interface{}{__arg}, nil, 0*time.Millisecond)
   143  	return
   144  }
   145  
   146  func (c PprofClient) LogProcessorProfile(ctx context.Context, __arg LogProcessorProfileArg) (err error) {
   147  	err = c.Cli.Call(ctx, "keybase.1.pprof.logProcessorProfile", []interface{}{__arg}, nil, 0*time.Millisecond)
   148  	return
   149  }
   150  
   151  func (c PprofClient) Trace(ctx context.Context, __arg TraceArg) (err error) {
   152  	err = c.Cli.Call(ctx, "keybase.1.pprof.trace", []interface{}{__arg}, nil, 0*time.Millisecond)
   153  	return
   154  }
   155  
   156  func (c PprofClient) LogTrace(ctx context.Context, __arg LogTraceArg) (err error) {
   157  	err = c.Cli.Call(ctx, "keybase.1.pprof.logTrace", []interface{}{__arg}, nil, 0*time.Millisecond)
   158  	return
   159  }