Recently bought a 256GB SSD SSD, want to test the write speed, so the following operation.
Part of the code:
1Gettimeofday (&start, NULL);2 intFD = open ("Test1.dat", o_rdwr|o_creat);3 if(FD <0){4printf"Open error!\n");5 return 0;6 }7 //Lseek (FD, 0, seek_set);8 Write (FD, PData, Data_len);9 Close (FD);TenGettimeofday (&end, NULL); One A //display elapsed time in US -diff =1000000* (END.TV_SEC-START.TV_SEC) + (End.tv_usec-start.tv_usec); - theprintf"The data length is%d\n Byte", Data_len); -printf"The difference is%ld us\n", diff);
Test one, the data size 288,000 byte,5 times the maximum time, the write speed is about 288000 Byte/2058us = 133.46 MB/s
Test two, data size 1,440,000 byte = 1.37mb,5 takes the longest time, the write speed is about 1440000 byte/9356 US = 146.78 MB/s
Test three, data size 14,400,000 byte = 13.7mb,5 take maximum time, then write speed is about 14400000 byte/100234 US = 137.01mb/s
Test SSD write speed under Linux