Skip to content

Commit f76ba48

Browse files
committed
container/libcontainer: Add limit parsing benchmark
1 parent fbd519b commit f76ba48

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

container/libcontainer/handler_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,18 @@ func TestClearReferencedBytesWhenClearRefsMissing(t *testing.T) {
296296
err := clearReferencedBytes(pids, 0, 1)
297297
assert.Nil(t, err)
298298
}
299+
300+
var ulimits []info.UlimitSpec
301+
302+
func BenchmarkProcessLimitsFile(b *testing.B) {
303+
content, err := os.ReadFile("testdata/limits")
304+
assert.Nil(b, err)
305+
306+
b.ResetTimer()
307+
for i := 0; i < b.N; i++ {
308+
ulimits = processLimitsFile(string(content))
309+
}
310+
311+
// Ensure the compiler doesn't optimize away the benchmark
312+
_ = ulimits
313+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Limit Soft Limit Hard Limit Units
2+
Max cpu time unlimited unlimited seconds
3+
Max file size unlimited unlimited bytes
4+
Max data size unlimited unlimited bytes
5+
Max stack size 8388608 unlimited bytes
6+
Max core file size unlimited unlimited bytes
7+
Max resident set unlimited unlimited bytes
8+
Max processes 119958 119958 processes
9+
Max open files 1073741816 1073741816 files
10+
Max locked memory 3932852224 3932852224 bytes
11+
Max address space unlimited unlimited bytes
12+
Max file locks unlimited unlimited locks
13+
Max pending signals 119958 119958 signals
14+
Max msgqueue size 819200 819200 bytes
15+
Max nice priority 0 0
16+
Max realtime priority 0 0
17+
Max realtime timeout unlimited unlimited us

0 commit comments

Comments
 (0)