[RFC PATCH 5/5] remote: add virHistogram support for RPC as a virTypedParameterType

Amneesh Singh natto at weirdnatto.in
Thu Sep 22 02:19:03 UTC 2022


Signed-off-by: Amneesh Singh <natto at weirdnatto.in>
---
 src/remote/remote_protocol.x | 16 ++++++++++++++++
 src/remote_protocol-structs  | 13 +++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 79ffc63f03..c23e184d3a 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -418,6 +418,20 @@ struct remote_vcpu_info {
     int cpu;
 };
 
+const REMOTE_HISTOGRAM_BUCKET_MAX = 32;
+
+struct remote_histogram_bucket {
+    hyper x;
+    hyper y;
+};
+
+struct remote_histogram {
+    remote_histogram_bucket buckets<REMOTE_HISTOGRAM_BUCKET_MAX>;
+    unsigned int nbuckets;
+};
+
+typedef remote_histogram *remote_nonnull_histogram;
+
 /* Wire encoding of virTypedParameter.
  * Note the enum (type) which must remain binary compatible.
  */
@@ -436,6 +450,8 @@ union remote_typed_param_value switch (int type) {
      int b;
  case VIR_TYPED_PARAM_STRING:
      remote_nonnull_string s;
+ case VIR_TYPED_PARAM_HISTOGRAM:
+     remote_nonnull_histogram h;
 };
 
 struct remote_typed_param {
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index ca5222439d..95fc4a15fe 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -73,6 +73,18 @@ struct remote_vcpu_info {
         uint64_t                   cpu_time;
         int                        cpu;
 };
+struct remote_histogram_bucket {
+        int64_t x;
+        int64_t y;
+};
+struct remote_histogram {
+        struct {
+                u_int  buckets_len;
+                remote_histogram_bucket * buckets_val;
+        } buckets;
+        u_int nbuckets;
+};
+typedef remote_histogram *remote_nonnull_histogram;
 struct remote_typed_param_value {
         int                        type;
         union {
@@ -83,6 +95,7 @@ struct remote_typed_param_value {
                 double             d;
                 int                b;
                 remote_nonnull_string s;
+                remote_nonnull_histogram h;
         } remote_typed_param_value_u;
 };
 struct remote_typed_param {
-- 
2.37.1



More information about the libvir-list mailing list