KDK_RTI_GET_MEM_RES_USAGE_KIB(3)
👑 KDK_RTI_GET_MEM_RES_USAGE_KIB(3) 👑
okay bestie so this one comes from the Library Functions Manual and it's genuinely so cute, it's a little function that just tells you how much physical memory is in use. iykyk. let's get into it 💅
✨ NAME ✨
kdk_rti_get_mem_res_usage_KiB — 获取物理内存使用大小, which is literally "get the physical memory usage size". the vibes are immaculate, the function is tiny, we love her 🫶
🦋 SYNOPSIS 🦋
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_res_usage_KiB();
and don't forget to link with -lkyrtinfo, bestie, or the linker will simply not know her 😭
🌸 Detailed Description 🌸
so the whole main character job of this interface is to obtain the physical memory usage size. that's it. that's the gig. 💖
but here's the tea you actually need: Buffer/Cache is counted as used memory. like, fr fr, it's in there. so don't come at her like "bestie why is my used memory so high" because no cap, buffers and cache count. periodt.
⭐ RETURN VALUE ⭐
- on success — she returns the physical memory usage size, and the type is
unsigned long. the unit is KiB. slay. 💅 - on error — you get
0. that's the whole thing. zero. nothing. a little tragedy ngl 😭
🎀 EXAMPLES 🎀
here's the full group-chat screenshot of how you'd actually use her and all her friends together 🧚
#include "libkyrtinfo.h"
#include <stdio.h>
int main()
{
printf("内存总大小:%lu KiB0, kdk_rti_get_mem_res_total_KiB());
printf("当前已用内存:%lu KiB,%f0, kdk_rti_get_mem_res_usage_KiB(), kdk_rti_get_mem_res_usage_percent());
printf("当前空闲内存:%lu KiB0, kdk_rti_get_mem_res_free_KiB());
printf("可用内存大小:%lu KiB0, kdk_rti_get_mem_res_available_KiB());
printf("应用总申请虚拟内存大小:%lu KiB0, kdk_rti_get_mem_virt_alloc_KiB());
printf("交换分区总量:%lu KiB0, kdk_rti_get_mem_swap_total_KiB());
printf("交换分区已用量:%lu KiB, %f0, kdk_rti_get_mem_swap_usage_KiB(), kdk_rti_get_mem_swap_usage_percent());
printf("交换分区剩余大小:%lu KiB0, kdk_rti_get_mem_swap_free_KiB());
printf("当前CPU使用率:%f0, kdk_rti_get_cpu_current_usage());
unsigned int day, hour, min, sec;
kdk_rti_get_uptime(&day, &hour, &min, &sec);
printf("开机时长:%u天%u小时%u分钟%u秒0, day, hour, min, sec);
return 0;
}
like, look at her pulling in uptime and CPU usage and swap and everything. main character energy for real 🔥
🌈 CONFORMING TO 🌈
these functions are as per the withdrawn POSIX.1e draft specification. yes bestie, withdrawn. we still love her though 💜
and these following functions are Linux extensions, so jot that down:
kdk_rti_get_mem_res_total_KiB()kdk_rti_get_mem_res_usage_percent()kdk_rti_get_mem_res_available_KiB()kdk_rti_get_mem_res_free_KiB()kdk_rti_get_mem_virt_alloc_KiB()kdk_rti_get_mem_swap_total_KiB()kdk_rti_get_mem_swap_usage_percent()kdk_rti_get_mem_swap_usage_KiB()kdk_rti_get_mem_swap_free_KiB()kdk_rti_get_cpu_current_usage()kdk_rti_get_uptime()
💖 SEE ALSO 💖
go read her sisters, they're all iconic, no notes:
kdk_rti_get_mem_res_total_KiB(3)kdk_rti_get_mem_res_usage_percent(3)kdk_rti_get_mem_res_available_KiB(3)kdk_rti_get_mem_res_free_KiB(3)kdk_rti_get_mem_virt_alloc_KiB(3)kdk_rti_get_mem_swap_total_KiB()kdk_rti_get_mem_swap_usage_percent(3)kdk_rti_get_mem_swap_usage_KiB(3)kdk_rti_get_mem_swap_free_KiB(3)kdk_rti_get_cpu_current_usage(3)kdk_rti_get_uptime(3)
and that's the whole page bestie, go get that memory usage, you ate 💅✨
sourced from the Linux Programmer's Manual, dated Mon Sep 18 2023 — mwah, bye 🎀🦋💖
📦 where this page comes from
- arch rolling: libkysdk-system 3.0.1.4-1 · LGPL-3.0-or-later AND LGPL-2.1-only OR LGPL-3.0-only AND LGPL-2.1-only WITH Qt-LGPL-exception-1.1 OR LGPL-3.0-only WITH Qt-LGPL-exception-1.1 AND MIT
- ubuntu resolute: libkysdk-system-dev 3.0.1.2-0ubuntu1 · LGPL-3.0-only
- ubuntu stonking: libkysdk-system-dev 3.0.1.3-0ubuntu1 · LGPL-3.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms