KDK_REAL_GET_NET_SPEED(3)

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

🎀 KDK_REAL_GET_NET_SPEED 🎀

okay bestie, welcome to KDK_REAL_GET_NET_SPEED(3) from the Library Functions Manual — yes she's a section 3 girlie, she lives in the library, and she is here to tell you how fast your uploads are actually going ✨


💖 NAME 💖

kdk_real_get_net_speed — 获取上传的瞬时网速

(translation for my monolingual besties: she gets you the instantaneous internet speed for upload 💅)


✨ SYNOPSIS ✨

#include <libkyrealtimeinfo.h>

extern float kdk_real_get_net_speed(const char *nc);

Link with -lkyrealtime.

like, you literally just include the header, declare her, and link with -lkyrealtime — that's the whole vibe check, no cap 🫶


🌸 DETAILED DESCRIPTION 🌸

The main function of the interface is to obtain instantaneous internet speed for upload. That's the whole point of her existence. She is that girl and she knows it.

The argument nc is the name of the NIC, such as "eno1". So like, you have to tell her which network interface card you're curious about — she's not gonna guess, she's not a mind reader, she's a function 💀

ngl "NIC" just means network interface card, and "eno1" is the example name they give you. Don't come for me, it's in the original bestie.

⭐ RETURN VALUE ⭐

  • On success — returns the instantaneous network speed of upload, with type float. Iconic. Slay. She delivers 💖
  • On error — return -1. Not the vibe, but at least she tells you 🥲

🦋 EXAMPLES 🦋

here's the whole thing, verbatim, no edits because I do NOT mess with code:

#include "stdio.h"
#include "libkyrealtimeinfo.h"

int main()
{
    // if(argc < 3)
    // {
    //     printf("./kyrealtime-test <网卡名> <磁盘名>0);
    //     return 0;
    // }
    printf("netSpeed : %f0, kdk_real_get_net_speed("enaftgm1i0"));
    printf("cpuTemp: %f0, kdk_real_get_cpu_temperature());
    printf("diskTemp : %d0, kdk_real_get_disk_temperature("/dev/nvme0n1"));
    printf("diskRate : %d0, kdk_real_get_disk_rate("/dev/nvme0n1"));
    printf("ifnetSpeed : %f0, kdk_real_get_if_speed("enaftgm1i0"));
    return 0;
}

see how she's calling her sisters too? kdk_real_get_cpu_temperature(), kdk_real_get_disk_temperature(), kdk_real_get_disk_rate(), kdk_real_get_if_speed() — it's a whole friend group fr fr 🫂


👑 CONFORMING TO 👑

These functions are as per the withdrawn POSIX.1e draft specification.

The following functions are Linux extensions:

  • kdk_real_get_cpu_temperature()
  • kdk_real_get_disk_temperature()
  • kdk_real_get_disk_rate()
  • kdk_real_get_if_speed()
the POSIX.1e draft is withdrawn bestie, so don't go looking for it in the current spec — and those four are Linux-only extensions, so they're lowkey special 🌈

💜 SEE ALSO 💜

go read them, they're the rest of the squad and they all ate 💅


and that's the page!! this one comes from the Linux Programmer's Manual, dated Tue Sep 19 2023 — so she's been serving since 2023 and she has not missed a day. mwah, love u, bye 🎀💖✨

📦 where this page comes from