github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/bench/microbenchmarks/lstat/basic_test.go (about) 1 // Package lstat compares access(), stat() and lstat() (syscall) latencies 2 /* 3 * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. 4 */ 5 6 // how to run: 7 // go test -bench=. -benchtime=20s ./lstat_test.go 8 9 package lstat_test 10 11 import ( 12 "testing" 13 ) 14 15 const ( 16 one = "basic_test.go" 17 two = "parallel_test.go" 18 ) 19 20 func BenchmarkAccess(b *testing.B) { 21 for range b.N { 22 access(b, one) 23 access(b, two) 24 } 25 } 26 27 func BenchmarkStat(b *testing.B) { 28 for range b.N { 29 stat(b, one) 30 stat(b, two) 31 } 32 } 33 34 func BenchmarkLstat(b *testing.B) { 35 for range b.N { 36 lstat(b, one) 37 lstat(b, two) 38 } 39 } 40 41 func BenchmarkOpen(b *testing.B) { 42 for range b.N { 43 open(b, one) 44 open(b, two) 45 } 46 } 47 48 func BenchmarkSyscallStat(b *testing.B) { 49 for range b.N { 50 syscallStat(b, one) 51 syscallStat(b, two) 52 } 53 }