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

Function BenchmarkRequestInSingleFile

lib/model/model_test.go:233–254  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

231}
232
233func BenchmarkRequestInSingleFile(b *testing.B) {
234 w, cancel := newConfigWrapper(defaultCfg)
235 defer cancel()
236 ffs := w.FolderList()[0].Filesystem()
237 m := setupModel(b, w)
238 defer cleanupModel(m)
239
240 buf := make([]byte, 128<<10)
241 srand.Read(buf)
242 must(b, ffs.MkdirAll("request/for/a/file/in/a/couple/of/dirs", 0o755))
243 writeFile(b, ffs, "request/for/a/file/in/a/couple/of/dirs/128k", buf)
244
245 b.ResetTimer()
246
247 for i := 0; i < b.N; i++ {
248 if _, err := m.Request(device1Conn, &protocol.Request{Folder: "default", Name: "request/for/a/file/in/a/couple/of/dirs/128k", Size: 128 << 10}); err != nil {
249 b.Error(err)
250 }
251 }
252
253 b.SetBytes(128 << 10)
254}
255
256func TestDeviceRename(t *testing.T) {
257 hello := protocol.Hello{

Callers

nothing calls this directly

Calls 11

newConfigWrapperFunction · 0.85
setupModelFunction · 0.85
cleanupModelFunction · 0.85
mustFunction · 0.85
FilesystemMethod · 0.80
writeFileFunction · 0.70
FolderListMethod · 0.65
MkdirAllMethod · 0.65
RequestMethod · 0.65
ErrorMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected