talos/internal/pkg/miniprocfs/miniprocfs.go
Andrey Smirnov 5532867b05
refactor: rewrite the implementation of Processes API
Fixes #4688

Instead of using generic library, build some handcrafted code to
reuse buffers, do partial parsing of the data we need for the processes
API.

Benchmark (it runs with significant number of processes on the host):

```
name                 time/op
PrometheusProcfs-16  3.42ms ± 8%
Processes-16         2.36ms ± 5%

name                 alloc/op
PrometheusProcfs-16   366kB ± 0%
Processes-16          255kB ± 0%

name                 allocs/op
PrometheusProcfs-16   6.76k ± 0%
Processes-16          3.83k ± 0%
```

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-12-17 13:39:08 +03:00

7 lines
307 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package miniprocfs contains optimized small interface to access /proc filesystem.
package miniprocfs