()
| 94 | } |
| 95 | |
| 96 | func main() { |
| 97 | log.SetFlags(0) |
| 98 | |
| 99 | indexName = indexName + "-" + datasetName |
| 100 | if flushBytes < 1 { |
| 101 | flushBytes = humanBytes(3e+6) |
| 102 | } |
| 103 | |
| 104 | var opts []elasticsearch.Option |
| 105 | |
| 106 | if useFasthttp { |
| 107 | opts = append(opts, elasticsearch.WithTransportOptions(elastictransport.WithTransport(&fasthttpTransport{}))) |
| 108 | } |
| 109 | |
| 110 | if debug { |
| 111 | opts = append(opts, elasticsearch.WithLogger(&elastictransport.ColorLogger{Output: os.Stdout, EnableRequestBody: true, EnableResponseBody: true})) |
| 112 | } |
| 113 | |
| 114 | es, _ := elasticsearch.New(opts...) |
| 115 | |
| 116 | runnerCfg := runner.Config{ |
| 117 | Client: es, |
| 118 | |
| 119 | IndexName: indexName, |
| 120 | DatasetName: datasetName, |
| 121 | NumShards: numShards, |
| 122 | NumReplicas: numReplicas, |
| 123 | NumItems: numItems, |
| 124 | NumRuns: numRuns, |
| 125 | NumWarmupRuns: numWarmupRuns, |
| 126 | NumWorkers: numWorkers, |
| 127 | FlushBytes: int(flushBytes), |
| 128 | Wait: wait, |
| 129 | Mockserver: mockserver, |
| 130 | } |
| 131 | |
| 132 | if useEasyjson { |
| 133 | runnerCfg.Decoder = easyjsonDecoder{} |
| 134 | } |
| 135 | |
| 136 | runner, err := runner.NewRunner(runnerCfg) |
| 137 | if err != nil { |
| 138 | log.Fatalf("Error creating runner: %s", err) |
| 139 | } |
| 140 | |
| 141 | done := make(chan os.Signal, 1) |
| 142 | signal.Notify(done, os.Interrupt) |
| 143 | |
| 144 | go func() { <-done; log.Println("\r" + strings.Repeat("▁", 110)); runner.Report(); os.Exit(0) }() |
| 145 | defer func() { log.Println(strings.Repeat("▁", 110)); runner.Report() }() |
| 146 | |
| 147 | log.Printf( |
| 148 | "%s: run [%sx] warmup [%dx] shards [%d] replicas [%d] workers [%d] flush [%s] wait [%s]%s%s", |
| 149 | datasetName, |
| 150 | humanize.Comma(int64(numRuns)), |
| 151 | numWarmupRuns, |
| 152 | numShards, |
| 153 | numReplicas, |
nothing calls this directly
no test coverage detected