Add 'MemUsageBytes' format option

Although storage is more human-readable when expressed in SI units,
IEC/JEDEC (Bytes) units are more pertinent for memory-related values
(and match the format of the --memory* command-line options).

(To prevent possible compatibility issues, the default SI display is
left unchanged)

See https://github.com/containers/podman/issues/8945

Signed-off-by: Stuart Shelton <stuart@shelton.me>
This commit is contained in:
Stuart Shelton
2021-01-12 23:37:24 +00:00
parent 265ec914d3
commit a6af56f5b4
6 changed files with 76 additions and 51 deletions

View File

@ -35,17 +35,18 @@ Pretty-print container statistics to JSON or using a Go template
Valid placeholders for the Go template are listed below:
| **Placeholder** | **Description** |
| --------------- | --------------- |
| .Pod | Pod ID |
| .CID | Container ID |
| .Name | Container Name |
| .CPU | CPU percentage |
| .MemUsage | Memory usage |
| .Mem | Memory percentage |
| .NetIO | Network IO |
| .BlockIO | Block IO |
| .PIDS | Number of PIDs |
| **Placeholder** | **Description** |
| --------------- | ------------------ |
| .Pod | Pod ID |
| .CID | Container ID |
| .Name | Container Name |
| .CPU | CPU percentage |
| .MemUsage | Memory usage |
| .MemUsageBytes | Memory usage (IEC) |
| .Mem | Memory percentage |
| .NetIO | Network IO |
| .BlockIO | Block IO |
| .PIDS | Number of PIDs |
When using a GO template, you may precede the format with `table` to print headers.
## EXAMPLE

View File

@ -45,16 +45,17 @@ Pretty-print container statistics to JSON or using a Go template
Valid placeholders for the Go template are listed below:
| **Placeholder** | **Description** |
| --------------- | --------------- |
| .ID | Container ID |
| .Name | Container Name |
| .CPUPerc | CPU percentage |
| .MemUsage | Memory usage |
| .MemPerc | Memory percentage |
| .NetIO | Network IO |
| .BlockIO | Block IO |
| .PIDS | Number of PIDs |
| **Placeholder** | **Description** |
| --------------- | ------------------ |
| .ID | Container ID |
| .Name | Container Name |
| .CPUPerc | CPU percentage |
| .MemUsage | Memory usage |
| .MemUsageBytes | Memory usage (IEC) |
| .MemPerc | Memory percentage |
| .NetIO | Network IO |
| .BlockIO | Block IO |
| .PIDS | Number of PIDs |
When using a GO template, you may precede the format with `table` to print headers.