This file is indexed.

/usr/share/gocode/src/bazil.org/fuse/fs/bench/bench_create_test.go is in golang-bazil-fuse-dev 0.0~git20160811.0.371fbbd-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package bench_test

import (
	"fmt"
	"os"
	"testing"

	"bazil.org/fuse"
	"bazil.org/fuse/fs"
	"bazil.org/fuse/fs/fstestutil"
	"golang.org/x/net/context"
)

type dummyFile struct {
	fstestutil.File
}

type benchCreateDir struct {
	fstestutil.Dir
}

var _ fs.NodeCreater = (*benchCreateDir)(nil)

func (f *benchCreateDir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (fs.Node, fs.Handle, error) {
	child := &dummyFile{}
	return child, child, nil
}

func BenchmarkCreate(b *testing.B) {
	f := &benchCreateDir{}
	mnt, err := fstestutil.MountedT(b, fstestutil.SimpleFS{f}, nil)
	if err != nil {
		b.Fatal(err)
	}
	defer mnt.Close()

	// prepare file names to decrease test overhead
	names := make([]string, 0, b.N)
	for i := 0; i < b.N; i++ {
		// zero-padded so cost stays the same on every iteration
		names = append(names, mnt.Dir+"/"+fmt.Sprintf("%08x", i))
	}
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		f, err := os.Create(names[i])
		if err != nil {
			b.Fatalf("WriteFile: %v", err)
		}
		f.Close()
	}

	b.StopTimer()
}