KDK_RTI_GET_MEM_RES_TOTAL_KIB(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

✨ KDK_RTI_GET_MEM_RES_TOTAL_KIB ✨

okay bestie, welcome to the Library Functions Manual 💖 this is the page for KDK_RTI_GE...S_TOTAL_KIB(3) and honestly? it's a little baddie. let's get into it 💅


🌸 NAME 🌸

kdk_rti_get_mem_res_total_KiB — 获取系统中物理内存总大小

(yes she's bilingual, we stan 🫶 — this one tells you the total physical memory size of the system)


🎀 SYNOPSIS 🎀

#include <libkyrtinfo.h>

extern unsigned long kdk_rti_get_mem_res_total_KiB();

and listen, don't forget to link her up: Link with -lkyrtinfo. 🔗


💫 DESCRIPTION 💫

Detailed Description

so like, the whole ~main character function~ of this interface? it's to obtain the total size of physical memory in the system. that's it. that's the gig. iconic behavior tbh 👑


⭐ RETURN VALUE ⭐

  • on success — she hands you the physical memory size, and it's of type unsigned long. the unit is KiB, periodt 💅
  • on error — you get 0. that's it. zero. nothing. 😭

🦋 EXAMPLES 🦋

here's the whole squad hanging out together, no cap:

#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;
}

🌈 CONFORMING TO 🌈

so these functions are as per the withdrawn POSIX.1e draft specification — like, the draft got pulled, but we're still here serving looks 🧚

and the following ones are Linux extensions:

  • 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_usage_KiB()
  • kdk_rti_get_mem_swap_free_KiB()
  • kdk_rti_get_cpu_current_usage()
  • kdk_rti_get_uptime()

💜 SEE ALSO 💜

go read these next, they're all in the group chat:


ok that's the whole page bestie, you're literally a memory-total-knowing legend now 🫶

kisses from the Linux Programmer's Manual 💋 — this one dropped Mon Sep 18 2023, and yeah the page tag is KDK_RTI_GE...S_TOTAL_KIB(3) (the terminal cut off her name like a bad crop, we still love her) 💖✨

📦 where this page comes from