mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-10 21:07:53 +00:00
add flag or setting temp dir used for benchmarks
This commit is contained in:
parent
4f459028d9
commit
4f808c2028
1 changed files with 7 additions and 2 deletions
|
|
@ -39,8 +39,13 @@ var (
|
|||
// In order to generate the sample fragment file,
|
||||
// run an import and copy PILOSA_DATA_DIR/INDEX_NAME/FRAME_NAME/0 to testdata/sample_view
|
||||
FragmentPath = flag.String("fragment", "testdata/sample_view/0", "fragment path")
|
||||
TempDir = ""
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&TempDir, "temp-dir", "", "Directory in which to place temporary data (e.g. for benchmarking). Useful if you are trying to benchmark different storage configurations.")
|
||||
}
|
||||
|
||||
// Ensure a fragment can set a bit and retrieve it.
|
||||
func TestFragment_SetBit(t *testing.T) {
|
||||
f := mustOpenFragment("i", "f", viewStandard, 0, "")
|
||||
|
|
@ -1985,7 +1990,7 @@ func BenchmarkFileWrite(b *testing.B) {
|
|||
b.Run(fmt.Sprintf("Rows%d", numRows), func(b *testing.B) {
|
||||
b.StopTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
f, err := ioutil.TempFile("", "")
|
||||
f, err := ioutil.TempFile(TempDir, "")
|
||||
if err != nil {
|
||||
b.Fatalf("getting temp file: %v", err)
|
||||
}
|
||||
|
|
@ -2026,7 +2031,7 @@ func (f *fragment) Clean() error {
|
|||
|
||||
// mustOpenFragment returns a new instance of Fragment with a temporary path.
|
||||
func mustOpenFragment(index, field, view string, shard uint64, cacheType string) *fragment {
|
||||
file, err := ioutil.TempFile("", "pilosa-fragment-")
|
||||
file, err := ioutil.TempFile(TempDir, "pilosa-fragment-")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue