kdk_real_get_if_speed(3)

kdk_real_get_if_speed3

获取下载的瞬时网速信息

Usage

#include <libkyrealtimeinfo.h>

extern float kdk_real_get_if_speed(const char *nc);

Link with -lkyrealtime.

Detailed Description

The main function of the interface is to obtain instantaneous network speed information for download.

The argument nc is the name of the NIC, such as "eno1".

Return value

On success, returns the instantaneous network speed of download with type float.

On error, return -1.

Examples

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

Conforming to

These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_real_get_net_speed(), kdk_real_get_cpu_temperature(), kdk_real_get_disk_temperature() and kdk_real_get_disk_rate().

From libkysdk-system 3.0.1.4-1 in Arch Linux 2026-11-07. Parsed by carta from the page's man source.