linux u盘 慢

您所在的位置:网站首页 查看u盘传输速度的方法 linux u盘 慢

linux u盘 慢

2024-07-13 10:39| 来源: 网络整理| 查看: 265

http://www.firekyrin.com/archives/2974.html

dd命令测试

以下两条

time dd if=/dev/zero of=/mnt/usb/4g bs=1024 count=4000000

time dd if=/mnt/usb/4g bs=128k | dd of=/dev/null

USB速度测试命令

瑞士军刀busybox里面有hdparm命令,也可以用来测试读写速度,不过这个命令有点老了。

hdparm -Tt /dev/sdb1

输出结果:

Timing buffer-cache

reads: 68 MB

in 0.51 seconds = 136192 kB/s

Timing buffered disk reads: 30

MB in 3.00 seconds = 10211 kB/s

中断号:

169: 136 stx7105-level ehci_hcd:usb1

Timing buffer-cache

reads: 76 MB

in 0.51 seconds = 152415 kB/s

Timing buffered disk

reads: 3 MB

in 3.21 seconds = 955 kB/s

编程测试USB速度

如果愿意,我们还可以用编写程序的方法来测试USB口的速度,以下程序可以用来参考。

#include

#include

#include

#include

#include

#include

char filename[]=”dev/sdb1″;

int main(int argc, char** argv)

{

FILE *pfile;

struct timeval pretime,curtime;

float usec1,usec2,totalsec;

int num;

int count=20;

pfile = fopen(filename,”r”);

char *pmalloc = NULL;

if(pfile==NULL)

{

perror(“open fail\n”);

return 1;

}

pmalloc = (char *)malloc(1024*1024*1); //8MiB

if(pmalloc == NULL)

{

perror(“malloc fail\n”);

goto out2;

}

while(count)

{

gettimeofday(&pretime,NULL);

num = fread(pmalloc,1,1024*1024*1,pfile); //8MiB

if(num



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3