1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { const int size = 128 * 1024 * 1024 ; FILE *fp = fopen("data.txt","rb"); char buffer[1024]; clock_t start = clock(); for(int i = 0 ; i < 128 * 1024 ; i++) { fread(buffer, 1024, 1, fp); } clock_t end = clock(); double t = (double) (end - start)/CLOCKS_PER_SEC; printf("time = %f\n",t); return 0; } |
Direct link: https://paste.plurk.com/show/991066