diff mbox series

[kvmtool,2/2] stat: Add descriptions for new virtio_balloon stat types

Message ID 20220520143706.550169-3-keirf@google.com (mailing list archive)
State New, archived
Headers show
Series Fixes for virtio_balloon stats printing | expand

Commit Message

Keir Fraser May 20, 2022, 2:37 p.m. UTC
Unknown types would print the value with no descriptive text at all.
Add descriptions for all known stat types, and a default description
when the type is unknown.

Signed-off-by: Keir Fraser <keirf@google.com>
Cc: Will Deacon <will@kernel.org>
---
 builtin-stat.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/builtin-stat.c b/builtin-stat.c
index 5d6407e..876e96a 100644
--- a/builtin-stat.c
+++ b/builtin-stat.c
@@ -83,11 +83,26 @@  static int do_memstat(const char *name, int sock)
 		case VIRTIO_BALLOON_S_MINFLT:
 			printf("The number of minor page faults that have occurred:");
 			break;
+		case VIRTIO_BALLOON_S_HTLB_PGALLOC:
+			printf("The number of successful HugeTLB allocations:");
+			break;
+		case VIRTIO_BALLOON_S_HTLB_PGFAIL:
+			printf("The number of failed HugeTLB allocations:");
+			break;
 		case VIRTIO_BALLOON_S_MEMFREE:
 			printf("The amount of memory not being used for any purpose (in bytes):");
 			break;
 		case VIRTIO_BALLOON_S_MEMTOT:
-			printf("The total amount of memory available (in bytes):");
+			printf("The total amount of memory (in bytes):");
+			break;
+		case VIRTIO_BALLOON_S_AVAIL:
+			printf("The estimated available memory (in bytes):");
+			break;
+		case VIRTIO_BALLOON_S_CACHES:
+			printf("The amount of memory in use for file caching (in bytes):");
+			break;
+		default:
+			printf("Unknown memory statistic (ID %u): ", stats[i].tag);
 			break;
 		}
 		printf("%llu\n", (unsigned long long)stats[i].val);