linux系统usb hub速度测试

usb3.0 hub连接两个移动硬盘速度测试。

#include "stdio.h"
#include 
#include 

#define DATA_TRANSFER_SIZE 4096
#define LOOP_NUM 1000000
#define THREAD_NUM 2

void *thread0(void *param)
{
    FILE *pFile;
    unsigned char buff[DATA_TRANSFER_SIZE]={0};
    int i;

    pFile = fopen("/sdb1/test.txt","w");
    if(NULL == pFile)
    {
        printf("fopen error\n");
        return;
    }

    for(i=0; i

编译:gcc 源文件名 -lpthread

测试结果:

buffer,4096,totalsize,8192000000,speed,256383100.447844,start_time,1644486386,end_time,1644486418,end_time-start_time,32,timedif,31.952184
buffer,4096,totalsize,8192000000,speed,346642422.008206,start_time,1644486418,end_time,1644486442,end_time-start_time,24,timedif,23.632422

写速度:256MB/s

读速度:346MB/s

你可能感兴趣的:(linux,编程,linux,c语言)