diff options
author | Ben Kochie <superq@gmail.com> | 2019-11-16 18:32:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-16 18:32:15 +0100 |
commit | 8a4c9c154b3c03ecc6578ae561eac9a5055b19b1 (patch) | |
tree | 6bf582e0ae0582f67050645065e5ec08a1bef84a | |
parent | aede04172cbcd072629e0a5f43cd0435e26a28d4 (diff) | |
download | prometheus_node_collector-8a4c9c154b3c03ecc6578ae561eac9a5055b19b1.tar.bz2 prometheus_node_collector-8a4c9c154b3c03ecc6578ae561eac9a5055b19b1.tar.xz prometheus_node_collector-8a4c9c154b3c03ecc6578ae561eac9a5055b19b1.zip |
Bump procfs to v0.0.7 (#1538)
Update Prometheus procfs library to the latest release.
Signed-off-by: Ben Kochie <superq@gmail.com>
25 files changed, 1595 insertions, 171 deletions
@@ -15,12 +15,11 @@ require ( | |||
15 | github.com/prometheus/client_golang v1.0.0 | 15 | github.com/prometheus/client_golang v1.0.0 |
16 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 | 16 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 |
17 | github.com/prometheus/common v0.7.0 | 17 | github.com/prometheus/common v0.7.0 |
18 | github.com/prometheus/procfs v0.0.5 | 18 | github.com/prometheus/procfs v0.0.7 |
19 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 | 19 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 |
20 | github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a | 20 | github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a |
21 | go.uber.org/atomic v1.3.2 // indirect | 21 | go.uber.org/atomic v1.3.2 // indirect |
22 | go.uber.org/multierr v1.1.0 // indirect | 22 | go.uber.org/multierr v1.1.0 // indirect |
23 | golang.org/x/sync v0.0.0-20190423024810-112230192c58 // indirect | ||
24 | golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 | 23 | golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 |
25 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 | 24 | gopkg.in/alecthomas/kingpin.v2 v2.2.6 |
26 | gopkg.in/yaml.v2 v2.2.2 | 25 | gopkg.in/yaml.v2 v2.2.2 |
@@ -35,8 +35,6 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y | |||
35 | github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= | 35 | github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= |
36 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= | 36 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= |
37 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= | 37 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= |
38 | github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= | ||
39 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | ||
40 | github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= | 38 | github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= |
41 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | 39 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= |
42 | github.com/hodgesds/perf-utils v0.0.7 h1:V/5aRKeXn/membOpFdzAgd+fFvmtvTYD6moDuZ7K7SM= | 40 | github.com/hodgesds/perf-utils v0.0.7 h1:V/5aRKeXn/membOpFdzAgd+fFvmtvTYD6moDuZ7K7SM= |
@@ -87,8 +85,8 @@ github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt2 | |||
87 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | 85 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= |
88 | github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= | 86 | github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= |
89 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= | 87 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= |
90 | github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8= | 88 | github.com/prometheus/procfs v0.0.7 h1:RS5GAlMbnkWkhs4+bPocMTmGjYkuCY5djjqEDdXOhcQ= |
91 | github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= | 89 | github.com/prometheus/procfs v0.0.7/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= |
92 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA= | 90 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745 h1:IuH7WumZNax0D+rEqmy2TyhKCzrtMGqbZO0b8rO00JA= |
93 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8= | 91 | github.com/siebenmann/go-kstat v0.0.0-20160321171754-d34789b79745/go.mod h1:G81aIFAMS9ECrwBYR9YxhlPjWgrItd+Kje78O6+uqm8= |
94 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= | 92 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= |
@@ -117,8 +115,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTm | |||
117 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | 115 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
118 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= | 116 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= |
119 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | 117 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
120 | golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= | 118 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= |
121 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | 119 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
122 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | 120 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
123 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | 121 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
124 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= | 122 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
diff --git a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md index 40503ed..943de76 100644 --- a/vendor/github.com/prometheus/procfs/CONTRIBUTING.md +++ b/vendor/github.com/prometheus/procfs/CONTRIBUTING.md | |||
@@ -2,17 +2,120 @@ | |||
2 | 2 | ||
3 | Prometheus uses GitHub to manage reviews of pull requests. | 3 | Prometheus uses GitHub to manage reviews of pull requests. |
4 | 4 | ||
5 | * If you are a new contributor see: [Steps to Contribute](#steps-to-contribute) | ||
6 | |||
5 | * If you have a trivial fix or improvement, go ahead and create a pull request, | 7 | * If you have a trivial fix or improvement, go ahead and create a pull request, |
6 | addressing (with `@...`) the maintainer of this repository (see | 8 | addressing (with `@...`) a suitable maintainer of this repository (see |
7 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. | 9 | [MAINTAINERS.md](MAINTAINERS.md)) in the description of the pull request. |
8 | 10 | ||
9 | * If you plan to do something more involved, first discuss your ideas | 11 | * If you plan to do something more involved, first discuss your ideas |
10 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). | 12 | on our [mailing list](https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers). |
11 | This will avoid unnecessary work and surely give you and us a good deal | 13 | This will avoid unnecessary work and surely give you and us a good deal |
12 | of inspiration. | 14 | of inspiration. Also please see our [non-goals issue](https://github.com/prometheus/docs/issues/149) on areas that the Prometheus community doesn't plan to work on. |
13 | 15 | ||
14 | * Relevant coding style guidelines are the [Go Code Review | 16 | * Relevant coding style guidelines are the [Go Code Review |
15 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) | 17 | Comments](https://code.google.com/p/go-wiki/wiki/CodeReviewComments) |
16 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best | 18 | and the _Formatting and style_ section of Peter Bourgon's [Go: Best |
17 | Practices for Production | 19 | Practices for Production |
18 | Environments](http://peter.bourgon.org/go-in-production/#formatting-and-style). | 20 | Environments](https://peter.bourgon.org/go-in-production/#formatting-and-style). |
21 | |||
22 | * Be sure to sign off on the [DCO](https://github.com/probot/dco#how-it-works) | ||
23 | |||
24 | ## Steps to Contribute | ||
25 | |||
26 | Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue. | ||
27 | |||
28 | Please check the [`help-wanted`](https://github.com/prometheus/procfs/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the maintainers will clarify it. For a quicker response, contact us over [IRC](https://prometheus.io/community). | ||
29 | |||
30 | For quickly compiling and testing your changes do: | ||
31 | ``` | ||
32 | make test # Make sure all the tests pass before you commit and push :) | ||
33 | ``` | ||
34 | |||
35 | We use [`golangci-lint`](https://github.com/golangci/golangci-lint) for linting the code. If it reports an issue and you think that the warning needs to be disregarded or is a false-positive, you can add a special comment `//nolint:linter1[,linter2,...]` before the offending line. Use this sparingly though, fixing the code to comply with the linter's recommendation is in general the preferred course of action. | ||
36 | |||
37 | ## Pull Request Checklist | ||
38 | |||
39 | * Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes. | ||
40 | |||
41 | * Commits should be as small as possible, while ensuring that each commit is correct independently (i.e., each commit should compile and pass tests). | ||
42 | |||
43 | * If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment, or you can ask for a review on IRC channel [#prometheus](https://webchat.freenode.net/?channels=#prometheus) on irc.freenode.net (for the easiest start, [join via Riot](https://riot.im/app/#/room/#prometheus:matrix.org)). | ||
44 | |||
45 | * Add tests relevant to the fixed bug or new feature. | ||
46 | |||
47 | ## Dependency management | ||
48 | |||
49 | The Prometheus project uses [Go modules](https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more) to manage dependencies on external packages. This requires a working Go environment with version 1.12 or greater installed. | ||
50 | |||
51 | All dependencies are vendored in the `vendor/` directory. | ||
52 | |||
53 | To add or update a new dependency, use the `go get` command: | ||
54 | |||
55 | ```bash | ||
56 | # Pick the latest tagged release. | ||
57 | go get example.com/some/module/pkg | ||
58 | |||
59 | # Pick a specific version. | ||
60 | go get example.com/some/module/pkg@vX.Y.Z | ||
61 | ``` | ||
62 | |||
63 | Tidy up the `go.mod` and `go.sum` files and copy the new/updated dependency to the `vendor/` directory: | ||
64 | |||
65 | |||
66 | ```bash | ||
67 | # The GO111MODULE variable can be omitted when the code isn't located in GOPATH. | ||
68 | GO111MODULE=on go mod tidy | ||
69 | |||
70 | GO111MODULE=on go mod vendor | ||
71 | ``` | ||
72 | |||
73 | You have to commit the changes to `go.mod`, `go.sum` and the `vendor/` directory before submitting the pull request. | ||
74 | |||
75 | |||
76 | ## API Implementation Guidelines | ||
77 | |||
78 | ### Naming and Documentation | ||
79 | |||
80 | Public functions and structs should normally be named according to the file(s) being read and parsed. For example, | ||
81 | the `fs.BuddyInfo()` function reads the file `/proc/buddyinfo`. In addition, the godoc for each public function | ||
82 | should contain the path to the file(s) being read and a URL of the linux kernel documentation describing the file(s). | ||
83 | |||
84 | ### Reading vs. Parsing | ||
85 | |||
86 | Most functionality in this library consists of reading files and then parsing the text into structured data. In most | ||
87 | cases reading and parsing should be separated into different functions/methods with a public `fs.Thing()` method and | ||
88 | a private `parseThing(r Reader)` function. This provides a logical separation and allows parsing to be tested | ||
89 | directly without the need to read from the filesystem. Using a `Reader` argument is preferred over other data types | ||
90 | such as `string` or `*File` because it provides the most flexibility regarding the data source. When a set of files | ||
91 | in a directory needs to be parsed, then a `path` string parameter to the parse function can be used instead. | ||
92 | |||
93 | ### /proc and /sys filesystem I/O | ||
94 | |||
95 | The `proc` and `sys` filesystems are pseudo file systems and work a bit differently from standard disk I/O. | ||
96 | Many of the files are changing continuously and the data being read can in some cases change between subsequent | ||
97 | reads in the same file. Also, most of the files are relatively small (less than a few KBs), and system calls | ||
98 | to the `stat` function will often return the wrong size. Therefore, for most files it's recommended to read the | ||
99 | full file in a single operation using an internal utility function called `util.ReadFileNoStat`. | ||
100 | This function is similar to `ioutil.ReadFile`, but it avoids the system call to `stat` to get the current size of | ||
101 | the file. | ||
102 | |||
103 | Note that parsing the file's contents can still be performed one line at a time. This is done by first reading | ||
104 | the full file, and then using a scanner on the `[]byte` or `string` containing the data. | ||
105 | |||
106 | ``` | ||
107 | data, err := util.ReadFileNoStat("/proc/cpuinfo") | ||
108 | if err != nil { | ||
109 | return err | ||
110 | } | ||
111 | reader := bytes.NewReader(data) | ||
112 | scanner := bufio.NewScanner(reader) | ||
113 | ``` | ||
114 | |||
115 | The `/sys` filesystem contains many very small files which contain only a single numeric or text value. These files | ||
116 | can be read using an internal function called `util.SysReadFile` which is similar to `ioutil.ReadFile` but does | ||
117 | not bother to check the size of the file before reading. | ||
118 | ``` | ||
119 | data, err := util.SysReadFile("/sys/class/power_supply/BAT0/capacity") | ||
120 | ``` | ||
121 | |||
diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md index 6f8850f..55d1e32 100644 --- a/vendor/github.com/prometheus/procfs/README.md +++ b/vendor/github.com/prometheus/procfs/README.md | |||
@@ -1,6 +1,6 @@ | |||
1 | # procfs | 1 | # procfs |
2 | 2 | ||
3 | This procfs package provides functions to retrieve system, kernel and process | 3 | This package provides functions to retrieve system, kernel, and process |
4 | metrics from the pseudo-filesystems /proc and /sys. | 4 | metrics from the pseudo-filesystems /proc and /sys. |
5 | 5 | ||
6 | *WARNING*: This package is a work in progress. Its API may still break in | 6 | *WARNING*: This package is a work in progress. Its API may still break in |
@@ -13,7 +13,8 @@ backwards-incompatible ways without warnings. Use it at your own risk. | |||
13 | ## Usage | 13 | ## Usage |
14 | 14 | ||
15 | The procfs library is organized by packages based on whether the gathered data is coming from | 15 | The procfs library is organized by packages based on whether the gathered data is coming from |
16 | /proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc, /sys, or both. For example, current cpu statistics are gathered from | 16 | /proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc, |
17 | /sys, or both. For example, cpu statistics are gathered from | ||
17 | `/proc/stat` and are available via the root procfs package. First, the proc filesystem mount | 18 | `/proc/stat` and are available via the root procfs package. First, the proc filesystem mount |
18 | point is initialized, and then the stat information is read. | 19 | point is initialized, and then the stat information is read. |
19 | 20 | ||
@@ -29,10 +30,17 @@ Some sub-packages such as `blockdevice`, require access to both the proc and sys | |||
29 | stats, err := fs.ProcDiskstats() | 30 | stats, err := fs.ProcDiskstats() |
30 | ``` | 31 | ``` |
31 | 32 | ||
33 | ## Package Organization | ||
34 | |||
35 | The packages in this project are organized according to (1) whether the data comes from the `/proc` or | ||
36 | `/sys` filesystem and (2) the type of information being retrieved. For example, most process information | ||
37 | can be gathered from the functions in the root `procfs` package. Information about block devices such as disk drives | ||
38 | is available in the `blockdevices` sub-package. | ||
39 | |||
32 | ## Building and Testing | 40 | ## Building and Testing |
33 | 41 | ||
34 | The procfs library is normally built as part of another application. However, when making | 42 | The procfs library is intended to be built as part of another application, so there are no distributable binaries. |
35 | changes to the library, the `make test` command can be used to run the API test suite. | 43 | However, most of the API includes unit tests which can be run with `make test`. |
36 | 44 | ||
37 | ### Updating Test Fixtures | 45 | ### Updating Test Fixtures |
38 | 46 | ||
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go index 16491d6..2e02215 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo.go | |||
@@ -16,9 +16,10 @@ package procfs | |||
16 | import ( | 16 | import ( |
17 | "bufio" | 17 | "bufio" |
18 | "bytes" | 18 | "bytes" |
19 | "io/ioutil" | ||
20 | "strconv" | 19 | "strconv" |
21 | "strings" | 20 | "strings" |
21 | |||
22 | "github.com/prometheus/procfs/internal/util" | ||
22 | ) | 23 | ) |
23 | 24 | ||
24 | // CPUInfo contains general information about a system CPU found in /proc/cpuinfo | 25 | // CPUInfo contains general information about a system CPU found in /proc/cpuinfo |
@@ -54,7 +55,7 @@ type CPUInfo struct { | |||
54 | // CPUInfo returns information about current system CPUs. | 55 | // CPUInfo returns information about current system CPUs. |
55 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | 56 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt |
56 | func (fs FS) CPUInfo() ([]CPUInfo, error) { | 57 | func (fs FS) CPUInfo() ([]CPUInfo, error) { |
57 | data, err := ioutil.ReadFile(fs.proc.Path("cpuinfo")) | 58 | data, err := util.ReadFileNoStat(fs.proc.Path("cpuinfo")) |
58 | if err != nil { | 59 | if err != nil { |
59 | return nil, err | 60 | return nil, err |
60 | } | 61 | } |
diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar index 0b29055..38b71fe 100644 --- a/vendor/github.com/prometheus/procfs/fixtures.ttar +++ b/vendor/github.com/prometheus/procfs/fixtures.ttar | |||
@@ -1674,6 +1674,52 @@ md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0] | |||
1674 | unused devices: <none> | 1674 | unused devices: <none> |
1675 | Mode: 644 | 1675 | Mode: 644 |
1676 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1676 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
1677 | Path: fixtures/proc/meminfo | ||
1678 | Lines: 42 | ||
1679 | MemTotal: 15666184 kB | ||
1680 | MemFree: 440324 kB | ||
1681 | Buffers: 1020128 kB | ||
1682 | Cached: 12007640 kB | ||
1683 | SwapCached: 0 kB | ||
1684 | Active: 6761276 kB | ||
1685 | Inactive: 6532708 kB | ||
1686 | Active(anon): 267256 kB | ||
1687 | Inactive(anon): 268 kB | ||
1688 | Active(file): 6494020 kB | ||
1689 | Inactive(file): 6532440 kB | ||
1690 | Unevictable: 0 kB | ||
1691 | Mlocked: 0 kB | ||
1692 | SwapTotal: 0 kB | ||
1693 | SwapFree: 0 kB | ||
1694 | Dirty: 768 kB | ||
1695 | Writeback: 0 kB | ||
1696 | AnonPages: 266216 kB | ||
1697 | Mapped: 44204 kB | ||
1698 | Shmem: 1308 kB | ||
1699 | Slab: 1807264 kB | ||
1700 | SReclaimable: 1738124 kB | ||
1701 | SUnreclaim: 69140 kB | ||
1702 | KernelStack: 1616 kB | ||
1703 | PageTables: 5288 kB | ||
1704 | NFS_Unstable: 0 kB | ||
1705 | Bounce: 0 kB | ||
1706 | WritebackTmp: 0 kB | ||
1707 | CommitLimit: 7833092 kB | ||
1708 | Committed_AS: 530844 kB | ||
1709 | VmallocTotal: 34359738367 kB | ||
1710 | VmallocUsed: 36596 kB | ||
1711 | VmallocChunk: 34359637840 kB | ||
1712 | HardwareCorrupted: 0 kB | ||
1713 | AnonHugePages: 12288 kB | ||
1714 | HugePages_Total: 0 | ||
1715 | HugePages_Free: 0 | ||
1716 | HugePages_Rsvd: 0 | ||
1717 | HugePages_Surp: 0 | ||
1718 | Hugepagesize: 2048 kB | ||
1719 | DirectMap4k: 91136 kB | ||
1720 | DirectMap2M: 16039936 kB | ||
1721 | Mode: 664 | ||
1722 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
1677 | Directory: fixtures/proc/net | 1723 | Directory: fixtures/proc/net |
1678 | Mode: 755 | 1724 | Mode: 755 |
1679 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 1725 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
@@ -2776,6 +2822,134 @@ SymlinkTo: ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00 | |||
2776 | Path: fixtures/sys/class/power_supply/BAT0 | 2822 | Path: fixtures/sys/class/power_supply/BAT0 |
2777 | SymlinkTo: ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 | 2823 | SymlinkTo: ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 |
2778 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 2824 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
2825 | Directory: fixtures/sys/class/powercap | ||
2826 | Mode: 755 | ||
2827 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2828 | Directory: fixtures/sys/class/powercap/intel-rapl | ||
2829 | Mode: 755 | ||
2830 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2831 | Path: fixtures/sys/class/powercap/intel-rapl/enabled | ||
2832 | Lines: 1 | ||
2833 | 1 | ||
2834 | Mode: 644 | ||
2835 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2836 | Path: fixtures/sys/class/powercap/intel-rapl/uevent | ||
2837 | Lines: 0 | ||
2838 | Mode: 644 | ||
2839 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2840 | Directory: fixtures/sys/class/powercap/intel-rapl:0 | ||
2841 | Mode: 755 | ||
2842 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2843 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_max_power_uw | ||
2844 | Lines: 1 | ||
2845 | 95000000 | ||
2846 | Mode: 444 | ||
2847 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2848 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_name | ||
2849 | Lines: 1 | ||
2850 | long_term | ||
2851 | Mode: 444 | ||
2852 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2853 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw | ||
2854 | Lines: 1 | ||
2855 | 4090000000 | ||
2856 | Mode: 644 | ||
2857 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2858 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_0_time_window_us | ||
2859 | Lines: 1 | ||
2860 | 999424 | ||
2861 | Mode: 644 | ||
2862 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2863 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_max_power_uw | ||
2864 | Lines: 1 | ||
2865 | 0 | ||
2866 | Mode: 444 | ||
2867 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2868 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_name | ||
2869 | Lines: 1 | ||
2870 | short_term | ||
2871 | Mode: 444 | ||
2872 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2873 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_power_limit_uw | ||
2874 | Lines: 1 | ||
2875 | 4090000000 | ||
2876 | Mode: 644 | ||
2877 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2878 | Path: fixtures/sys/class/powercap/intel-rapl:0/constraint_1_time_window_us | ||
2879 | Lines: 1 | ||
2880 | 2440 | ||
2881 | Mode: 644 | ||
2882 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2883 | Path: fixtures/sys/class/powercap/intel-rapl:0/enabled | ||
2884 | Lines: 1 | ||
2885 | 1 | ||
2886 | Mode: 644 | ||
2887 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2888 | Path: fixtures/sys/class/powercap/intel-rapl:0/energy_uj | ||
2889 | Lines: 1 | ||
2890 | 240422366267 | ||
2891 | Mode: 444 | ||
2892 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2893 | Path: fixtures/sys/class/powercap/intel-rapl:0/max_energy_range_uj | ||
2894 | Lines: 1 | ||
2895 | 262143328850 | ||
2896 | Mode: 444 | ||
2897 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2898 | Path: fixtures/sys/class/powercap/intel-rapl:0/name | ||
2899 | Lines: 1 | ||
2900 | package-0 | ||
2901 | Mode: 444 | ||
2902 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2903 | Path: fixtures/sys/class/powercap/intel-rapl:0/uevent | ||
2904 | Lines: 0 | ||
2905 | Mode: 644 | ||
2906 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2907 | Directory: fixtures/sys/class/powercap/intel-rapl:0:0 | ||
2908 | Mode: 755 | ||
2909 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2910 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_max_power_uw | ||
2911 | Lines: 0 | ||
2912 | Mode: 444 | ||
2913 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2914 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_name | ||
2915 | Lines: 1 | ||
2916 | long_term | ||
2917 | Mode: 444 | ||
2918 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2919 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_power_limit_uw | ||
2920 | Lines: 1 | ||
2921 | 0 | ||
2922 | Mode: 644 | ||
2923 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2924 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/constraint_0_time_window_us | ||
2925 | Lines: 1 | ||
2926 | 976 | ||
2927 | Mode: 644 | ||
2928 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2929 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/enabled | ||
2930 | Lines: 1 | ||
2931 | 0 | ||
2932 | Mode: 644 | ||
2933 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2934 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/energy_uj | ||
2935 | Lines: 1 | ||
2936 | 118821284256 | ||
2937 | Mode: 444 | ||
2938 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2939 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/max_energy_range_uj | ||
2940 | Lines: 1 | ||
2941 | 262143328850 | ||
2942 | Mode: 444 | ||
2943 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2944 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/name | ||
2945 | Lines: 1 | ||
2946 | core | ||
2947 | Mode: 444 | ||
2948 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2949 | Path: fixtures/sys/class/powercap/intel-rapl:0:0/uevent | ||
2950 | Lines: 0 | ||
2951 | Mode: 644 | ||
2952 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
2779 | Directory: fixtures/sys/class/thermal | 2953 | Directory: fixtures/sys/class/thermal |
2780 | Mode: 775 | 2954 | Mode: 775 |
2781 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 2955 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
@@ -4278,6 +4452,581 @@ Lines: 1 | |||
4278 | 0 | 4452 | 0 |
4279 | Mode: 644 | 4453 | Mode: 644 |
4280 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 4454 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
4455 | Directory: fixtures/sys/fs/btrfs | ||
4456 | Mode: 755 | ||
4457 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4458 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d | ||
4459 | Mode: 755 | ||
4460 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4461 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation | ||
4462 | Mode: 755 | ||
4463 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4464 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data | ||
4465 | Mode: 755 | ||
4466 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4467 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_may_use | ||
4468 | Lines: 1 | ||
4469 | 0 | ||
4470 | Mode: 444 | ||
4471 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4472 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_pinned | ||
4473 | Lines: 1 | ||
4474 | 0 | ||
4475 | Mode: 444 | ||
4476 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4477 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_readonly | ||
4478 | Lines: 1 | ||
4479 | 0 | ||
4480 | Mode: 444 | ||
4481 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4482 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_reserved | ||
4483 | Lines: 1 | ||
4484 | 0 | ||
4485 | Mode: 444 | ||
4486 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4487 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/bytes_used | ||
4488 | Lines: 1 | ||
4489 | 808189952 | ||
4490 | Mode: 444 | ||
4491 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4492 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/disk_total | ||
4493 | Lines: 1 | ||
4494 | 2147483648 | ||
4495 | Mode: 444 | ||
4496 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4497 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/disk_used | ||
4498 | Lines: 1 | ||
4499 | 808189952 | ||
4500 | Mode: 444 | ||
4501 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4502 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/flags | ||
4503 | Lines: 1 | ||
4504 | 1 | ||
4505 | Mode: 444 | ||
4506 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4507 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0 | ||
4508 | Mode: 755 | ||
4509 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4510 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0/total_bytes | ||
4511 | Lines: 1 | ||
4512 | 2147483648 | ||
4513 | Mode: 444 | ||
4514 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4515 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/raid0/used_bytes | ||
4516 | Lines: 1 | ||
4517 | 808189952 | ||
4518 | Mode: 444 | ||
4519 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4520 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/total_bytes | ||
4521 | Lines: 1 | ||
4522 | 2147483648 | ||
4523 | Mode: 444 | ||
4524 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4525 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/data/total_bytes_pinned | ||
4526 | Lines: 1 | ||
4527 | 0 | ||
4528 | Mode: 444 | ||
4529 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4530 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/global_rsv_reserved | ||
4531 | Lines: 1 | ||
4532 | 16777216 | ||
4533 | Mode: 444 | ||
4534 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4535 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/global_rsv_size | ||
4536 | Lines: 1 | ||
4537 | 16777216 | ||
4538 | Mode: 444 | ||
4539 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4540 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata | ||
4541 | Mode: 755 | ||
4542 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4543 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_may_use | ||
4544 | Lines: 1 | ||
4545 | 16777216 | ||
4546 | Mode: 444 | ||
4547 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4548 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_pinned | ||
4549 | Lines: 1 | ||
4550 | 0 | ||
4551 | Mode: 444 | ||
4552 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4553 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_readonly | ||
4554 | Lines: 1 | ||
4555 | 131072 | ||
4556 | Mode: 444 | ||
4557 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4558 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_reserved | ||
4559 | Lines: 1 | ||
4560 | 0 | ||
4561 | Mode: 444 | ||
4562 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4563 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/bytes_used | ||
4564 | Lines: 1 | ||
4565 | 933888 | ||
4566 | Mode: 444 | ||
4567 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4568 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/disk_total | ||
4569 | Lines: 1 | ||
4570 | 2147483648 | ||
4571 | Mode: 444 | ||
4572 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4573 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/disk_used | ||
4574 | Lines: 1 | ||
4575 | 1867776 | ||
4576 | Mode: 444 | ||
4577 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4578 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/flags | ||
4579 | Lines: 1 | ||
4580 | 4 | ||
4581 | Mode: 444 | ||
4582 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4583 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1 | ||
4584 | Mode: 755 | ||
4585 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4586 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1/total_bytes | ||
4587 | Lines: 1 | ||
4588 | 1073741824 | ||
4589 | Mode: 444 | ||
4590 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4591 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/raid1/used_bytes | ||
4592 | Lines: 1 | ||
4593 | 933888 | ||
4594 | Mode: 444 | ||
4595 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4596 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/total_bytes | ||
4597 | Lines: 1 | ||
4598 | 1073741824 | ||
4599 | Mode: 444 | ||
4600 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4601 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/metadata/total_bytes_pinned | ||
4602 | Lines: 1 | ||
4603 | 0 | ||
4604 | Mode: 444 | ||
4605 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4606 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system | ||
4607 | Mode: 755 | ||
4608 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4609 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_may_use | ||
4610 | Lines: 1 | ||
4611 | 0 | ||
4612 | Mode: 444 | ||
4613 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4614 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_pinned | ||
4615 | Lines: 1 | ||
4616 | 0 | ||
4617 | Mode: 444 | ||
4618 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4619 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_readonly | ||
4620 | Lines: 1 | ||
4621 | 0 | ||
4622 | Mode: 444 | ||
4623 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4624 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_reserved | ||
4625 | Lines: 1 | ||
4626 | 0 | ||
4627 | Mode: 444 | ||
4628 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4629 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/bytes_used | ||
4630 | Lines: 1 | ||
4631 | 16384 | ||
4632 | Mode: 444 | ||
4633 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4634 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/disk_total | ||
4635 | Lines: 1 | ||
4636 | 16777216 | ||
4637 | Mode: 444 | ||
4638 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4639 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/disk_used | ||
4640 | Lines: 1 | ||
4641 | 32768 | ||
4642 | Mode: 444 | ||
4643 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4644 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/flags | ||
4645 | Lines: 1 | ||
4646 | 2 | ||
4647 | Mode: 444 | ||
4648 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4649 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1 | ||
4650 | Mode: 755 | ||
4651 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4652 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1/total_bytes | ||
4653 | Lines: 1 | ||
4654 | 8388608 | ||
4655 | Mode: 444 | ||
4656 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4657 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/raid1/used_bytes | ||
4658 | Lines: 1 | ||
4659 | 16384 | ||
4660 | Mode: 444 | ||
4661 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4662 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/total_bytes | ||
4663 | Lines: 1 | ||
4664 | 8388608 | ||
4665 | Mode: 444 | ||
4666 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4667 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/allocation/system/total_bytes_pinned | ||
4668 | Lines: 1 | ||
4669 | 0 | ||
4670 | Mode: 444 | ||
4671 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4672 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/clone_alignment | ||
4673 | Lines: 1 | ||
4674 | 4096 | ||
4675 | Mode: 444 | ||
4676 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4677 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices | ||
4678 | Mode: 755 | ||
4679 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4680 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop25 | ||
4681 | Mode: 755 | ||
4682 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4683 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop25/size | ||
4684 | Lines: 1 | ||
4685 | 20971520 | ||
4686 | Mode: 444 | ||
4687 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4688 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop26 | ||
4689 | Mode: 755 | ||
4690 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4691 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/devices/loop26/size | ||
4692 | Lines: 1 | ||
4693 | 20971520 | ||
4694 | Mode: 444 | ||
4695 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4696 | Directory: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features | ||
4697 | Mode: 755 | ||
4698 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4699 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/big_metadata | ||
4700 | Lines: 1 | ||
4701 | 1 | ||
4702 | Mode: 444 | ||
4703 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4704 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/extended_iref | ||
4705 | Lines: 1 | ||
4706 | 1 | ||
4707 | Mode: 644 | ||
4708 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4709 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/mixed_backref | ||
4710 | Lines: 1 | ||
4711 | 1 | ||
4712 | Mode: 444 | ||
4713 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4714 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/features/skinny_metadata | ||
4715 | Lines: 1 | ||
4716 | 1 | ||
4717 | Mode: 444 | ||
4718 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4719 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/label | ||
4720 | Lines: 1 | ||
4721 | fixture | ||
4722 | Mode: 644 | ||
4723 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4724 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/metadata_uuid | ||
4725 | Lines: 1 | ||
4726 | 0abb23a9-579b-43e6-ad30-227ef47fcb9d | ||
4727 | Mode: 444 | ||
4728 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4729 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/nodesize | ||
4730 | Lines: 1 | ||
4731 | 16384 | ||
4732 | Mode: 444 | ||
4733 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4734 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/quota_override | ||
4735 | Lines: 1 | ||
4736 | 0 | ||
4737 | Mode: 644 | ||
4738 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4739 | Path: fixtures/sys/fs/btrfs/0abb23a9-579b-43e6-ad30-227ef47fcb9d/sectorsize | ||
4740 | Lines: 1 | ||
4741 | 4096 | ||
4742 | Mode: 444 | ||
4743 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4744 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b | ||
4745 | Mode: 755 | ||
4746 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4747 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation | ||
4748 | Mode: 755 | ||
4749 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4750 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data | ||
4751 | Mode: 755 | ||
4752 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4753 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_may_use | ||
4754 | Lines: 1 | ||
4755 | 0 | ||
4756 | Mode: 444 | ||
4757 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4758 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_pinned | ||
4759 | Lines: 1 | ||
4760 | 0 | ||
4761 | Mode: 444 | ||
4762 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4763 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_readonly | ||
4764 | Lines: 1 | ||
4765 | 0 | ||
4766 | Mode: 444 | ||
4767 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4768 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_reserved | ||
4769 | Lines: 1 | ||
4770 | 0 | ||
4771 | Mode: 444 | ||
4772 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4773 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/bytes_used | ||
4774 | Lines: 1 | ||
4775 | 0 | ||
4776 | Mode: 444 | ||
4777 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4778 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/disk_total | ||
4779 | Lines: 1 | ||
4780 | 644087808 | ||
4781 | Mode: 444 | ||
4782 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4783 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/disk_used | ||
4784 | Lines: 1 | ||
4785 | 0 | ||
4786 | Mode: 444 | ||
4787 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4788 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/flags | ||
4789 | Lines: 1 | ||
4790 | 1 | ||
4791 | Mode: 444 | ||
4792 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4793 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5 | ||
4794 | Mode: 755 | ||
4795 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4796 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5/total_bytes | ||
4797 | Lines: 1 | ||
4798 | 644087808 | ||
4799 | Mode: 444 | ||
4800 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4801 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/raid5/used_bytes | ||
4802 | Lines: 1 | ||
4803 | 0 | ||
4804 | Mode: 444 | ||
4805 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4806 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/total_bytes | ||
4807 | Lines: 1 | ||
4808 | 644087808 | ||
4809 | Mode: 444 | ||
4810 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4811 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/data/total_bytes_pinned | ||
4812 | Lines: 1 | ||
4813 | 0 | ||
4814 | Mode: 444 | ||
4815 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4816 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/global_rsv_reserved | ||
4817 | Lines: 1 | ||
4818 | 16777216 | ||
4819 | Mode: 444 | ||
4820 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4821 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/global_rsv_size | ||
4822 | Lines: 1 | ||
4823 | 16777216 | ||
4824 | Mode: 444 | ||
4825 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4826 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata | ||
4827 | Mode: 755 | ||
4828 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4829 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_may_use | ||
4830 | Lines: 1 | ||
4831 | 16777216 | ||
4832 | Mode: 444 | ||
4833 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4834 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_pinned | ||
4835 | Lines: 1 | ||
4836 | 0 | ||
4837 | Mode: 444 | ||
4838 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4839 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_readonly | ||
4840 | Lines: 1 | ||
4841 | 262144 | ||
4842 | Mode: 444 | ||
4843 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4844 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_reserved | ||
4845 | Lines: 1 | ||
4846 | 0 | ||
4847 | Mode: 444 | ||
4848 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4849 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/bytes_used | ||
4850 | Lines: 1 | ||
4851 | 114688 | ||
4852 | Mode: 444 | ||
4853 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4854 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/disk_total | ||
4855 | Lines: 1 | ||
4856 | 429391872 | ||
4857 | Mode: 444 | ||
4858 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4859 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/disk_used | ||
4860 | Lines: 1 | ||
4861 | 114688 | ||
4862 | Mode: 444 | ||
4863 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4864 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/flags | ||
4865 | Lines: 1 | ||
4866 | 4 | ||
4867 | Mode: 444 | ||
4868 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4869 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6 | ||
4870 | Mode: 755 | ||
4871 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4872 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6/total_bytes | ||
4873 | Lines: 1 | ||
4874 | 429391872 | ||
4875 | Mode: 444 | ||
4876 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4877 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/raid6/used_bytes | ||
4878 | Lines: 1 | ||
4879 | 114688 | ||
4880 | Mode: 444 | ||
4881 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4882 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/total_bytes | ||
4883 | Lines: 1 | ||
4884 | 429391872 | ||
4885 | Mode: 444 | ||
4886 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4887 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/metadata/total_bytes_pinned | ||
4888 | Lines: 1 | ||
4889 | 0 | ||
4890 | Mode: 444 | ||
4891 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4892 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system | ||
4893 | Mode: 755 | ||
4894 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4895 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_may_use | ||
4896 | Lines: 1 | ||
4897 | 0 | ||
4898 | Mode: 444 | ||
4899 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4900 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_pinned | ||
4901 | Lines: 1 | ||
4902 | 0 | ||
4903 | Mode: 444 | ||
4904 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4905 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_readonly | ||
4906 | Lines: 1 | ||
4907 | 0 | ||
4908 | Mode: 444 | ||
4909 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4910 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_reserved | ||
4911 | Lines: 1 | ||
4912 | 0 | ||
4913 | Mode: 444 | ||
4914 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4915 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/bytes_used | ||
4916 | Lines: 1 | ||
4917 | 16384 | ||
4918 | Mode: 444 | ||
4919 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4920 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/disk_total | ||
4921 | Lines: 1 | ||
4922 | 16777216 | ||
4923 | Mode: 444 | ||
4924 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4925 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/disk_used | ||
4926 | Lines: 1 | ||
4927 | 16384 | ||
4928 | Mode: 444 | ||
4929 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4930 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/flags | ||
4931 | Lines: 1 | ||
4932 | 2 | ||
4933 | Mode: 444 | ||
4934 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4935 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6 | ||
4936 | Mode: 755 | ||
4937 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4938 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6/total_bytes | ||
4939 | Lines: 1 | ||
4940 | 16777216 | ||
4941 | Mode: 444 | ||
4942 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4943 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/raid6/used_bytes | ||
4944 | Lines: 1 | ||
4945 | 16384 | ||
4946 | Mode: 444 | ||
4947 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4948 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/total_bytes | ||
4949 | Lines: 1 | ||
4950 | 16777216 | ||
4951 | Mode: 444 | ||
4952 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4953 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/allocation/system/total_bytes_pinned | ||
4954 | Lines: 1 | ||
4955 | 0 | ||
4956 | Mode: 444 | ||
4957 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4958 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/clone_alignment | ||
4959 | Lines: 1 | ||
4960 | 4096 | ||
4961 | Mode: 444 | ||
4962 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4963 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices | ||
4964 | Mode: 755 | ||
4965 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4966 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop22 | ||
4967 | SymlinkTo: ../../../../devices/virtual/block/loop22 | ||
4968 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4969 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop23 | ||
4970 | SymlinkTo: ../../../../devices/virtual/block/loop23 | ||
4971 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4972 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop24 | ||
4973 | SymlinkTo: ../../../../devices/virtual/block/loop24 | ||
4974 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4975 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/devices/loop25 | ||
4976 | SymlinkTo: ../../../../devices/virtual/block/loop25 | ||
4977 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4978 | Directory: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features | ||
4979 | Mode: 755 | ||
4980 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4981 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/big_metadata | ||
4982 | Lines: 1 | ||
4983 | 1 | ||
4984 | Mode: 444 | ||
4985 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4986 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/extended_iref | ||
4987 | Lines: 1 | ||
4988 | 1 | ||
4989 | Mode: 644 | ||
4990 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4991 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/mixed_backref | ||
4992 | Lines: 1 | ||
4993 | 1 | ||
4994 | Mode: 444 | ||
4995 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4996 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/raid56 | ||
4997 | Lines: 1 | ||
4998 | 1 | ||
4999 | Mode: 444 | ||
5000 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5001 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/features/skinny_metadata | ||
5002 | Lines: 1 | ||
5003 | 1 | ||
5004 | Mode: 444 | ||
5005 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5006 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/label | ||
5007 | Lines: 0 | ||
5008 | Mode: 644 | ||
5009 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5010 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/metadata_uuid | ||
5011 | Lines: 1 | ||
5012 | 7f07c59f-6136-449c-ab87-e1cf2328731b | ||
5013 | Mode: 444 | ||
5014 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5015 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/nodesize | ||
5016 | Lines: 1 | ||
5017 | 16384 | ||
5018 | Mode: 444 | ||
5019 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5020 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/quota_override | ||
5021 | Lines: 1 | ||
5022 | 0 | ||
5023 | Mode: 644 | ||
5024 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
5025 | Path: fixtures/sys/fs/btrfs/7f07c59f-6136-449c-ab87-e1cf2328731b/sectorsize | ||
5026 | Lines: 1 | ||
5027 | 4096 | ||
5028 | Mode: 444 | ||
5029 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
4281 | Directory: fixtures/sys/fs/xfs | 5030 | Directory: fixtures/sys/fs/xfs |
4282 | Mode: 755 | 5031 | Mode: 755 |
4283 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 5032 | # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
diff --git a/vendor/github.com/prometheus/procfs/go.mod b/vendor/github.com/prometheus/procfs/go.mod index b2f8cca..0e04e5d 100644 --- a/vendor/github.com/prometheus/procfs/go.mod +++ b/vendor/github.com/prometheus/procfs/go.mod | |||
@@ -1,6 +1,8 @@ | |||
1 | module github.com/prometheus/procfs | 1 | module github.com/prometheus/procfs |
2 | 2 | ||
3 | go 1.12 | ||
4 | |||
3 | require ( | 5 | require ( |
4 | github.com/google/go-cmp v0.3.0 | 6 | github.com/google/go-cmp v0.3.1 |
5 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 | 7 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e |
6 | ) | 8 | ) |
diff --git a/vendor/github.com/prometheus/procfs/go.sum b/vendor/github.com/prometheus/procfs/go.sum index db54133..33b824b 100644 --- a/vendor/github.com/prometheus/procfs/go.sum +++ b/vendor/github.com/prometheus/procfs/go.sum | |||
@@ -1,4 +1,4 @@ | |||
1 | github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= | 1 | github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= |
2 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= | 2 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= |
3 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= | 3 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= |
4 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= | 4 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go index 7ddfd6b..565e89e 100644 --- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go +++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go | |||
@@ -26,7 +26,7 @@ const ( | |||
26 | // DefaultSysMountPoint is the common mount point of the sys filesystem. | 26 | // DefaultSysMountPoint is the common mount point of the sys filesystem. |
27 | DefaultSysMountPoint = "/sys" | 27 | DefaultSysMountPoint = "/sys" |
28 | 28 | ||
29 | // DefaultConfigfsMountPoint is the commont mount point of the configfs | 29 | // DefaultConfigfsMountPoint is the common mount point of the configfs |
30 | DefaultConfigfsMountPoint = "/sys/kernel/config" | 30 | DefaultConfigfsMountPoint = "/sys/kernel/config" |
31 | ) | 31 | ) |
32 | 32 | ||
diff --git a/vendor/github.com/prometheus/procfs/internal/util/readfile.go b/vendor/github.com/prometheus/procfs/internal/util/readfile.go new file mode 100644 index 0000000..8051161 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/internal/util/readfile.go | |||
@@ -0,0 +1,38 @@ | |||
1 | // Copyright 2019 The Prometheus Authors | ||
2 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
3 | // you may not use this file except in compliance with the License. | ||
4 | // You may obtain a copy of the License at | ||
5 | // | ||
6 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
7 | // | ||
8 | // Unless required by applicable law or agreed to in writing, software | ||
9 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
11 | // See the License for the specific language governing permissions and | ||
12 | // limitations under the License. | ||
13 | |||
14 | package util | ||
15 | |||
16 | import ( | ||
17 | "io" | ||
18 | "io/ioutil" | ||
19 | "os" | ||
20 | ) | ||
21 | |||
22 | // ReadFileNoStat uses ioutil.ReadAll to read contents of entire file. | ||
23 | // This is similar to ioutil.ReadFile but without the call to os.Stat, because | ||
24 | // many files in /proc and /sys report incorrect file sizes (either 0 or 4096). | ||
25 | // Reads a max file size of 512kB. For files larger than this, a scanner | ||
26 | // should be used. | ||
27 | func ReadFileNoStat(filename string) ([]byte, error) { | ||
28 | const maxBufferSize = 1024 * 512 | ||
29 | |||
30 | f, err := os.Open(filename) | ||
31 | if err != nil { | ||
32 | return nil, err | ||
33 | } | ||
34 | defer f.Close() | ||
35 | |||
36 | reader := io.LimitReader(f, maxBufferSize) | ||
37 | return ioutil.ReadAll(reader) | ||
38 | } | ||
diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go index 68b37c4..c07de0b 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go +++ b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go | |||
@@ -23,6 +23,8 @@ import ( | |||
23 | 23 | ||
24 | // SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. | 24 | // SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly. |
25 | // https://github.com/prometheus/node_exporter/pull/728/files | 25 | // https://github.com/prometheus/node_exporter/pull/728/files |
26 | // | ||
27 | // Note that this function will not read files larger than 128 bytes. | ||
26 | func SysReadFile(file string) (string, error) { | 28 | func SysReadFile(file string) (string, error) { |
27 | f, err := os.Open(file) | 29 | f, err := os.Open(file) |
28 | if err != nil { | 30 | if err != nil { |
@@ -35,7 +37,8 @@ func SysReadFile(file string) (string, error) { | |||
35 | // | 37 | // |
36 | // Since we either want to read data or bail immediately, do the simplest | 38 | // Since we either want to read data or bail immediately, do the simplest |
37 | // possible read using syscall directly. | 39 | // possible read using syscall directly. |
38 | b := make([]byte, 128) | 40 | const sysFileBufferSize = 128 |
41 | b := make([]byte, sysFileBufferSize) | ||
39 | n, err := syscall.Read(int(f.Fd()), b) | 42 | n, err := syscall.Read(int(f.Fd()), b) |
40 | if err != nil { | 43 | if err != nil { |
41 | return "", err | 44 | return "", err |
diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go index 2d6cb8d..89e4477 100644 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ b/vendor/github.com/prometheus/procfs/ipvs.go | |||
@@ -15,6 +15,7 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "bufio" | 17 | "bufio" |
18 | "bytes" | ||
18 | "encoding/hex" | 19 | "encoding/hex" |
19 | "errors" | 20 | "errors" |
20 | "fmt" | 21 | "fmt" |
@@ -24,6 +25,8 @@ import ( | |||
24 | "os" | 25 | "os" |
25 | "strconv" | 26 | "strconv" |
26 | "strings" | 27 | "strings" |
28 | |||
29 | "github.com/prometheus/procfs/internal/util" | ||
27 | ) | 30 | ) |
28 | 31 | ||
29 | // IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`. | 32 | // IPVSStats holds IPVS statistics, as exposed by the kernel in `/proc/net/ip_vs_stats`. |
@@ -64,17 +67,16 @@ type IPVSBackendStatus struct { | |||
64 | 67 | ||
65 | // IPVSStats reads the IPVS statistics from the specified `proc` filesystem. | 68 | // IPVSStats reads the IPVS statistics from the specified `proc` filesystem. |
66 | func (fs FS) IPVSStats() (IPVSStats, error) { | 69 | func (fs FS) IPVSStats() (IPVSStats, error) { |
67 | file, err := os.Open(fs.proc.Path("net/ip_vs_stats")) | 70 | data, err := util.ReadFileNoStat(fs.proc.Path("net/ip_vs_stats")) |
68 | if err != nil { | 71 | if err != nil { |
69 | return IPVSStats{}, err | 72 | return IPVSStats{}, err |
70 | } | 73 | } |
71 | defer file.Close() | ||
72 | 74 | ||
73 | return parseIPVSStats(file) | 75 | return parseIPVSStats(bytes.NewReader(data)) |
74 | } | 76 | } |
75 | 77 | ||
76 | // parseIPVSStats performs the actual parsing of `ip_vs_stats`. | 78 | // parseIPVSStats performs the actual parsing of `ip_vs_stats`. |
77 | func parseIPVSStats(file io.Reader) (IPVSStats, error) { | 79 | func parseIPVSStats(r io.Reader) (IPVSStats, error) { |
78 | var ( | 80 | var ( |
79 | statContent []byte | 81 | statContent []byte |
80 | statLines []string | 82 | statLines []string |
@@ -82,7 +84,7 @@ func parseIPVSStats(file io.Reader) (IPVSStats, error) { | |||
82 | stats IPVSStats | 84 | stats IPVSStats |
83 | ) | 85 | ) |
84 | 86 | ||
85 | statContent, err := ioutil.ReadAll(file) | 87 | statContent, err := ioutil.ReadAll(r) |
86 | if err != nil { | 88 | if err != nil { |
87 | return IPVSStats{}, err | 89 | return IPVSStats{}, err |
88 | } | 90 | } |
diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go new file mode 100644 index 0000000..dd630c0 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/meminfo.go | |||
@@ -0,0 +1,453 @@ | |||
1 | // Copyright 2019 The Prometheus Authors | ||
2 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
3 | // you may not use this file except in compliance with the License. | ||
4 | // You may obtain a copy of the License at | ||
5 | // | ||
6 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
7 | // | ||
8 | // Unless required by applicable law or agreed to in writing, software | ||
9 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
11 | // See the License for the specific language governing permissions and | ||
12 | // limitations under the License. | ||
13 | |||
14 | package procfs | ||
15 | |||
16 | import ( | ||
17 | "bufio" | ||
18 | "bytes" | ||
19 | "strconv" | ||
20 | "strings" | ||
21 | |||
22 | "github.com/prometheus/procfs/internal/util" | ||
23 | ) | ||
24 | |||
25 | // Meminfo represents memory statistics. | ||
26 | type Meminfo struct { | ||
27 | // Total usable ram (i.e. physical ram minus a few reserved | ||
28 | // bits and the kernel binary code) | ||
29 | MemTotal uint64 | ||
30 | // The sum of LowFree+HighFree | ||
31 | MemFree uint64 | ||
32 | // An estimate of how much memory is available for starting | ||
33 | // new applications, without swapping. Calculated from | ||
34 | // MemFree, SReclaimable, the size of the file LRU lists, and | ||
35 | // the low watermarks in each zone. The estimate takes into | ||
36 | // account that the system needs some page cache to function | ||
37 | // well, and that not all reclaimable slab will be | ||
38 | // reclaimable, due to items being in use. The impact of those | ||
39 | // factors will vary from system to system. | ||
40 | MemAvailable uint64 | ||
41 | // Relatively temporary storage for raw disk blocks shouldn't | ||
42 | // get tremendously large (20MB or so) | ||
43 | Buffers uint64 | ||
44 | Cached uint64 | ||
45 | // Memory that once was swapped out, is swapped back in but | ||
46 | // still also is in the swapfile (if memory is needed it | ||
47 | // doesn't need to be swapped out AGAIN because it is already | ||
48 | // in the swapfile. This saves I/O) | ||
49 | SwapCached uint64 | ||
50 | // Memory that has been used more recently and usually not | ||
51 | // reclaimed unless absolutely necessary. | ||
52 | Active uint64 | ||
53 | // Memory which has been less recently used. It is more | ||
54 | // eligible to be reclaimed for other purposes | ||
55 | Inactive uint64 | ||
56 | ActiveAnon uint64 | ||
57 | InactiveAnon uint64 | ||
58 | ActiveFile uint64 | ||
59 | InactiveFile uint64 | ||
60 | Unevictable uint64 | ||
61 | Mlocked uint64 | ||
62 | // total amount of swap space available | ||
63 | SwapTotal uint64 | ||
64 | // Memory which has been evicted from RAM, and is temporarily | ||
65 | // on the disk | ||
66 | SwapFree uint64 | ||
67 | // Memory which is waiting to get written back to the disk | ||
68 | Dirty uint64 | ||
69 | // Memory which is actively being written back to the disk | ||
70 | Writeback uint64 | ||
71 | // Non-file backed pages mapped into userspace page tables | ||
72 | AnonPages uint64 | ||
73 | // files which have been mapped, such as libraries | ||
74 | Mapped uint64 | ||
75 | Shmem uint64 | ||
76 | // in-kernel data structures cache | ||
77 | Slab uint64 | ||
78 | // Part of Slab, that might be reclaimed, such as caches | ||
79 | SReclaimable uint64 | ||
80 | // Part of Slab, that cannot be reclaimed on memory pressure | ||
81 | SUnreclaim uint64 | ||
82 | KernelStack uint64 | ||
83 | // amount of memory dedicated to the lowest level of page | ||
84 | // tables. | ||
85 | PageTables uint64 | ||
86 | // NFS pages sent to the server, but not yet committed to | ||
87 | // stable storage | ||
88 | NFSUnstable uint64 | ||
89 | // Memory used for block device "bounce buffers" | ||
90 | Bounce uint64 | ||
91 | // Memory used by FUSE for temporary writeback buffers | ||
92 | WritebackTmp uint64 | ||
93 | // Based on the overcommit ratio ('vm.overcommit_ratio'), | ||
94 | // this is the total amount of memory currently available to | ||
95 | // be allocated on the system. This limit is only adhered to | ||
96 | // if strict overcommit accounting is enabled (mode 2 in | ||
97 | // 'vm.overcommit_memory'). | ||
98 | // The CommitLimit is calculated with the following formula: | ||
99 | // CommitLimit = ([total RAM pages] - [total huge TLB pages]) * | ||
100 | // overcommit_ratio / 100 + [total swap pages] | ||
101 | // For example, on a system with 1G of physical RAM and 7G | ||
102 | // of swap with a `vm.overcommit_ratio` of 30 it would | ||
103 | // yield a CommitLimit of 7.3G. | ||
104 | // For more details, see the memory overcommit documentation | ||
105 | // in vm/overcommit-accounting. | ||
106 | CommitLimit uint64 | ||
107 | // The amount of memory presently allocated on the system. | ||
108 | // The committed memory is a sum of all of the memory which | ||
109 | // has been allocated by processes, even if it has not been | ||
110 | // "used" by them as of yet. A process which malloc()'s 1G | ||
111 | // of memory, but only touches 300M of it will show up as | ||
112 | // using 1G. This 1G is memory which has been "committed" to | ||
113 | // by the VM and can be used at any time by the allocating | ||
114 | // application. With strict overcommit enabled on the system | ||
115 | // (mode 2 in 'vm.overcommit_memory'),allocations which would | ||
116 | // exceed the CommitLimit (detailed above) will not be permitted. | ||
117 | // This is useful if one needs to guarantee that processes will | ||
118 | // not fail due to lack of memory once that memory has been | ||
119 | // successfully allocated. | ||
120 | CommittedAS uint64 | ||
121 | // total size of vmalloc memory area | ||
122 | VmallocTotal uint64 | ||
123 | // amount of vmalloc area which is used | ||
124 | VmallocUsed uint64 | ||
125 | // largest contiguous block of vmalloc area which is free | ||
126 | VmallocChunk uint64 | ||
127 | HardwareCorrupted uint64 | ||
128 | AnonHugePages uint64 | ||
129 | ShmemHugePages uint64 | ||
130 | ShmemPmdMapped uint64 | ||
131 | CmaTotal uint64 | ||
132 | CmaFree uint64 | ||
133 | HugePagesTotal uint64 | ||
134 | HugePagesFree uint64 | ||
135 | HugePagesRsvd uint64 | ||
136 | HugePagesSurp uint64 | ||
137 | Hugepagesize uint64 | ||
138 | DirectMap4k uint64 | ||
139 | DirectMap2M uint64 | ||
140 | DirectMap1G uint64 | ||
141 | } | ||
142 | |||
143 | // Meminfo returns an information about current kernel/system memory statistics. | ||
144 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | ||
145 | func (fs FS) Meminfo() (Meminfo, error) { | ||
146 | data, err := util.ReadFileNoStat(fs.proc.Path("meminfo")) | ||
147 | if err != nil { | ||
148 | return Meminfo{}, err | ||
149 | } | ||
150 | return parseMemInfo(data) | ||
151 | } | ||
152 | |||
153 | func parseMemInfo(info []byte) (m Meminfo, err error) { | ||
154 | scanner := bufio.NewScanner(bytes.NewReader(info)) | ||
155 | |||
156 | var line string | ||
157 | for scanner.Scan() { | ||
158 | line = scanner.Text() | ||
159 | |||
160 | field := strings.Fields(line) | ||
161 | switch field[0] { | ||
162 | case "MemTotal:": | ||
163 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
164 | if err != nil { | ||
165 | return Meminfo{}, err | ||
166 | } | ||
167 | m.MemTotal = v | ||
168 | case "MemFree:": | ||
169 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
170 | if err != nil { | ||
171 | return Meminfo{}, err | ||
172 | } | ||
173 | m.MemFree = v | ||
174 | case "MemAvailable:": | ||
175 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
176 | if err != nil { | ||
177 | return Meminfo{}, err | ||
178 | } | ||
179 | m.MemAvailable = v | ||
180 | case "Buffers:": | ||
181 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
182 | if err != nil { | ||
183 | return Meminfo{}, err | ||
184 | } | ||
185 | m.Buffers = v | ||
186 | case "Cached:": | ||
187 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
188 | if err != nil { | ||
189 | return Meminfo{}, err | ||
190 | } | ||
191 | m.Cached = v | ||
192 | case "SwapCached:": | ||
193 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
194 | if err != nil { | ||
195 | return Meminfo{}, err | ||
196 | } | ||
197 | m.SwapCached = v | ||
198 | case "Active:": | ||
199 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
200 | if err != nil { | ||
201 | return Meminfo{}, err | ||
202 | } | ||
203 | m.Active = v | ||
204 | case "Inactive:": | ||
205 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
206 | if err != nil { | ||
207 | return Meminfo{}, err | ||
208 | } | ||
209 | m.Inactive = v | ||
210 | case "Active(anon):": | ||
211 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
212 | if err != nil { | ||
213 | return Meminfo{}, err | ||
214 | } | ||
215 | m.ActiveAnon = v | ||
216 | case "Inactive(anon):": | ||
217 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
218 | if err != nil { | ||
219 | return Meminfo{}, err | ||
220 | } | ||
221 | m.InactiveAnon = v | ||
222 | case "Active(file):": | ||
223 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
224 | if err != nil { | ||
225 | return Meminfo{}, err | ||
226 | } | ||
227 | m.ActiveFile = v | ||
228 | case "Inactive(file):": | ||
229 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
230 | if err != nil { | ||
231 | return Meminfo{}, err | ||
232 | } | ||
233 | m.InactiveFile = v | ||
234 | case "Unevictable:": | ||
235 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
236 | if err != nil { | ||
237 | return Meminfo{}, err | ||
238 | } | ||
239 | m.Unevictable = v | ||
240 | case "Mlocked:": | ||
241 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
242 | if err != nil { | ||
243 | return Meminfo{}, err | ||
244 | } | ||
245 | m.Mlocked = v | ||
246 | case "SwapTotal:": | ||
247 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
248 | if err != nil { | ||
249 | return Meminfo{}, err | ||
250 | } | ||
251 | m.SwapTotal = v | ||
252 | case "SwapFree:": | ||
253 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
254 | if err != nil { | ||
255 | return Meminfo{}, err | ||
256 | } | ||
257 | m.SwapFree = v | ||
258 | case "Dirty:": | ||
259 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
260 | if err != nil { | ||
261 | return Meminfo{}, err | ||
262 | } | ||
263 | m.Dirty = v | ||
264 | case "Writeback:": | ||
265 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
266 | if err != nil { | ||
267 | return Meminfo{}, err | ||
268 | } | ||
269 | m.Writeback = v | ||
270 | case "AnonPages:": | ||
271 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
272 | if err != nil { | ||
273 | return Meminfo{}, err | ||
274 | } | ||
275 | m.AnonPages = v | ||
276 | case "Mapped:": | ||
277 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
278 | if err != nil { | ||
279 | return Meminfo{}, err | ||
280 | } | ||
281 | m.Mapped = v | ||
282 | case "Shmem:": | ||
283 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
284 | if err != nil { | ||
285 | return Meminfo{}, err | ||
286 | } | ||
287 | m.Shmem = v | ||
288 | case "Slab:": | ||
289 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
290 | if err != nil { | ||
291 | return Meminfo{}, err | ||
292 | } | ||
293 | m.Slab = v | ||
294 | case "SReclaimable:": | ||
295 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
296 | if err != nil { | ||
297 | return Meminfo{}, err | ||
298 | } | ||
299 | m.SReclaimable = v | ||
300 | case "SUnreclaim:": | ||
301 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
302 | if err != nil { | ||
303 | return Meminfo{}, err | ||
304 | } | ||
305 | m.SUnreclaim = v | ||
306 | case "KernelStack:": | ||
307 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
308 | if err != nil { | ||
309 | return Meminfo{}, err | ||
310 | } | ||
311 | m.KernelStack = v | ||
312 | case "PageTables:": | ||
313 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
314 | if err != nil { | ||
315 | return Meminfo{}, err | ||
316 | } | ||
317 | m.PageTables = v | ||
318 | case "NFS_Unstable:": | ||
319 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
320 | if err != nil { | ||
321 | return Meminfo{}, err | ||
322 | } | ||
323 | m.NFSUnstable = v | ||
324 | case "Bounce:": | ||
325 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
326 | if err != nil { | ||
327 | return Meminfo{}, err | ||
328 | } | ||
329 | m.Bounce = v | ||
330 | case "WritebackTmp:": | ||
331 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
332 | if err != nil { | ||
333 | return Meminfo{}, err | ||
334 | } | ||
335 | m.WritebackTmp = v | ||
336 | case "CommitLimit:": | ||
337 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
338 | if err != nil { | ||
339 | return Meminfo{}, err | ||
340 | } | ||
341 | m.CommitLimit = v | ||
342 | case "Committed_AS:": | ||
343 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
344 | if err != nil { | ||
345 | return Meminfo{}, err | ||
346 | } | ||
347 | m.CommittedAS = v | ||
348 | case "VmallocTotal:": | ||
349 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
350 | if err != nil { | ||
351 | return Meminfo{}, err | ||
352 | } | ||
353 | m.VmallocTotal = v | ||
354 | case "VmallocUsed:": | ||
355 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
356 | if err != nil { | ||
357 | return Meminfo{}, err | ||
358 | } | ||
359 | m.VmallocUsed = v | ||
360 | case "VmallocChunk:": | ||
361 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
362 | if err != nil { | ||
363 | return Meminfo{}, err | ||
364 | } | ||
365 | m.VmallocChunk = v | ||
366 | case "HardwareCorrupted:": | ||
367 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
368 | if err != nil { | ||
369 | return Meminfo{}, err | ||
370 | } | ||
371 | m.HardwareCorrupted = v | ||
372 | case "AnonHugePages:": | ||
373 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
374 | if err != nil { | ||
375 | return Meminfo{}, err | ||
376 | } | ||
377 | m.AnonHugePages = v | ||
378 | case "ShmemHugePages:": | ||
379 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
380 | if err != nil { | ||
381 | return Meminfo{}, err | ||
382 | } | ||
383 | m.ShmemHugePages = v | ||
384 | case "ShmemPmdMapped:": | ||
385 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
386 | if err != nil { | ||
387 | return Meminfo{}, err | ||
388 | } | ||
389 | m.ShmemPmdMapped = v | ||
390 | case "CmaTotal:": | ||
391 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
392 | if err != nil { | ||
393 | return Meminfo{}, err | ||
394 | } | ||
395 | m.CmaTotal = v | ||
396 | case "CmaFree:": | ||
397 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
398 | if err != nil { | ||
399 | return Meminfo{}, err | ||
400 | } | ||
401 | m.CmaFree = v | ||
402 | case "HugePages_Total:": | ||
403 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
404 | if err != nil { | ||
405 | return Meminfo{}, err | ||
406 | } | ||
407 | m.HugePagesTotal = v | ||
408 | case "HugePages_Free:": | ||
409 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
410 | if err != nil { | ||
411 | return Meminfo{}, err | ||
412 | } | ||
413 | m.HugePagesFree = v | ||
414 | case "HugePages_Rsvd:": | ||
415 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
416 | if err != nil { | ||
417 | return Meminfo{}, err | ||
418 | } | ||
419 | m.HugePagesRsvd = v | ||
420 | case "HugePages_Surp:": | ||
421 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
422 | if err != nil { | ||
423 | return Meminfo{}, err | ||
424 | } | ||
425 | m.HugePagesSurp = v | ||
426 | case "Hugepagesize:": | ||
427 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
428 | if err != nil { | ||
429 | return Meminfo{}, err | ||
430 | } | ||
431 | m.Hugepagesize = v | ||
432 | case "DirectMap4k:": | ||
433 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
434 | if err != nil { | ||
435 | return Meminfo{}, err | ||
436 | } | ||
437 | m.DirectMap4k = v | ||
438 | case "DirectMap2M:": | ||
439 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
440 | if err != nil { | ||
441 | return Meminfo{}, err | ||
442 | } | ||
443 | m.DirectMap2M = v | ||
444 | case "DirectMap1G:": | ||
445 | v, err := strconv.ParseUint(field[1], 0, 64) | ||
446 | if err != nil { | ||
447 | return Meminfo{}, err | ||
448 | } | ||
449 | m.DirectMap1G = v | ||
450 | } | ||
451 | } | ||
452 | return m, nil | ||
453 | } | ||
diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go index 61fa618..bb01bb5 100644 --- a/vendor/github.com/prometheus/procfs/mountinfo.go +++ b/vendor/github.com/prometheus/procfs/mountinfo.go | |||
@@ -15,19 +15,13 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "bufio" | 17 | "bufio" |
18 | "bytes" | ||
18 | "fmt" | 19 | "fmt" |
19 | "io" | ||
20 | "os" | ||
21 | "strconv" | 20 | "strconv" |
22 | "strings" | 21 | "strings" |
23 | ) | ||
24 | 22 | ||
25 | var validOptionalFields = map[string]bool{ | 23 | "github.com/prometheus/procfs/internal/util" |
26 | "shared": true, | 24 | ) |
27 | "master": true, | ||
28 | "propagate_from": true, | ||
29 | "unbindable": true, | ||
30 | } | ||
31 | 25 | ||
32 | // A MountInfo is a type that describes the details, options | 26 | // A MountInfo is a type that describes the details, options |
33 | // for each mount, parsed from /proc/self/mountinfo. | 27 | // for each mount, parsed from /proc/self/mountinfo. |
@@ -58,18 +52,10 @@ type MountInfo struct { | |||
58 | SuperOptions map[string]string | 52 | SuperOptions map[string]string |
59 | } | 53 | } |
60 | 54 | ||
61 | // Returns part of the mountinfo line, if it exists, else an empty string. | ||
62 | func getStringSliceElement(parts []string, idx int, defaultValue string) string { | ||
63 | if idx >= len(parts) { | ||
64 | return defaultValue | ||
65 | } | ||
66 | return parts[idx] | ||
67 | } | ||
68 | |||
69 | // Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs. | 55 | // Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs. |
70 | func parseMountInfo(r io.Reader) ([]*MountInfo, error) { | 56 | func parseMountInfo(info []byte) ([]*MountInfo, error) { |
71 | mounts := []*MountInfo{} | 57 | mounts := []*MountInfo{} |
72 | scanner := bufio.NewScanner(r) | 58 | scanner := bufio.NewScanner(bytes.NewReader(info)) |
73 | for scanner.Scan() { | 59 | for scanner.Scan() { |
74 | mountString := scanner.Text() | 60 | mountString := scanner.Text() |
75 | parsedMounts, err := parseMountInfoString(mountString) | 61 | parsedMounts, err := parseMountInfoString(mountString) |
@@ -89,57 +75,75 @@ func parseMountInfo(r io.Reader) ([]*MountInfo, error) { | |||
89 | func parseMountInfoString(mountString string) (*MountInfo, error) { | 75 | func parseMountInfoString(mountString string) (*MountInfo, error) { |
90 | var err error | 76 | var err error |
91 | 77 | ||
92 | // OptionalFields can be zero, hence these checks to ensure we do not populate the wrong values in the wrong spots | 78 | mountInfo := strings.Split(mountString, " ") |
93 | separatorIndex := strings.Index(mountString, "-") | 79 | mountInfoLength := len(mountInfo) |
94 | if separatorIndex == -1 { | 80 | if mountInfoLength < 11 { |
95 | return nil, fmt.Errorf("no separator found in mountinfo string: %s", mountString) | 81 | return nil, fmt.Errorf("couldn't find enough fields in mount string: %s", mountString) |
96 | } | 82 | } |
97 | beforeFields := strings.Fields(mountString[:separatorIndex]) | 83 | |
98 | afterFields := strings.Fields(mountString[separatorIndex+1:]) | 84 | if mountInfo[mountInfoLength-4] != "-" { |
99 | if (len(beforeFields) + len(afterFields)) < 7 { | 85 | return nil, fmt.Errorf("couldn't find separator in expected field: %s", mountInfo[mountInfoLength-4]) |
100 | return nil, fmt.Errorf("too few fields") | ||
101 | } | 86 | } |
102 | 87 | ||
103 | mount := &MountInfo{ | 88 | mount := &MountInfo{ |
104 | MajorMinorVer: getStringSliceElement(beforeFields, 2, ""), | 89 | MajorMinorVer: mountInfo[2], |
105 | Root: getStringSliceElement(beforeFields, 3, ""), | 90 | Root: mountInfo[3], |
106 | MountPoint: getStringSliceElement(beforeFields, 4, ""), | 91 | MountPoint: mountInfo[4], |
107 | Options: mountOptionsParser(getStringSliceElement(beforeFields, 5, "")), | 92 | Options: mountOptionsParser(mountInfo[5]), |
108 | OptionalFields: nil, | 93 | OptionalFields: nil, |
109 | FSType: getStringSliceElement(afterFields, 0, ""), | 94 | FSType: mountInfo[mountInfoLength-3], |
110 | Source: getStringSliceElement(afterFields, 1, ""), | 95 | Source: mountInfo[mountInfoLength-2], |
111 | SuperOptions: mountOptionsParser(getStringSliceElement(afterFields, 2, "")), | 96 | SuperOptions: mountOptionsParser(mountInfo[mountInfoLength-1]), |
112 | } | 97 | } |
113 | 98 | ||
114 | mount.MountId, err = strconv.Atoi(getStringSliceElement(beforeFields, 0, "")) | 99 | mount.MountId, err = strconv.Atoi(mountInfo[0]) |
115 | if err != nil { | 100 | if err != nil { |
116 | return nil, fmt.Errorf("failed to parse mount ID") | 101 | return nil, fmt.Errorf("failed to parse mount ID") |
117 | } | 102 | } |
118 | mount.ParentId, err = strconv.Atoi(getStringSliceElement(beforeFields, 1, "")) | 103 | mount.ParentId, err = strconv.Atoi(mountInfo[1]) |
119 | if err != nil { | 104 | if err != nil { |
120 | return nil, fmt.Errorf("failed to parse parent ID") | 105 | return nil, fmt.Errorf("failed to parse parent ID") |
121 | } | 106 | } |
122 | // Has optional fields, which is a space separated list of values. | 107 | // Has optional fields, which is a space separated list of values. |
123 | // Example: shared:2 master:7 | 108 | // Example: shared:2 master:7 |
124 | if len(beforeFields) > 6 { | 109 | if mountInfo[6] != "" { |
125 | mount.OptionalFields = make(map[string]string) | 110 | mount.OptionalFields, err = mountOptionsParseOptionalFields(mountInfo[6 : mountInfoLength-4]) |
126 | optionalFields := beforeFields[6:] | 111 | if err != nil { |
127 | for _, field := range optionalFields { | 112 | return nil, err |
128 | optionSplit := strings.Split(field, ":") | ||
129 | target, value := optionSplit[0], "" | ||
130 | if len(optionSplit) == 2 { | ||
131 | value = optionSplit[1] | ||
132 | } | ||
133 | // Checks if the 'keys' in the optional fields in the mountinfo line are acceptable. | ||
134 | // Allowed 'keys' are shared, master, propagate_from, unbindable. | ||
135 | if _, ok := validOptionalFields[target]; ok { | ||
136 | mount.OptionalFields[target] = value | ||
137 | } | ||
138 | } | 113 | } |
139 | } | 114 | } |
140 | return mount, nil | 115 | return mount, nil |
141 | } | 116 | } |
142 | 117 | ||
118 | // mountOptionsIsValidField checks a string against a valid list of optional fields keys. | ||
119 | func mountOptionsIsValidField(s string) bool { | ||
120 | switch s { | ||
121 | case | ||
122 | "shared", | ||
123 | "master", | ||
124 | "propagate_from", | ||
125 | "unbindable": | ||
126 | return true | ||
127 | } | ||
128 | return false | ||
129 | } | ||
130 | |||
131 | // mountOptionsParseOptionalFields parses a list of optional fields strings into a double map of strings. | ||
132 | func mountOptionsParseOptionalFields(o []string) (map[string]string, error) { | ||
133 | optionalFields := make(map[string]string) | ||
134 | for _, field := range o { | ||
135 | optionSplit := strings.SplitN(field, ":", 2) | ||
136 | value := "" | ||
137 | if len(optionSplit) == 2 { | ||
138 | value = optionSplit[1] | ||
139 | } | ||
140 | if mountOptionsIsValidField(optionSplit[0]) { | ||
141 | optionalFields[optionSplit[0]] = value | ||
142 | } | ||
143 | } | ||
144 | return optionalFields, nil | ||
145 | } | ||
146 | |||
143 | // Parses the mount options, superblock options. | 147 | // Parses the mount options, superblock options. |
144 | func mountOptionsParser(mountOptions string) map[string]string { | 148 | func mountOptionsParser(mountOptions string) map[string]string { |
145 | opts := make(map[string]string) | 149 | opts := make(map[string]string) |
@@ -159,20 +163,18 @@ func mountOptionsParser(mountOptions string) map[string]string { | |||
159 | 163 | ||
160 | // Retrieves mountinfo information from `/proc/self/mountinfo`. | 164 | // Retrieves mountinfo information from `/proc/self/mountinfo`. |
161 | func GetMounts() ([]*MountInfo, error) { | 165 | func GetMounts() ([]*MountInfo, error) { |
162 | f, err := os.Open("/proc/self/mountinfo") | 166 | data, err := util.ReadFileNoStat("/proc/self/mountinfo") |
163 | if err != nil { | 167 | if err != nil { |
164 | return nil, err | 168 | return nil, err |
165 | } | 169 | } |
166 | defer f.Close() | 170 | return parseMountInfo(data) |
167 | return parseMountInfo(f) | ||
168 | } | 171 | } |
169 | 172 | ||
170 | // Retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`. | 173 | // Retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`. |
171 | func GetProcMounts(pid int) ([]*MountInfo, error) { | 174 | func GetProcMounts(pid int) ([]*MountInfo, error) { |
172 | f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid)) | 175 | data, err := util.ReadFileNoStat(fmt.Sprintf("/proc/%d/mountinfo", pid)) |
173 | if err != nil { | 176 | if err != nil { |
174 | return nil, err | 177 | return nil, err |
175 | } | 178 | } |
176 | defer f.Close() | 179 | return parseMountInfo(data) |
177 | return parseMountInfo(f) | ||
178 | } | 180 | } |
diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go index a0b7a01..47a710b 100644 --- a/vendor/github.com/prometheus/procfs/net_dev.go +++ b/vendor/github.com/prometheus/procfs/net_dev.go | |||
@@ -183,7 +183,6 @@ func (netDev NetDev) Total() NetDevLine { | |||
183 | names = append(names, ifc.Name) | 183 | names = append(names, ifc.Name) |
184 | total.RxBytes += ifc.RxBytes | 184 | total.RxBytes += ifc.RxBytes |
185 | total.RxPackets += ifc.RxPackets | 185 | total.RxPackets += ifc.RxPackets |
186 | total.RxPackets += ifc.RxPackets | ||
187 | total.RxErrors += ifc.RxErrors | 186 | total.RxErrors += ifc.RxErrors |
188 | total.RxDropped += ifc.RxDropped | 187 | total.RxDropped += ifc.RxDropped |
189 | total.RxFIFO += ifc.RxFIFO | 188 | total.RxFIFO += ifc.RxFIFO |
diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index b7c79cf..330e472 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go | |||
@@ -22,6 +22,7 @@ import ( | |||
22 | "strings" | 22 | "strings" |
23 | 23 | ||
24 | "github.com/prometheus/procfs/internal/fs" | 24 | "github.com/prometheus/procfs/internal/fs" |
25 | "github.com/prometheus/procfs/internal/util" | ||
25 | ) | 26 | ) |
26 | 27 | ||
27 | // Proc provides information about a running process. | 28 | // Proc provides information about a running process. |
@@ -121,13 +122,7 @@ func (fs FS) AllProcs() (Procs, error) { | |||
121 | 122 | ||
122 | // CmdLine returns the command line of a process. | 123 | // CmdLine returns the command line of a process. |
123 | func (p Proc) CmdLine() ([]string, error) { | 124 | func (p Proc) CmdLine() ([]string, error) { |
124 | f, err := os.Open(p.path("cmdline")) | 125 | data, err := util.ReadFileNoStat(p.path("cmdline")) |
125 | if err != nil { | ||
126 | return nil, err | ||
127 | } | ||
128 | defer f.Close() | ||
129 | |||
130 | data, err := ioutil.ReadAll(f) | ||
131 | if err != nil { | 126 | if err != nil { |
132 | return nil, err | 127 | return nil, err |
133 | } | 128 | } |
@@ -141,13 +136,7 @@ func (p Proc) CmdLine() ([]string, error) { | |||
141 | 136 | ||
142 | // Comm returns the command name of a process. | 137 | // Comm returns the command name of a process. |
143 | func (p Proc) Comm() (string, error) { | 138 | func (p Proc) Comm() (string, error) { |
144 | f, err := os.Open(p.path("comm")) | 139 | data, err := util.ReadFileNoStat(p.path("comm")) |
145 | if err != nil { | ||
146 | return "", err | ||
147 | } | ||
148 | defer f.Close() | ||
149 | |||
150 | data, err := ioutil.ReadAll(f) | ||
151 | if err != nil { | 140 | if err != nil { |
152 | return "", err | 141 | return "", err |
153 | } | 142 | } |
@@ -252,13 +241,11 @@ func (p Proc) MountStats() ([]*Mount, error) { | |||
252 | // It supplies information missing in `/proc/self/mounts` and | 241 | // It supplies information missing in `/proc/self/mounts` and |
253 | // fixes various other problems with that file too. | 242 | // fixes various other problems with that file too. |
254 | func (p Proc) MountInfo() ([]*MountInfo, error) { | 243 | func (p Proc) MountInfo() ([]*MountInfo, error) { |
255 | f, err := os.Open(p.path("mountinfo")) | 244 | data, err := util.ReadFileNoStat(p.path("mountinfo")) |
256 | if err != nil { | 245 | if err != nil { |
257 | return nil, err | 246 | return nil, err |
258 | } | 247 | } |
259 | defer f.Close() | 248 | return parseMountInfo(data) |
260 | |||
261 | return parseMountInfo(f) | ||
262 | } | 249 | } |
263 | 250 | ||
264 | func (p Proc) fileDescriptors() ([]string, error) { | 251 | func (p Proc) fileDescriptors() ([]string, error) { |
diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go index 7172bb5..6134b35 100644 --- a/vendor/github.com/prometheus/procfs/proc_environ.go +++ b/vendor/github.com/prometheus/procfs/proc_environ.go | |||
@@ -14,22 +14,16 @@ | |||
14 | package procfs | 14 | package procfs |
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "io/ioutil" | ||
18 | "os" | ||
19 | "strings" | 17 | "strings" |
18 | |||
19 | "github.com/prometheus/procfs/internal/util" | ||
20 | ) | 20 | ) |
21 | 21 | ||
22 | // Environ reads process environments from /proc/<pid>/environ | 22 | // Environ reads process environments from /proc/<pid>/environ |
23 | func (p Proc) Environ() ([]string, error) { | 23 | func (p Proc) Environ() ([]string, error) { |
24 | environments := make([]string, 0) | 24 | environments := make([]string, 0) |
25 | 25 | ||
26 | f, err := os.Open(p.path("environ")) | 26 | data, err := util.ReadFileNoStat(p.path("environ")) |
27 | if err != nil { | ||
28 | return environments, err | ||
29 | } | ||
30 | defer f.Close() | ||
31 | |||
32 | data, err := ioutil.ReadAll(f) | ||
33 | if err != nil { | 27 | if err != nil { |
34 | return environments, err | 28 | return environments, err |
35 | } | 29 | } |
diff --git a/vendor/github.com/prometheus/procfs/proc_fdinfo.go b/vendor/github.com/prometheus/procfs/proc_fdinfo.go index 83b67d1..4e7597f 100644 --- a/vendor/github.com/prometheus/procfs/proc_fdinfo.go +++ b/vendor/github.com/prometheus/procfs/proc_fdinfo.go | |||
@@ -15,11 +15,10 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "bufio" | 17 | "bufio" |
18 | "fmt" | 18 | "bytes" |
19 | "io/ioutil" | ||
20 | "os" | ||
21 | "regexp" | 19 | "regexp" |
22 | "strings" | 20 | |
21 | "github.com/prometheus/procfs/internal/util" | ||
23 | ) | 22 | ) |
24 | 23 | ||
25 | // Regexp variables | 24 | // Regexp variables |
@@ -46,21 +45,15 @@ type ProcFDInfo struct { | |||
46 | 45 | ||
47 | // FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty. | 46 | // FDInfo constructor. On kernels older than 3.8, InotifyInfos will always be empty. |
48 | func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) { | 47 | func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) { |
49 | f, err := os.Open(p.path("fdinfo", fd)) | 48 | data, err := util.ReadFileNoStat(p.path("fdinfo", fd)) |
50 | if err != nil { | 49 | if err != nil { |
51 | return nil, err | 50 | return nil, err |
52 | } | 51 | } |
53 | defer f.Close() | ||
54 | |||
55 | fdinfo, err := ioutil.ReadAll(f) | ||
56 | if err != nil { | ||
57 | return nil, fmt.Errorf("could not read %s: %s", f.Name(), err) | ||
58 | } | ||
59 | 52 | ||
60 | var text, pos, flags, mntid string | 53 | var text, pos, flags, mntid string |
61 | var inotify []InotifyInfo | 54 | var inotify []InotifyInfo |
62 | 55 | ||
63 | scanner := bufio.NewScanner(strings.NewReader(string(fdinfo))) | 56 | scanner := bufio.NewScanner(bytes.NewReader(data)) |
64 | for scanner.Scan() { | 57 | for scanner.Scan() { |
65 | text = scanner.Text() | 58 | text = scanner.Text() |
66 | if rPos.MatchString(text) { | 59 | if rPos.MatchString(text) { |
diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go index 0ff89b1..776f349 100644 --- a/vendor/github.com/prometheus/procfs/proc_io.go +++ b/vendor/github.com/prometheus/procfs/proc_io.go | |||
@@ -15,8 +15,8 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "fmt" | 17 | "fmt" |
18 | "io/ioutil" | 18 | |
19 | "os" | 19 | "github.com/prometheus/procfs/internal/util" |
20 | ) | 20 | ) |
21 | 21 | ||
22 | // ProcIO models the content of /proc/<pid>/io. | 22 | // ProcIO models the content of /proc/<pid>/io. |
@@ -43,13 +43,7 @@ type ProcIO struct { | |||
43 | func (p Proc) IO() (ProcIO, error) { | 43 | func (p Proc) IO() (ProcIO, error) { |
44 | pio := ProcIO{} | 44 | pio := ProcIO{} |
45 | 45 | ||
46 | f, err := os.Open(p.path("io")) | 46 | data, err := util.ReadFileNoStat(p.path("io")) |
47 | if err != nil { | ||
48 | return pio, err | ||
49 | } | ||
50 | defer f.Close() | ||
51 | |||
52 | data, err := ioutil.ReadAll(f) | ||
53 | if err != nil { | 47 | if err != nil { |
54 | return pio, err | 48 | return pio, err |
55 | } | 49 | } |
diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go index 46fe266..0d7bee5 100644 --- a/vendor/github.com/prometheus/procfs/proc_psi.go +++ b/vendor/github.com/prometheus/procfs/proc_psi.go | |||
@@ -24,11 +24,13 @@ package procfs | |||
24 | // > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134 | 24 | // > full avg10=0.00 avg60=0.13 avg300=0.96 total=8183134 |
25 | 25 | ||
26 | import ( | 26 | import ( |
27 | "bufio" | ||
28 | "bytes" | ||
27 | "fmt" | 29 | "fmt" |
28 | "io" | 30 | "io" |
29 | "io/ioutil" | ||
30 | "os" | ||
31 | "strings" | 31 | "strings" |
32 | |||
33 | "github.com/prometheus/procfs/internal/util" | ||
32 | ) | 34 | ) |
33 | 35 | ||
34 | const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d" | 36 | const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d" |
@@ -55,24 +57,21 @@ type PSIStats struct { | |||
55 | // resource from /proc/pressure/<resource>. At time of writing this can be | 57 | // resource from /proc/pressure/<resource>. At time of writing this can be |
56 | // either "cpu", "memory" or "io". | 58 | // either "cpu", "memory" or "io". |
57 | func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { | 59 | func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { |
58 | file, err := os.Open(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) | 60 | data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) |
59 | if err != nil { | 61 | if err != nil { |
60 | return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) | 62 | return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) |
61 | } | 63 | } |
62 | 64 | ||
63 | defer file.Close() | 65 | return parsePSIStats(resource, bytes.NewReader(data)) |
64 | return parsePSIStats(resource, file) | ||
65 | } | 66 | } |
66 | 67 | ||
67 | // parsePSIStats parses the specified file for pressure stall information | 68 | // parsePSIStats parses the specified file for pressure stall information |
68 | func parsePSIStats(resource string, file io.Reader) (PSIStats, error) { | 69 | func parsePSIStats(resource string, r io.Reader) (PSIStats, error) { |
69 | psiStats := PSIStats{} | 70 | psiStats := PSIStats{} |
70 | stats, err := ioutil.ReadAll(file) | ||
71 | if err != nil { | ||
72 | return psiStats, fmt.Errorf("psi_stats: unable to read data for %s", resource) | ||
73 | } | ||
74 | 71 | ||
75 | for _, l := range strings.Split(string(stats), "\n") { | 72 | scanner := bufio.NewScanner(r) |
73 | for scanner.Scan() { | ||
74 | l := scanner.Text() | ||
76 | prefix := strings.Split(l, " ")[0] | 75 | prefix := strings.Split(l, " ")[0] |
77 | switch prefix { | 76 | switch prefix { |
78 | case "some": | 77 | case "some": |
diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index dbde1fa..4517d2e 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go | |||
@@ -16,10 +16,10 @@ package procfs | |||
16 | import ( | 16 | import ( |
17 | "bytes" | 17 | "bytes" |
18 | "fmt" | 18 | "fmt" |
19 | "io/ioutil" | ||
20 | "os" | 19 | "os" |
21 | 20 | ||
22 | "github.com/prometheus/procfs/internal/fs" | 21 | "github.com/prometheus/procfs/internal/fs" |
22 | "github.com/prometheus/procfs/internal/util" | ||
23 | ) | 23 | ) |
24 | 24 | ||
25 | // Originally, this USER_HZ value was dynamically retrieved via a sysconf call | 25 | // Originally, this USER_HZ value was dynamically retrieved via a sysconf call |
@@ -113,13 +113,7 @@ func (p Proc) NewStat() (ProcStat, error) { | |||
113 | 113 | ||
114 | // Stat returns the current status information of the process. | 114 | // Stat returns the current status information of the process. |
115 | func (p Proc) Stat() (ProcStat, error) { | 115 | func (p Proc) Stat() (ProcStat, error) { |
116 | f, err := os.Open(p.path("stat")) | 116 | data, err := util.ReadFileNoStat(p.path("stat")) |
117 | if err != nil { | ||
118 | return ProcStat{}, err | ||
119 | } | ||
120 | defer f.Close() | ||
121 | |||
122 | data, err := ioutil.ReadAll(f) | ||
123 | if err != nil { | 117 | if err != nil { |
124 | return ProcStat{}, err | 118 | return ProcStat{}, err |
125 | } | 119 | } |
diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go index ad290fa..e30c2b8 100644 --- a/vendor/github.com/prometheus/procfs/proc_status.go +++ b/vendor/github.com/prometheus/procfs/proc_status.go | |||
@@ -15,10 +15,10 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "bytes" | 17 | "bytes" |
18 | "io/ioutil" | ||
19 | "os" | ||
20 | "strconv" | 18 | "strconv" |
21 | "strings" | 19 | "strings" |
20 | |||
21 | "github.com/prometheus/procfs/internal/util" | ||
22 | ) | 22 | ) |
23 | 23 | ||
24 | // ProcStatus provides status information about the process, | 24 | // ProcStatus provides status information about the process, |
@@ -75,13 +75,7 @@ type ProcStatus struct { | |||
75 | 75 | ||
76 | // NewStatus returns the current status information of the process. | 76 | // NewStatus returns the current status information of the process. |
77 | func (p Proc) NewStatus() (ProcStatus, error) { | 77 | func (p Proc) NewStatus() (ProcStatus, error) { |
78 | f, err := os.Open(p.path("status")) | 78 | data, err := util.ReadFileNoStat(p.path("status")) |
79 | if err != nil { | ||
80 | return ProcStatus{}, err | ||
81 | } | ||
82 | defer f.Close() | ||
83 | |||
84 | data, err := ioutil.ReadAll(f) | ||
85 | if err != nil { | 79 | if err != nil { |
86 | return ProcStatus{}, err | 80 | return ProcStatus{}, err |
87 | } | 81 | } |
diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index 6661ee0..b2a6fc9 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go | |||
@@ -15,13 +15,14 @@ package procfs | |||
15 | 15 | ||
16 | import ( | 16 | import ( |
17 | "bufio" | 17 | "bufio" |
18 | "bytes" | ||
18 | "fmt" | 19 | "fmt" |
19 | "io" | 20 | "io" |
20 | "os" | ||
21 | "strconv" | 21 | "strconv" |
22 | "strings" | 22 | "strings" |
23 | 23 | ||
24 | "github.com/prometheus/procfs/internal/fs" | 24 | "github.com/prometheus/procfs/internal/fs" |
25 | "github.com/prometheus/procfs/internal/util" | ||
25 | ) | 26 | ) |
26 | 27 | ||
27 | // CPUStat shows how much time the cpu spend in various stages. | 28 | // CPUStat shows how much time the cpu spend in various stages. |
@@ -164,16 +165,15 @@ func (fs FS) NewStat() (Stat, error) { | |||
164 | // Stat returns information about current cpu/process statistics. | 165 | // Stat returns information about current cpu/process statistics. |
165 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt | 166 | // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt |
166 | func (fs FS) Stat() (Stat, error) { | 167 | func (fs FS) Stat() (Stat, error) { |
167 | 168 | fileName := fs.proc.Path("stat") | |
168 | f, err := os.Open(fs.proc.Path("stat")) | 169 | data, err := util.ReadFileNoStat(fileName) |
169 | if err != nil { | 170 | if err != nil { |
170 | return Stat{}, err | 171 | return Stat{}, err |
171 | } | 172 | } |
172 | defer f.Close() | ||
173 | 173 | ||
174 | stat := Stat{} | 174 | stat := Stat{} |
175 | 175 | ||
176 | scanner := bufio.NewScanner(f) | 176 | scanner := bufio.NewScanner(bytes.NewReader(data)) |
177 | for scanner.Scan() { | 177 | for scanner.Scan() { |
178 | line := scanner.Text() | 178 | line := scanner.Text() |
179 | parts := strings.Fields(scanner.Text()) | 179 | parts := strings.Fields(scanner.Text()) |
@@ -237,7 +237,7 @@ func (fs FS) Stat() (Stat, error) { | |||
237 | } | 237 | } |
238 | 238 | ||
239 | if err := scanner.Err(); err != nil { | 239 | if err := scanner.Err(); err != nil { |
240 | return Stat{}, fmt.Errorf("couldn't parse %s: %s", f.Name(), err) | 240 | return Stat{}, fmt.Errorf("couldn't parse %s: %s", fileName, err) |
241 | } | 241 | } |
242 | 242 | ||
243 | return stat, nil | 243 | return stat, nil |
diff --git a/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go b/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go new file mode 100644 index 0000000..c8b0055 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/sysfs/class_powercap.go | |||
@@ -0,0 +1,112 @@ | |||
1 | // Copyright 2019 The Prometheus Authors | ||
2 | // Licensed under the Apache License, Version 2.0 (the "License"); | ||
3 | // you may not use this file except in compliance with the License. | ||
4 | // You may obtain a copy of the License at | ||
5 | // | ||
6 | // http://www.apache.org/licenses/LICENSE-2.0 | ||
7 | // | ||
8 | // Unless required by applicable law or agreed to in writing, software | ||
9 | // distributed under the License is distributed on an "AS IS" BASIS, | ||
10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
11 | // See the License for the specific language governing permissions and | ||
12 | // limitations under the License. | ||
13 | |||
14 | // +build !windows | ||
15 | |||
16 | package sysfs | ||
17 | |||
18 | import ( | ||
19 | "errors" | ||
20 | "io/ioutil" | ||
21 | "path/filepath" | ||
22 | "strconv" | ||
23 | "strings" | ||
24 | |||
25 | "github.com/prometheus/procfs/internal/util" | ||
26 | ) | ||
27 | |||
28 | // RaplZone stores the information for one RAPL power zone | ||
29 | type RaplZone struct { | ||
30 | Name string // name of RAPL zone from file "name" | ||
31 | Index int // index (different value for duplicate names) | ||
32 | Path string // filesystem path of RaplZone | ||
33 | MaxMicrojoules uint64 // max RAPL microjoule value | ||
34 | } | ||
35 | |||
36 | // GetRaplZones returns a slice of RaplZones | ||
37 | // When RAPL files are not present, returns nil with error | ||
38 | // https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt | ||
39 | func GetRaplZones(fs FS) ([]RaplZone, error) { | ||
40 | raplDir := fs.sys.Path("class/powercap") | ||
41 | |||
42 | files, err := ioutil.ReadDir(raplDir) | ||
43 | if err != nil { | ||
44 | return nil, errors.New( | ||
45 | "no sysfs powercap / RAPL power metrics files found") | ||
46 | } | ||
47 | |||
48 | var zones []RaplZone | ||
49 | |||
50 | // count name usages to avoid duplicates (label them with an index) | ||
51 | countNameUsages := make(map[string]int) | ||
52 | |||
53 | // loop through directory files searching for file "name" from subdirs | ||
54 | for _, f := range files { | ||
55 | nameFile := filepath.Join(raplDir, f.Name(), "/name") | ||
56 | nameBytes, err := ioutil.ReadFile(nameFile) | ||
57 | if err == nil { | ||
58 | // add new rapl zone since name file was found | ||
59 | name := strings.TrimSpace(string(nameBytes)) | ||
60 | |||
61 | // get a pair of index and final name | ||
62 | index, name := getIndexAndName(countNameUsages, | ||
63 | name) | ||
64 | |||
65 | maxMicrojouleFilename := filepath.Join(raplDir, f.Name(), | ||
66 | "/max_energy_range_uj") | ||
67 | maxMicrojoules, err := util.ReadUintFromFile(maxMicrojouleFilename) | ||
68 | if err != nil { | ||
69 | return nil, err | ||
70 | } | ||
71 | |||
72 | zone := RaplZone{ | ||
73 | Name: name, | ||
74 | Index: index, | ||
75 | Path: filepath.Join(raplDir, f.Name()), | ||
76 | MaxMicrojoules: maxMicrojoules, | ||
77 | } | ||
78 | |||
79 | zones = append(zones, zone) | ||
80 | |||
81 | // Store into map how many times this name has been used. There can | ||
82 | // be e.g. multiple "dram" instances without any index postfix. The | ||
83 | // count is then used for indexing | ||
84 | countNameUsages[name] = index + 1 | ||
85 | } | ||
86 | } | ||
87 | |||
88 | return zones, nil | ||
89 | } | ||
90 | |||
91 | // GetEnergyMicrojoules returns the current microjoule value from the zone energy counter | ||
92 | // https://www.kernel.org/doc/Documentation/power/powercap/powercap.txt | ||
93 | func (rz RaplZone) GetEnergyMicrojoules() (uint64, error) { | ||
94 | return util.ReadUintFromFile(filepath.Join(rz.Path, "/energy_uj")) | ||
95 | } | ||
96 | |||
97 | // getIndexAndName returns a pair of (index, name) for a given name and name | ||
98 | // counting map. Some RAPL-names have an index at the end, some have duplicates | ||
99 | // without an index at the end. When the index is embedded in the name, it is | ||
100 | // provided back as an integer, and stripped from the returned name. Usage | ||
101 | // count is used when the index value is absent from the name. | ||
102 | func getIndexAndName(countNameUsages map[string]int, name string) (int, string) { | ||
103 | length := len(name) | ||
104 | if length >= 2 { | ||
105 | index, err := strconv.Atoi(name[length-1:]) | ||
106 | if name[length-2:length-1] == "-" && err == nil { | ||
107 | return index, name[:length-2] | ||
108 | } | ||
109 | } | ||
110 | // return count as the index, since name didn't have an index at the end | ||
111 | return countNameUsages[name], name | ||
112 | } | ||
diff --git a/vendor/modules.txt b/vendor/modules.txt index 48dd325..0e82aef 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt | |||
@@ -47,7 +47,7 @@ github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg | |||
47 | github.com/prometheus/common/log | 47 | github.com/prometheus/common/log |
48 | github.com/prometheus/common/model | 48 | github.com/prometheus/common/model |
49 | github.com/prometheus/common/version | 49 | github.com/prometheus/common/version |
50 | # github.com/prometheus/procfs v0.0.5 | 50 | # github.com/prometheus/procfs v0.0.7 |
51 | github.com/prometheus/procfs | 51 | github.com/prometheus/procfs |
52 | github.com/prometheus/procfs/bcache | 52 | github.com/prometheus/procfs/bcache |
53 | github.com/prometheus/procfs/internal/fs | 53 | github.com/prometheus/procfs/internal/fs |
@@ -70,7 +70,7 @@ golang.org/x/net/bpf | |||
70 | golang.org/x/net/internal/iana | 70 | golang.org/x/net/internal/iana |
71 | golang.org/x/net/internal/socket | 71 | golang.org/x/net/internal/socket |
72 | golang.org/x/net/ipv4 | 72 | golang.org/x/net/ipv4 |
73 | # golang.org/x/sync v0.0.0-20190423024810-112230192c58 | 73 | # golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e |
74 | golang.org/x/sync/errgroup | 74 | golang.org/x/sync/errgroup |
75 | # golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 | 75 | # golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 |
76 | golang.org/x/sys/unix | 76 | golang.org/x/sys/unix |