简体   繁体   English

Linux机器上的SD卡吞吐量

[英]SD card throughput on Linux machine

I'm trying to run a custom application on an embedded Linux platform (Linux 4.1). 我正在尝试在嵌入式Linux平台(Linux 4.1)上运行自定义应用程序。 This application writes 1 MB of data continuously to the SD card (Sandisk UHS I class). 该应用程序将1 MB的数据连续写入SD卡(Sandisk UHS I类)。 The application uses an fwrite() call to write the data to the SD card. 该应用程序使用fwrite()调用将数据写入SD卡。

Below are my observations when the SD card write throughput was monitored. 以下是监视SD卡写入吞吐量时的观察结果。

  1. The average throughout is around 10 Mbytes per sec. 整个过程的平均速度约为每秒10 MB。
  2. The instantaneous throughput (measured per 1 MB transfer) drops after every 50 MB data is written. 写入每50 MB数据后,瞬时吞吐量(每1 MB传输测量)下降。 The throughput drops as low as 200kbytes per sec. 吞吐量下降到每秒200 KB。
  3. I have tried using write() system call instead of fwrite() , with O_SYNC flag set. 我尝试使用具有O_SYNC标志设置的write()系统调用而不是fwrite() With this, the instantaneous throughput has increased to 1MBps. 这样,瞬时吞吐量已提高到1MBps。

The SD card spec says the minimum throughput supported is 10 MBps. SD卡规范说,支持的最小吞吐量为10 MBps。 Why does the instantaneous throughput drop? 为什么瞬时吞吐量下降?

Is this behaviour expected? 这是预期的行为吗? What is limiting the instantaneous throughput? 什么限制了瞬时吞吐量?

My application requires minimum instantaneous throughput of 4MBps. 我的应用程序要求最小瞬时吞吐量为4MBps。 What should I do? 我该怎么办?

  1. Make sure that the interface and the driver connecting your embedded linux device with the SD-card supports the throughput. 确保将嵌入式Linux设备与SD卡相连的接口和驱动程序支持吞吐量。 (Eg when it's connected via "Bitbanging" the throughput could be much less than what you expect). (例如,通过“ Bitbanging”进行连接时,吞吐量可能远远低于您的预期)。
  2. Test the throughput with a well known tool (dd) and flush the cache before: sync; 使用众所周知的工具(dd)测试吞吐量,然后刷新缓存: echo 3 | 回声3 | sudo tee /proc/sys/vm/drop_caches dd if=/dev/zero of= bs=500K count=2024 sudo tee / proc / sys / vm / drop_caches dd if = / dev / zero of = bs = 500K count = 2024
  3. And finally please refer to: https://raspberrypi.stackexchange.com/questions/32884/why-does-the-sd-card-random-write-performance-for-record-size-8-128-kb-drops-bel 最后请参考: https : //raspberrypi.stackexchange.com/questions/32884/why-does-the-sd-card-random-write-performance-for-record-size-8-128-kb-drops-贝尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM