Portál AbcLinuxu, 12. května 2025 12:42
size_one_file count/s speed/s 1k 500 500k 10k 500 5M 100k 500 50M 1M 250 250M 10M 45 455M 100M ~5 495MBSource na vypocet:
#include <stdio.h> #include <stdlib.h> #define IO 500 #define BLOCK_SIZE 1000000 /* 1MB */ typedef struct { double max_files_in_minute; double max_data_speed; }writed_t; writed_t writed_in_one_s(long int size_one_file) { double count_blocks_of_file; writed_t ret; count_blocks_of_file=size_one_file/BLOCK_SIZE; ret.max_files_in_minute=IO/(count_blocks_of_file+1); /* plus name */ ret.max_data_speed=ret.max_files_in_minute*size_one_file; return ret; } int main(void) { writed_t speed; long int size_file; puts("size_one_file count/s speed/s"); for(size_file=1000; size_file<1000000000; size_file*=10) { speed=writed_in_one_s(size_file); printf("%15ld %5.2f %5.2f\n", size_file, speed.max_files_in_minute, speed.max_data_speed); } return 0; }
size_one_file count/s speed 1k 250.00 250k/s 10k 250.00 2,5M/s 100k 250.00 25M/s 1M 250.00 250M/s 10M 45.45 ~455MB/s 100M 4.95 ~495MB/s
writed_t writed_in_one_s(long int size_one_file) { double count_blocks_of_file; writed_t ret; if(size_one_file<=BLOCK_SIZE) count_blocks_of_file=1; else count_blocks_of_file=size_one_file/BLOCK_SIZE; ret.max_files_in_minute=((double)IO)/(count_blocks_of_file+1); /* plus name */ ret.max_data_speed=ret.max_files_in_minute*size_one_file; return ret; }
Když kopíruju velké soubory, jede to OK (cca 100MB/s). Když kopíruju velké množství malých souborů (1GB v 50000 souborech), rychlost klesá pod 10MB/s.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.