I created a ram drive using the function _io_mfs_install, and _io_register_file_system for the file system. I write to the disk using fwrite. All goes well without errors, but it is slow: around 45kB/s. Not what I expected of a ram drive. This is after compiler optimizations.
Any idea how to speed up the ram drive? What is the maximum it could theoretically reach?
Hi, Sint,
Is it convenient to paste your code so that we can review your code even have a test? what is the software tools and hardware platform you are using?
BR
XiangJun rong
Software tools and hardware platform: I run with KDS3.0.0 and SDK library 1.1, and run this on a Freescale K64F.
I created the following simplified code snippet, with all error checking removed. First a ram disk is created, then a file is written to it. Writing goes very slow:
//Simplified version of creating ramdisk without error checking |
const NIO_MEM_INIT_DATA_STRUCT NIO_MEM = { (uint32_t) myData, 8192};
_nio_dev_install(A_DEVICE, &nio_mem_dev_fn, (void *) &NIO_MEM) == NULL);
file_desc = open(A_DEVICE, 0);
io_mfs_install(file_desc, DISK, (_file_size) 0);
disk_file_desc = open(DISK, O_RDWR);
_io_register_file_system(disk_file_desc, DISK);
//write to a_file without error checking
a_file = fopen(a_file_name, "w");
fwrite(data_to_write, sizeof(char), size_of_data, a_file);
fclose(a_file)
Hope this code snippet helps.