(b *testing.B)
| 12 | ) |
| 13 | |
| 14 | func BenchmarkFilesOutput(b *testing.B) { |
| 15 | defer testutil.DisableLogging()() |
| 16 | dir, rmdir := testutil.TempDir(b) |
| 17 | defer rmdir() |
| 18 | |
| 19 | toml := fmt.Sprintf(` |
| 20 | [input] |
| 21 | name="Random" |
| 22 | [input.config] |
| 23 | numlines = 10000 |
| 24 | |
| 25 | [output] |
| 26 | name="FileWriter" |
| 27 | procs=1 |
| 28 | |
| 29 | [output.config] |
| 30 | pathstring = "%s" |
| 31 | zstdcompressionlevel = 0 |
| 32 | `, filepath.Join(dir, "log.zst")) |
| 33 | |
| 34 | c := baker.Components{ |
| 35 | Inputs: []baker.InputDesc{inputtest.RandomDesc}, |
| 36 | Outputs: []baker.OutputDesc{FileWriterDesc}, |
| 37 | } |
| 38 | |
| 39 | cfg, err := baker.NewConfigFromToml(strings.NewReader(toml), c) |
| 40 | if err != nil { |
| 41 | b.Fatal(err) |
| 42 | } |
| 43 | |
| 44 | b.ReportAllocs() |
| 45 | b.ResetTimer() |
| 46 | |
| 47 | for n := 0; n < b.N; n++ { |
| 48 | b.StopTimer() |
| 49 | topology, err := baker.NewTopologyFromConfig(cfg) |
| 50 | if err != nil { |
| 51 | b.Fatal(err) |
| 52 | } |
| 53 | b.StartTimer() |
| 54 | topology.Start() |
| 55 | topology.Wait() |
| 56 | topology.Stop() |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected