diff mbox series

[RFC,v2,8/9] usertools: add hugepage info script

Message ID 979a0e8fbbef524e2c07d80265c8cc440382a450.1542291869.git.anatoly.burakov@intel.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers show
Series Modularize and enhance DPDK Python scripts | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Anatoly Burakov Nov. 15, 2018, 3:47 p.m. UTC
Add a simple hugepage info script for demonstration purposes.

It lists the following information:
- Currently configured persistent hugetlbfs mountpoints (fstab)
- Currently mounted hugetlbfs mountpoints
- Total number of hugepages for each size
- Per-NUMA node number of hugepages for each size

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
 usertools/hugepage-info.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 usertools/hugepage-info.py
diff mbox series


diff --git a/usertools/hugepage-info.py b/usertools/hugepage-info.py
new file mode 100755
index 000000000..bbea35e7b
--- /dev/null
+++ b/usertools/hugepage-info.py
@@ -0,0 +1,32 @@ 
+#!/usr/bin/env python
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+from __future__ import print_function
+from DPDKConfigLib import HugeUtil, PlatformInfo, Util
+pc = HugeUtil.PersistentMountpointConfig()
+print("Persistent hugetlbfs mountpoints:")
+for sz, mp in pc.mountpoints.items():
+    print("%s: %s" % (Util.kilobytes_to_human_readable(sz), mp))
+rc = HugeUtil.RuntimeMountpointConfig()
+print("Current hugetlbfs mountpoints:")
+for sz, mp in rc.mountpoints.items():
+    print("%s: %s" % (Util.kilobytes_to_human_readable(sz), mp))
+info = PlatformInfo.PlatformInfo()
+rhc = HugeUtil.RuntimeHugepageConfig()
+print("Current hugepage configuration:")
+for sz, nr in rhc.total_nr_hugepages.items():
+    print("%s: %s" % (Util.kilobytes_to_human_readable(sz), nr))
+print("Current per-NUMA node configuration:")
+for node in info.numa_nodes:
+    for pagesz in info.hugepage_sizes_supported:
+        print("[Node %s] %s: %s" % (node,
+                                    Util.kilobytes_to_human_readable(pagesz),
+                                    rhc.hugepages_per_node[node, pagesz]))