[PATCH 06/10] util: Add more getters to threadpool parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In order for the client to see all thread counts and limits, current total
and free worker count getters need to be introduced. Client might also be
interested in the job queue length, so provide a getter for that too.
---
 src/libvirt_private.syms |  3 +++
 src/util/virthreadpool.c | 15 +++++++++++++++
 src/util/virthreadpool.h |  3 +++
 3 files changed, 21 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4b40612..7658ebf 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2318,6 +2318,9 @@ virThreadJobSetWorker;
 
 # util/virthreadpool.h
 virThreadPoolFree;
+virThreadPoolGetCurrentWorkers;
+virThreadPoolGetFreeWorkers;
+virThreadPoolGetJobQueueDepth;
 virThreadPoolGetMaxWorkers;
 virThreadPoolGetMinWorkers;
 virThreadPoolGetPriorityWorkers;
diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c
index e2e9fe4..518b880 100644
--- a/src/util/virthreadpool.c
+++ b/src/util/virthreadpool.c
@@ -299,6 +299,21 @@ size_t virThreadPoolGetPriorityWorkers(virThreadPoolPtr pool)
     return pool->nPrioWorkers;
 }
 
+size_t virThreadPoolGetCurrentWorkers(virThreadPoolPtr pool)
+{
+    return pool->nWorkers;
+}
+
+size_t virThreadPoolGetFreeWorkers(virThreadPoolPtr pool)
+{
+    return pool->freeWorkers;
+}
+
+size_t virThreadPoolGetJobQueueDepth(virThreadPoolPtr pool)
+{
+    return pool->jobQueueDepth;
+}
+
 /*
  * @priority - job priority
  * Return: 0 on success, -1 otherwise
diff --git a/src/util/virthreadpool.h b/src/util/virthreadpool.h
index 538b62f..bc0c907 100644
--- a/src/util/virthreadpool.h
+++ b/src/util/virthreadpool.h
@@ -46,6 +46,9 @@ virThreadPoolPtr virThreadPoolNewFull(size_t minWorkers,
 size_t virThreadPoolGetMinWorkers(virThreadPoolPtr pool);
 size_t virThreadPoolGetMaxWorkers(virThreadPoolPtr pool);
 size_t virThreadPoolGetPriorityWorkers(virThreadPoolPtr pool);
+size_t virThreadPoolGetCurrentWorkers(virThreadPoolPtr pool);
+size_t virThreadPoolGetFreeWorkers(virThreadPoolPtr pool);
+size_t virThreadPoolGetJobQueueDepth(virThreadPoolPtr pool);
 
 void virThreadPoolFree(virThreadPoolPtr pool);
 
-- 
2.4.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]