-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (30 loc) · 769 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"context"
"flag"
"github.com/google/subcommands"
"go.uber.org/zap"
"github.com/mmcloughlin/goperf/pkg/command"
"github.com/mmcloughlin/goperf/pkg/platform"
)
func main() {
command.Run(run)
}
func run(ctx context.Context, l *zap.Logger) int {
base := command.NewBase(l)
// Platform provides OS specific functionality.
p := platform.New(base)
// Runner.
r := NewRun(base, p)
subcommands.Register(r, "benchmark execution")
// Wrappers.
for _, wrapper := range p.Wrappers() {
subcommands.Register(wrapper, "process wrapping")
}
// Help.
subcommands.Register(subcommands.HelpCommand(), "help")
subcommands.Register(subcommands.CommandsCommand(), "help")
// Execute.
flag.Parse()
return int(subcommands.Execute(ctx))
}