MCPcopy
hub / github.com/etcd-io/bbolt / runReads

Function runReads

cmd/bbolt/command/command_bench.go:396–437  ·  view source on GitHub ↗
(cmd *cobra.Command, db *bolt.DB, options *benchOptions, results *benchResults, keys []nestedKey)

Source from the content-addressed store, hash-verified

394}
395
396func runReads(cmd *cobra.Command, db *bolt.DB, options *benchOptions, results *benchResults, keys []nestedKey) error {
397 // Start profiling for reads.
398 if options.profileMode == "r" {
399 startProfiling(cmd, options)
400 }
401
402 finishChan := make(chan interface{})
403 go checkProgress(results, finishChan, cmd.ErrOrStderr())
404 defer close(finishChan)
405
406 t := time.Now()
407
408 var err error
409 switch options.readMode {
410 case "seq":
411 switch options.writeMode {
412 case "seq-nest", "rnd-nest":
413 err = runReadsSequentialNested(cmd, db, options, results)
414 default:
415 err = runReadsSequential(cmd, db, options, results)
416 }
417 case "rnd":
418 switch options.writeMode {
419 case "seq-nest", "rnd-nest":
420 err = runReadsRandomNested(cmd, db, options, keys, results)
421 default:
422 err = runReadsRandom(cmd, db, options, keys, results)
423 }
424 default:
425 return fmt.Errorf("invalid read mode: %s", options.readMode)
426 }
427
428 // Save read time.
429 results.setDuration(time.Since(t))
430
431 // Stop profiling for reads.
432 if options.profileMode == "rw" || options.profileMode == "r" {
433 stopProfiling(cmd)
434 }
435
436 return err
437}
438
439type nestedKey struct{ bucket, key []byte }
440

Callers 1

benchFuncFunction · 0.85

Calls 9

startProfilingFunction · 0.85
checkProgressFunction · 0.85
runReadsSequentialNestedFunction · 0.85
runReadsSequentialFunction · 0.85
runReadsRandomNestedFunction · 0.85
runReadsRandomFunction · 0.85
stopProfilingFunction · 0.85
setDurationMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected