aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 22:08:50 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-06 22:08:50 +0300
commit3528f88fc36df6964c0efed784ae223cfe93544e (patch)
tree6e672c76fb4c899d5e454f724adfd4bae8182e31 /include
parent70afa4184544d244d804713fdee5836f4f20a9fe (diff)
downloadkmi-3528f88fc36df6964c0efed784ae223cfe93544e.tar.gz
kmi-3528f88fc36df6964c0efed784ae223cfe93544e.zip
add RAM usage counting
+ Slightly more overhead but will help track down possible memory leaks in the future. Could also add in a flag for turning off/on but I don't think the difference in performance is that significant.
Diffstat (limited to 'include')
-rw-r--r--include/kmi/pmem.h3
-rw-r--r--include/kmi/syscalls.h29
2 files changed, 32 insertions, 0 deletions
diff --git a/include/kmi/pmem.h b/include/kmi/pmem.h
index 966f269..0c7a4a2 100644
--- a/include/kmi/pmem.h
+++ b/include/kmi/pmem.h
@@ -39,6 +39,9 @@ void mark_used(enum mm_order order, pm_t addr);
*/
pm_t alloc_page(enum mm_order order);
+/** @return How many bytes of memory are currently in use. */
+size_t query_used();
+
/**
* Populate physical RAM usage map.
* In theory we could easily implement NUMA nodes by just using different orders
diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h
index 0801f50..a94cdf1 100644
--- a/include/kmi/syscalls.h
+++ b/include/kmi/syscalls.h
@@ -204,6 +204,35 @@ enum notify_flag {
*/
typedef long sys_arg_t;
+/** IDs for configuration parameters. */
+enum conf_param {
+ /**
+ * How large a regular thread stack is.
+ * \c R/W
+ */
+ CONF_THREAD_STACK,
+
+ /**
+ * How large an RPC stack element is. R/W. Note that this is not how
+ * large the RPC stack is in total, as that is hardcoded by the
+ * architecture, but how much of that stack one RPC call can take.
+ * \c R/W
+ */
+ CONF_RPC_STACK,
+
+ /**
+ * Current RAM usage.
+ * \c R
+ */
+ CONF_RAM_USAGE,
+
+ /**
+ * Total RAM size.
+ * \c R.
+ */
+ CONF_RAM_SIZE,
+};
+
/**
* Return structure of syscall.
* \note Field names are generic, and can be used for whatever,