KDK_RTI_GE..._USAGE_KIB(3)
💖 KDK_RTI_GE..._USAGE_KIB(3) — Library Functions Manual 💖
okay bestie, sit DOWN because we're about to talk about kdk_rti_get_mem_swap_usage_KiB — the girlies in libkyrtinfo who tells you how much swap you're actually using. it's giving system monitor realness, no cap. ✨
🌸 NAME 🌸
kdk_rti_get_mem_swap_usage_KiB — 获取Swap分区使用量 (that's "get the Swap partition usage" for my monolingual besties 💅)
✨ SYNOPSIS ✨
#include <libkyrtinfo.h>
extern unsigned long kdk_rti_get_mem_swap_usage_KiB();
Link with -lkyrtinfo.
yes queen, you literally have to link with -lkyrtinfo, don't forget it or the linker will be SO dramatic about it 😭
🦋 Detailed Description 🦋
The main function of the interface is to obtain the usage of the Swap partition.
that's it. that's the whole job. she gets the Swap partition usage and she gets it GOOD. main character energy fr fr 🔥
👑 RETURN VALUE 👑
- On success, returns the Swap partition usage of type
unsigned long; the unit is KiB ✨ - On error, return
0.
⚠️ heads up bestie — 0 is the error signal, so if you see a zero, don't just assume your swap is chilling at empty. that's the "something went wrong" zero, okay? know the difference 💀
🎀 EXAMPLES 🎀
here's the whole girl squad doing their thing together, lowkey iconic:
#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;
}
copy it exactly like that, bestie — character for character, we do NOT editorialize the example around here 🫶
🌈 CONFORMING TO 🌈
These functions are as per the withdrawn POSIX.1e draft specification. (withdrawn!! it's retired, she's retired, respect her legacy tho 💅)
The following functions are Linux extensions:
kdk_rti_get_mem_res_total_KiB()kdk_rti_get_mem_res_usage_percent()kdk_rti_get_mem_res_usage_KiB()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_free_KiB()kdk_rti_get_cpu_current_usage()kdk_rti_get_uptime()
🔥 SEE ALSO 🔥
the whole friend group, go say hi 👋
kdk_rti_get_mem_res_total_KiB(3)kdk_rti_get_mem_res_usage_percent(3)kdk_rti_get_mem_res_usage_KiB(3)kdk_rti_get_mem_res_available_KiB(3)kdk_rti_get_mem_res_free_KiB(3)kdk_rti_get_mem_virt_alloc_KiB()kdk_rti_get_mem_swap_total_KiB(3)kdk_rti_get_mem_swap_usage_percent(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 tea, bestie 🍓 this one lives in the Linux Programmer's Manual, dated Mon Sep 18 2023 — so yeah, she's been serving accurate swap numbers since 2023 and she's still eating. periodt. 💖✨🎀🦋
📦 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