diff mbox series

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

Message ID 293393804c84669c55fbdfd157a6c88150e7754e.1529940601.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series Modularize and enhance DPDK Python scripts | expand


Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Anatoly Burakov June 25, 2018, 3:59 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]))