.TH "KDK_REAL_GET_NET_SPEED" 3 "Tue Sep 19 2023" "Linux Programmer's Manual" \" .SH NAME kdk_real_get_net_speed - 获取上传的瞬时网速 .SH SYNOPSIS .nf .B #include .sp .BI "extern float kdk_real_get_net_speed(const char *"nc ");" .sp Link with \fI\-lkyrealtime\fP. .SH "Detailed Description" The main function of the interface is to obtain instantaneous internet speed for upload. .PP The argument .I nc is the name of the NIC, such as "eno1". .SH "RETURN VALUE" On success, returns the instantaneous network speed of upload with type float. .PP On error, return .BR -1. .SH EXAMPLES .EX #include "stdio.h" #include "libkyrealtimeinfo.h" int main() { // if(argc < 3) // { // printf("./kyrealtime-test <网卡名> <磁盘名>\n"); // return 0; // } printf("netSpeed : %f\n", kdk_real_get_net_speed("enaftgm1i0")); printf("cpuTemp: %f\n", kdk_real_get_cpu_temperature()); printf("diskTemp : %d\n", kdk_real_get_disk_temperature("/dev/nvme0n1")); printf("diskRate : %d\n", kdk_real_get_disk_rate("/dev/nvme0n1")); printf("ifnetSpeed : %f\n", kdk_real_get_if_speed("enaftgm1i0")); return 0; } .SH "CONFORMING TO" These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: .BR kdk_real_get_cpu_temperature (), .BR kdk_real_get_disk_temperature (), .BR kdk_real_get_disk_rate () and .BR kdk_real_get_if_speed (). .SH "SEE ALSO" .BR kdk_real_get_cpu_temperature (3), .BR kdk_real_get_disk_temperature (3), .BR kdk_real_get_disk_rate (3) and .BR kdk_real_get_if_speed (3).