github.com/cockroachdb/pebble@v1.1.2/internal/mkbench/main.go (about) 1 // Copyright 2021 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 // mkbench is a utility for processing the raw nightly benchmark data in JSON 6 // data that can be visualized by docs/js/app.js. The raw data is expected to 7 // be stored in dated directories underneath the "data/" directory: 8 // 9 // data/YYYYMMDD/.../<file> 10 // 11 // The files are expected to be bzip2 compressed. Within each file mkbench 12 // looks for Go-bench-style lines of the form: 13 // 14 // Benchmark<name> %d %f ops/sec %d read %d write %f r-amp %f w-amp 15 // 16 // The output is written to "data.js". In order to avoid reading all of the raw 17 // data to regenerate "data.js" on every run, mkbench first reads "data.js", 18 // noting which days have already been processed and exluding files in those 19 // directories from being read. This has the additional effect of merging the 20 // existing "data.js" with new raw data, which avoids needing to have all of 21 // the raw data present to construct a new "data.js" (only the new raw data is 22 // necessary). 23 // 24 // The nightly Pebble benchmarks are orchestrated from the CockroachDB 25 // repo: 26 // 27 // https://github.com/cockroachdb/cockroach/blob/master/build/teamcity-nightly-pebble.sh 28 package main 29 30 import ( 31 "os" 32 33 "github.com/spf13/cobra" 34 ) 35 36 var rootCmd = &cobra.Command{ 37 Use: "mkbench", 38 Short: "pebble benchmark data tools", 39 } 40 41 func init() { 42 y := getYCSBCommand() 43 rootCmd.AddCommand(getYCSBCommand()) 44 rootCmd.AddCommand(getWriteCommand()) 45 rootCmd.SilenceUsage = true 46 47 // For backwards compatability, the YCSB command is run, with the same 48 // flags, if a subcommand is not specified. 49 // TODO(travers): Remove this after updating the call site in the 50 // nightly-pebble script in cockroach. 51 *rootCmd.Flags() = *y.Flags() 52 rootCmd.RunE = y.RunE 53 } 54 55 func main() { 56 if err := rootCmd.Execute(); err != nil { 57 // Cobra has already printed the error message. 58 os.Exit(1) 59 } 60 }