MCPcopy Create free account
hub / github.com/google/pprof / makeShortcuts

Function makeShortcuts

internal/driver/interactive_test.go:108–132  ·  view source on GitHub ↗
(input []string, seed int64)

Source from the content-addressed store, hash-verified

106}
107
108func makeShortcuts(input []string, seed int64) (shortcuts, []string) {
109 rand := rand.New(rand.NewSource(seed))
110
111 s := shortcuts{}
112 var output, chunk []string
113 for _, l := range input {
114 chunk = append(chunk, l)
115 switch rand.Intn(3) {
116 case 0:
117 // Create a macro for commands in 'chunk'.
118 macro := fmt.Sprintf("alias%d", len(s))
119 s[macro] = chunk
120 output = append(output, macro)
121 chunk = nil
122 case 1:
123 // Append commands in 'chunk' by themselves.
124 output = append(output, chunk...)
125 chunk = nil
126 case 2:
127 // Accumulate commands into 'chunk'
128 }
129 }
130 output = append(output, chunk...)
131 return s, output
132}
133
134func checkValue(p *profile.Profile, cmd []string, cfg config, o *plugin.Options) error {
135 if len(cmd) != 2 {

Callers 1

TestShellFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…