MCPcopy Index your code
hub / github.com/syncthing/syncthing / genDeepFiles

Function genDeepFiles

lib/model/model_test.go:2040–2064  ·  view source on GitHub ↗
(n, d int)

Source from the content-addressed store, hash-verified

2038}
2039
2040func genDeepFiles(n, d int) []protocol.FileInfo {
2041 mrand.Seed(int64(n))
2042 files := make([]protocol.FileInfo, n)
2043 t := time.Now().Unix()
2044 for i := 0; i < n; i++ {
2045 path := ""
2046 for i := 0; i <= d; i++ {
2047 path = filepath.Join(path, strconv.Itoa(mrand.Int()))
2048 }
2049
2050 sofar := ""
2051 for _, path := range filepath.SplitList(path) {
2052 sofar = filepath.Join(sofar, path)
2053 files[i] = protocol.FileInfo{
2054 Name: sofar,
2055 }
2056 i++
2057 }
2058
2059 files[i].ModifiedS = t
2060 files[i].Blocks = []protocol.BlockInfo{{Offset: 0, Size: 100, Hash: []byte("some hash bytes")}}
2061 }
2062
2063 return files
2064}
2065
2066func BenchmarkTree_10000_50(b *testing.B) {
2067 benchmarkTree(b, 10000, 50)

Callers 1

benchmarkTreeFunction · 0.85

Calls 2

SeedMethod · 0.80
NowMethod · 0.65

Tested by

no test coverage detected