[メモ] RaspberryPi: microSDのクロックアップとベンチマーク

## まとめ
- Sandisk Extreme microSDHC 16GB <font color='blue'>**R**</font>ead:**74.34MB/s** / <font color='red'>**W**</font>rite:**53.58MB/s** (Win7_64 + CrystalDiskBenchにて))

	```txt:RPi3
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   400        0      50.000 MHz   20.85 MB/s   21.91 MB/s   22.15 MB/s
	dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz   22.89 MB/s   34.67 MB/s   34.58 MB/s
	```

	```txt:RPi2にて
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   250        0      50.000 MHz   20.55 MB/s   21.71 MB/s   21.93 MB/s
	dtoverlay=sdhost,overclock_50=63       250        0      62.500 MHz   22.64 MB/s   26.75 MB/s   27.09 MB/s
	dtoverlay=sdhost,overclock_50=84       250        0      83.333 MHz   22.98 MB/s   34.88 MB/s   35.41 MB/s
	```

	```txt:ASUS_TinkerBoard(参考)
	Overlay config                      core_freq   turbo   mmc0:BusSpeed   WRITE        READ        HDPARM
										   ???        ?     148.500 MHz   45.88 MB/s   50.97 MB/s   43.67 MB/s
	```


## 概要
- らずぱいでの microSDのベンチマークでも... と、ぐーぐる先生にお尋ねしてたら、らずぱいで、SDのクロックアップできるよ、という記事を発見。
- > [How to overclock the microSD card reader on a Raspberry Pi 3](https://www.jeffgeerling.com/blog/2016/how-overclock-microsd-card-reader-on-raspberry-pi-3)
- `/boot/config.txt`を書き換えるだけ。
- だが、<font color='red'>**正常に動作しないのもある**</font>。(起動できても、計測中におかしくなるのもあった)
- `core_freq`を整数で割ったクロックをSDに提供できる、っぽい。
    - RPi3 : core_freq=400なので、`overclock_50=` 100/80/67/58/50あたり
    - RPi0,1,2: core_freq=250なので、`overclock_50=` 100/84/63/50あたり
- RPi2/3とも、READで1.6倍くらい(21->34MB/s)、Writeで 1.1倍(21->23MB/s)速くなった。(うちにある一番速いmicroSDを使って、ベンチマークテストの上では..)




## 環境
- Raspberry Pi 3 クーリングファン付
- Raspberry Pi 2 ヒートシンク付 (SanDisk Extremeのみ計測)
- Raspbian: `2017-03-02-raspbian-jessie-lite.img` (アップデート無し)
    1. `ssh`と`wpa_supplicant.conf`(Wifi設定)をbootパーティションへ
    2. 起動直後: `sudo apt-get update && sudo apt-get install -y hdparm curl build-essential`

- `config.txt`で、sdをクロックアップ
    - `sudo bash -c 'printf "dtoverlay=sdhost,overclock_50=100\n" >> /boot/config.txt'`
<br>Wifiがおかしいとき(??)、
    - `sudo bash -c 'printf "dtoverlay=sdtweak,overclock_50=100\n" >> /boot/config.txt'`

        ```shell-session:overclocking~~~というのが出てくる
pi@raspberrypi:~ $ dmesg | grep mmc0
[    0.879166] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.936907] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.983164] mmc0: overclocking to 100000000Hz
[    0.985417] mmc0: new high speed SDHC card at address 0007
[    0.988083] mmcblk0: mmc0:0007 SD8GB 7.42 GiB
pi@raspberrypi:~ $ 
```

## テスト手順
- Windows7 64bitで、CrystalDsiakMarkにて、microSDの速度を測る
    - USB3.0カードリーダ [IOGEAR GFR304SD](https://www.iogear.com/product/GFR304SD/)使用
- `curl http://www.nmacleod.com/public/sdbench.sh | sudo bash`

    ```bash:sdbench.sh
...
HDCMD="hdparm -t --direct /dev/mmcblk0 | grep Timing"
WRCMD="rm -f ${FILENM} && sync && dd if=/dev/zero of=${FILENM} bs=1M count=${DATAMB} conv=fsync 2>&1 | grep -v records"
RDCMD="echo 3 > /proc/sys/vm/drop_caches && sync && dd if=${FILENM} of=/dev/null bs=1M 2>&1 | grep -v records"
...
```

<!--
- `curl https://raw.githubusercontent.com/geerlingguy/raspberry-pi-dramble/master/setup/benchmarks/microsd-benchmarks.sh | sudo bash`
-->

## 結果
- Kingston Digital 8 GB microSDHC Class 10 UHS-1 Memory Card 30MB/s with Adapter (SDC10/8GB)
<img src="https://images-na.ssl-images-amazon.com/images/I/71j5YDfUxML._SL1500_.jpg" width=240px>
<img src="https://qiita-image-store.s3.amazonaws.com/0/75594/884d7cf5-a44f-0e96-ac94-827de5a9ffa5.png" width="240">

    ```txt:RPi3
    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                           400        0      50.000 MHz    9.24 MB/s   18.73 MB/s   21.10 MB/s
    dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz    8.17 MB/s   19.00 MB/s   21.07 MB/s
```

<!--
```
CONFIG: 
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  64 MB in  3.03 seconds =  21.10 MB/sec
 Timing O_DIRECT disk reads:  64 MB in  3.03 seconds =  21.10 MB/sec
 Timing O_DIRECT disk reads:  64 MB in  3.04 seconds =  21.09 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 55.6614 s, 9.6 MB/s
536870912 bytes (537 MB) copied, 54.1052 s, 9.9 MB/s
536870912 bytes (537 MB) copied, 56.4969 s, 9.5 MB/s

READ:
====
536870912 bytes (537 MB) copied, 27.3297 s, 19.6 MB/s
536870912 bytes (537 MB) copied, 27.3344 s, 19.6 MB/s
536870912 bytes (537 MB) copied, 27.3414 s, 19.6 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz    9.24 MB/s   18.73 MB/s   21.10 MB/s
pi@raspberrypi:~ $ 
```

```
CONFIG: 
CLOCK : 100.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  62 MB in  3.07 seconds =  20.22 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.07 seconds =  21.53 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.07 seconds =  21.51 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 66.033 s, 8.1 MB/s
536870912 bytes (537 MB) copied, 61.4464 s, 8.7 MB/s
536870912 bytes (537 MB) copied, 60.7893 s, 8.8 MB/s

READ:
====
536870912 bytes (537 MB) copied, 27.1877 s, 19.7 MB/s
536870912 bytes (537 MB) copied, 27.1025 s, 19.8 MB/s
536870912 bytes (537 MB) copied, 26.5394 s, 20.2 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0     100.000 MHz    8.17 MB/s   19.00 MB/s   21.07 MB/s
pi@raspberrypi:~ $ 
```
-->

- PiZEROのセットを買ったときついてきたmicroSD (Ultimate 3.0 **70MB/s** 8GB とかいてある)<br><img src="https://qiita-image-store.s3.amazonaws.com/0/75594/5b51fe8f-0af8-e462-8468-dcf8e85f4cd6.png" width="240">
リードは 70MB/s超えてるんだけどね...

    ```txt:RPi3
    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                           400        0      50.000 MHz    7.05 MB/s   20.39 MB/s   21.10 MB/s
    dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz    7.18 MB/s   30.39 MB/s   28.81 MB/s
```

<!--
```
CONFIG: 
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  64 MB in  3.04 seconds =  21.03 MB/sec
 Timing O_DIRECT disk reads:  64 MB in  3.05 seconds =  21.02 MB/sec
 Timing O_DIRECT disk reads:  64 MB in  3.01 seconds =  21.25 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 72.3713 s, 7.4 MB/s
536870912 bytes (537 MB) copied, 72.4103 s, 7.4 MB/s
536870912 bytes (537 MB) copied, 73.0803 s, 7.3 MB/s

READ:
====
536870912 bytes (537 MB) copied, 25.0953 s, 21.4 MB/s
536870912 bytes (537 MB) copied, 25.1085 s, 21.4 MB/s
536870912 bytes (537 MB) copied, 25.1145 s, 21.4 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz    7.05 MB/s   20.39 MB/s   21.10 MB/s
pi@raspberrypi:~ $ 
CONFIG: 
CLOCK : 100.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  94 MB in  3.12 seconds =  30.14 MB/sec
 Timing O_DIRECT disk reads:  80 MB in  3.02 seconds =  26.47 MB/sec
 Timing O_DIRECT disk reads:  90 MB in  3.02 seconds =  29.82 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 70.5918 s, 7.6 MB/s
536870912 bytes (537 MB) copied, 71.8056 s, 7.5 MB/s
536870912 bytes (537 MB) copied, 71.3871 s, 7.5 MB/s

READ:
====
536870912 bytes (537 MB) copied, 17.1851 s, 31.2 MB/s
536870912 bytes (537 MB) copied, 16.5308 s, 32.5 MB/s
536870912 bytes (537 MB) copied, 16.8291 s, 31.9 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0     100.000 MHz    7.18 MB/s   30.39 MB/s   28.81 MB/s
pi@raspberrypi:~ $ 
```
-->

- Sandisk Extreme MICROSDHC 16GB 90MB/S Flash Memory Card(たぶん..)
[<img src="https://images-na.ssl-images-amazon.com/images/I/616S8HPfKgL._SL1500_.jpg" width=160px>](https://www.sandisk.com/home/memory-cards/microsd-cards/extreme-microsd)
<img src="https://qiita-image-store.s3.amazonaws.com/0/75594/1442a36d-b0ea-2331-7b41-0b83e5686c5c.png" width="240">

    ```txt:RPi3
    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                           400        0      50.000 MHz   20.85 MB/s   21.91 MB/s   22.15 MB/s
    dtoverlay=sdtweak,overclock_50=100     400        0     100.000 MHz   22.89 MB/s   34.67 MB/s   34.58 MB/s
    ```

	```txt:RPi2にて
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   250        0      50.000 MHz   20.55 MB/s   21.71 MB/s   21.93 MB/s
	dtoverlay=sdhost,overclock_50=63       250        0      62.500 MHz   22.64 MB/s   26.75 MB/s   27.09 MB/s
	dtoverlay=sdhost,overclock_50=84       250        0      83.333 MHz   22.98 MB/s   34.88 MB/s   35.41 MB/s
	```

<!--

```
Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Installing iozone...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1800k  100 1800k    0     0   770k      0  0:00:02  0:00:02 --:--:--  770k

Building iozone for Linux-arm


Building fileop for Linux-arm


Building the pit_server

Install complete!

Running hdparm test...

/dev/mmcblk0:
 Timing buffered disk reads:  66 MB in  3.01 seconds =  21.91 MB/sec

Running dd test...

51200+0 records in
51200+0 records out
419430400 bytes (419 MB) copied, 19.0519 s, 22.0 MB/s

Running iozone test...
	Iozone: Performance Test of File I/O
	        Version $Revision: 3.434 $
		Compiled for 32 bit mode.
		Build: linux-arm 

	Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
	             Al Slater, Scott Rhine, Mike Wisner, Ken Goss
	             Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
	             Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
	             Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
	             Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
	             Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
	             Vangel Bojaxhi, Ben England, Vikentsi Lapa,
	             Alexey Skidanov.

	Run began: Sun Apr  9 21:59:47 2017

	Include fsync in write timing
	O_DIRECT feature enabled
	Auto Mode
	File size set to 102400 kB
	Record Size 4 kB
	Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
	Output is in kBytes/sec
	Time Resolution = 0.000001 seconds.
	Processor cache size set to 1024 kBytes.
	Processor cache line size set to 32 bytes.
	File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride                                    
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4     2241     2686     8188     8188     8244     2323                                                                

iozone test complete.

microSD card benchmark complete!
```

```
pi@raspberrypi:~ $ curl http://www.nmacleod.com/public/sdbench.sh | sudo bash
CONFIG: 
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  68 MB in  3.07 seconds =  22.16 MB/sec
 Timing O_DIRECT disk reads:  68 MB in  3.07 seconds =  22.14 MB/sec
 Timing O_DIRECT disk reads:  68 MB in  3.07 seconds =  22.12 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 25.0595 s, 21.4 MB/s
536870912 bytes (537 MB) copied, 24.3359 s, 22.1 MB/s
536870912 bytes (537 MB) copied, 24.2827 s, 22.1 MB/s

READ:
====
536870912 bytes (537 MB) copied, 23.391 s, 23.0 MB/s
536870912 bytes (537 MB) copied, 23.3641 s, 23.0 MB/s
536870912 bytes (537 MB) copied, 23.3344 s, 23.0 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz   20.85 MB/s   21.91 MB/s   22.15 MB/s
pi@raspberrypi:~ $ 
```
```
pi@raspberrypi:~ $ curl https://raw.githubusercontent.com/geerlingguy/raspberry-pi-dramble/master/setup/benchmarks/microsd-benchmarks.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2104  100  2104    0     0   9030      0 --:--:-- --:--:-- --:--:--  9030

Raspberry Pi Dramble microSD benchmarks
microSD clock: 100.000 MHz

Running hdparm test...

/dev/mmcblk0:
 Timing buffered disk reads: 102 MB in  3.01 seconds =  33.87 MB/sec

Running dd test...

51200+0 records in
51200+0 records out
419430400 bytes (419 MB) copied, 17.0859 s, 24.5 MB/s

Running iozone test...
	Iozone: Performance Test of File I/O
	        Version $Revision: 3.434 $
		Compiled for 32 bit mode.
		Build: linux-arm 

	Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
	             Al Slater, Scott Rhine, Mike Wisner, Ken Goss
	             Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
	             Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
	             Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
	             Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
	             Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
	             Vangel Bojaxhi, Ben England, Vikentsi Lapa,
	             Alexey Skidanov.

	Run began: Sun Apr  9 22:28:59 2017

	Include fsync in write timing
	O_DIRECT feature enabled
	Auto Mode
	File size set to 102400 kB
	Record Size 4 kB
	Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
	Output is in kBytes/sec
	Time Resolution = 0.000001 seconds.
	Processor cache size set to 1024 kBytes.
	Processor cache line size set to 32 bytes.
	File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride                                    
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4     2173     2804     9394     9358     9554     2306                                                                

iozone test complete.

microSD card benchmark complete!

pi@raspberrypi:~ $ curl http://www.nmacleod.com/public/sdbench.sh | sudo bash
CONFIG: 
CLOCK : 100.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads: 104 MB in  3.01 seconds =  34.56 MB/sec
 Timing O_DIRECT disk reads: 106 MB in  3.06 seconds =  34.68 MB/sec
 Timing O_DIRECT disk reads: 104 MB in  3.01 seconds =  34.59 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 23.0608 s, 23.3 MB/s
536870912 bytes (537 MB) copied, 21.4762 s, 25.0 MB/s
536870912 bytes (537 MB) copied, 22.634 s, 23.7 MB/s

READ:
====
536870912 bytes (537 MB) copied, 14.7513 s, 36.4 MB/s
536870912 bytes (537 MB) copied, 14.7758 s, 36.3 MB/s
536870912 bytes (537 MB) copied, 14.7818 s, 36.3 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0     100.000 MHz   22.89 MB/s   34.67 MB/s   34.58 MB/s
pi@raspberrypi:~ $
```
-->

<!--
RPi2
CONFIG: 
CLOCK : 50.000 MHz
CORE  : 250 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  66 MB in  3.01 seconds =  21.96 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.01 seconds =  21.94 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.01 seconds =  21.94 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 24.9468 s, 21.5 MB/s
536870912 bytes (537 MB) copied, 24.9179 s, 21.5 MB/s
536870912 bytes (537 MB) copied, 24.8924 s, 21.6 MB/s

READ:
====
536870912 bytes (537 MB) copied, 23.5546 s, 22.8 MB/s
536870912 bytes (537 MB) copied, 23.592 s, 22.8 MB/s
536870912 bytes (537 MB) copied, 23.5917 s, 22.8 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       250        0      50.000 MHz   20.55 MB/s   21.71 MB/s   21.93 MB/s

									   CONFIG: dtoverlay=sdhost,overclock_50=84
CLOCK : 83.333 MHz
CORE  : 250 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads: 108 MB in  3.05 seconds =  35.35 MB/sec
 Timing O_DIRECT disk reads: 108 MB in  3.05 seconds =  35.36 MB/sec
 Timing O_DIRECT disk reads: 108 MB in  3.05 seconds =  35.38 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 22.2646 s, 24.1 MB/s
536870912 bytes (537 MB) copied, 22.2604 s, 24.1 MB/s
536870912 bytes (537 MB) copied, 22.3249 s, 24.0 MB/s

READ:
====
536870912 bytes (537 MB) copied, 14.6199 s, 36.7 MB/s
536870912 bytes (537 MB) copied, 14.7145 s, 36.5 MB/s
536870912 bytes (537 MB) copied, 14.7042 s, 36.5 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
dtoverlay=sdhost,overclock_50=84       250        0      83.333 MHz   22.98 MB/s   34.88 MB/s   35.41 MB/s
pi@raspberrypi:~ $ 
CONFIG: dtoverlay=sdhost,overclock_50=63
CLOCK : 62.500 MHz
CORE  : 250 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  82 MB in  3.02 seconds =  27.17 MB/sec
 Timing O_DIRECT disk reads:  82 MB in  3.03 seconds =  27.10 MB/sec
 Timing O_DIRECT disk reads:  82 MB in  3.03 seconds =  27.11 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 22.7526 s, 23.6 MB/s
536870912 bytes (537 MB) copied, 22.6392 s, 23.7 MB/s
536870912 bytes (537 MB) copied, 22.468 s, 23.9 MB/s

READ:
====
536870912 bytes (537 MB) copied, 19.1136 s, 28.1 MB/s
536870912 bytes (537 MB) copied, 19.1726 s, 28.0 MB/s
536870912 bytes (537 MB) copied, 19.1325 s, 28.1 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
dtoverlay=sdhost,overclock_50=63       250        0      62.500 MHz   22.64 MB/s   26.75 MB/s   27.09 MB/s
pi@raspberrypi:~ $ 
-->


- Samsung Electronics 32GB EVO Micro SDHC UHS-I Upto 48MB/s Class 10 Memory Card (MB-MP32D)
[<img src="http://s7d2.scene7.com/is/image/SamsungUS/Pdpdefault-mb-mp32da-am-600x600-C1-052016?$product-details-jpg$" width=128px>](http://www.samsung.com/us/computing/memory-storage/memory-cards/microsdhc-32gb-evo-memory-card-with-adapter-mb-mp32da-am/)
<img src="https://qiita-image-store.s3.amazonaws.com/0/75594/884d7cf5-a44f-0e96-ac94-827de5a9ffa5.png" width="240">

    ```txt:RPi3
    Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                           400        0      50.000 MHz   18.16 MB/s   21.56 MB/s   21.76 MB/s
    dtoverlay=sdtweak,overclock_50=80      400        0      80.000 MHz   18.98 MB/s   23.35 MB/s   24.47 MB/s
    ```
    - 100MHz設定では、カードエラーがでて正常動作しなかった。

<!--

```
pi@raspberrypi:~ $ dmesg | grep mmc0
[    0.879194] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.936032] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.981397] mmc0: new high speed SDHC card at address 0001
[    0.981987] mmcblk0: mmc0:0001 00000 29.8 GiB
pi@raspberrypi:~ $ sync; sync ; sleep 5;  curl https://raw.githubusercontent.com/geerlingguy/raspberry-pi-dramble/master/setup/benchmarks/microsd-benchmarks.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2104  100  2104    0     0  16108      0 --:--:-- --:--:-- --:--:-- 16184

Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Running hdparm test...

/dev/mmcblk0:
 Timing buffered disk reads:  66 MB in  3.06 seconds =  21.53 MB/sec

Running dd test...

51200+0 records in
51200+0 records out
419430400 bytes (419 MB) copied, 22.3775 s, 18.7 MB/s

Running iozone test...
	Iozone: Performance Test of File I/O
	        Version $Revision: 3.434 $
		Compiled for 32 bit mode.
		Build: linux-arm 

	Contributors:William Norcott, Don Capps, Isom Crawford, Kirby Collins
	             Al Slater, Scott Rhine, Mike Wisner, Ken Goss
	             Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
	             Randy Dunlap, Mark Montague, Dan Million, Gavin Brebner,
	             Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave Boone,
	             Erik Habbinga, Kris Strecker, Walter Wong, Joshua Root,
	             Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren Sawyer,
	             Vangel Bojaxhi, Ben England, Vikentsi Lapa,
	             Alexey Skidanov.

	Run began: Sun Apr  9 20:02:29 2017

	Include fsync in write timing
	O_DIRECT feature enabled
	Auto Mode
	File size set to 102400 kB
	Record Size 4 kB
	Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
	Output is in kBytes/sec
	Time Resolution = 0.000001 seconds.
	Processor cache size set to 1024 kBytes.
	Processor cache line size set to 32 bytes.
	File stride size set to 17 * record size.
                                                              random    random     bkwd    record    stride                                    
              kB  reclen    write  rewrite    read    reread    read     write     read   rewrite      read   fwrite frewrite    fread  freread
          102400       4     3085     2845     7551     7545     7509     3018                                                                

iozone test complete.

microSD card benchmark complete!

pi@raspberrypi:~ $ 
```

```
pi@raspberrypi:~ $ curl http://www.nmacleod.com/public/sdbench.sh | sudo bash

CONFIG: 
CLOCK : 50.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  66 MB in  3.04 seconds =  21.74 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.03 seconds =  21.77 MB/sec
 Timing O_DIRECT disk reads:  66 MB in  3.03 seconds =  21.77 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 28.0995 s, 19.1 MB/s
536870912 bytes (537 MB) copied, 28.1899 s, 19.0 MB/s
536870912 bytes (537 MB) copied, 28.3037 s, 19.0 MB/s

READ:
====
536870912 bytes (537 MB) copied, 23.7563 s, 22.6 MB/s
536870912 bytes (537 MB) copied, 23.7442 s, 22.6 MB/s
536870912 bytes (537 MB) copied, 23.7367 s, 22.6 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      50.000 MHz   18.16 MB/s   21.56 MB/s   21.76 MB/s
CONFIG: 
CLOCK : 80.000 MHz
CORE  : 400 MHz, turbo=0
DATA  : 512 MB, /root/test.dat

HDPARM:
======
 Timing O_DIRECT disk reads:  78 MB in  3.03 seconds =  25.71 MB/sec
 Timing O_DIRECT disk reads:  72 MB in  3.01 seconds =  23.89 MB/sec
 Timing O_DIRECT disk reads:  72 MB in  3.03 seconds =  23.80 MB/sec

WRITE:
=====
536870912 bytes (537 MB) copied, 26.8879 s, 20.0 MB/s
536870912 bytes (537 MB) copied, 27.2114 s, 19.7 MB/s
536870912 bytes (537 MB) copied, 26.8244 s, 20.0 MB/s

READ:
====
536870912 bytes (537 MB) copied, 21.2515 s, 25.3 MB/s
536870912 bytes (537 MB) copied, 22.701 s, 23.6 MB/s
536870912 bytes (537 MB) copied, 21.8843 s, 24.5 MB/s

RESULT (AVG):
============
Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
                                       400        0      80.000 MHz   18.98 MB/s   23.35 MB/s   24.47 MB/s

```
-->


## その他

- 追記2017-0411:　RPi3 + SanDiskExtreme16GBにて、`overclock_50=134`=> 133.33MHzは、だめだった(133,125とトライして、100MHzまでおちる) 

    ```shell-session:overclock_50=134...はだめだった
pi@raspberrypi:~ $ grep overclock_50 /boot/config.txt 
dtoverlay=sdtweak,overclock_50=134
pi@raspberrypi:~ $ dmesg | grep mmc0
[    0.878893] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    0.956086] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.985908] mmc0: overclocking to 133333333Hz
[    0.988111] mmc0: unexpected command 55 error
[    0.990268] mmc0: reducing overclock due to errors
[    0.992463] mmc0: overclocking to 125000000Hz
[    0.994536] mmc0: unexpected command 55 error
[    0.996580] mmc0: reducing overclock due to errors
[    0.998689] mmc0: overclocking to 100000000Hz
[    1.002811] mmc0: new high speed SDHC card at address aaaa
[    1.005335] mmcblk0: mmc0:aaaa SE16G 14.8 GiB
pi@raspberrypi:~ $ 
```


- おまけ: ASUS Tinker Board にて : `20170330-tinker-board-linaro-jessie-alip-v1.6.img`使用

	```txt
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   0        0                   45.88 MB/s   50.97 MB/s   43.67 MB/s
    ----
	Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux	
	[    2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
	```

	```txt:らずぱいと同じスクリプトを実行したので、それっぽいとこでエラーでてるが、測定値はOK、かと。
	sudo apt-get update && sudo apt-get install -y hdparm curl build-essential
	curl http://www.nmacleod.com/public/sdbench.sh | sudo bash
	dmesg | grep mmc0
	uname -a
	...
	...
	...
	grep: /boot/config.txt: No such file or directory
	bash: line 46: vcgencmd: command not found
	bash: line 47: vcgencmd: command not found
	bash: line 48: vcgencmd: command not found
	cat: /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy: No such file or directory
	CONFIG: 
	CLOCK : 
	CORE  :  MHz, turbo=
	DATA  : 512 MB, /root/test.dat

	HDPARM:
	======
	 Timing O_DIRECT disk reads: 128 MB in  3.04 seconds =  42.05 MB/sec
	 Timing O_DIRECT disk reads: 132 MB in  3.02 seconds =  43.70 MB/sec
	 Timing O_DIRECT disk reads: 136 MB in  3.01 seconds =  45.15 MB/sec

	WRITE:
	=====
	536870912 bytes (537 MB) copied, 11.2337 s, 47.8 MB/s
	536870912 bytes (537 MB) copied, 11.0605 s, 48.5 MB/s
	536870912 bytes (537 MB) copied, 11.1862 s, 48.0 MB/s

	READ:
	====
	536870912 bytes (537 MB) copied, 10.2028 s, 52.6 MB/s
	536870912 bytes (537 MB) copied, 11.2799 s, 47.6 MB/s
	536870912 bytes (537 MB) copied, 8.92718 s, 60.1 MB/s

	RESULT (AVG):
	============
	Overlay config                      core_freq   turbo   overclock_50    WRITE        READ        HDPARM
										   0        0                   45.88 MB/s   50.97 MB/s   43.67 MB/s
	linaro@linaro-alip:~$ dmesg | grep mmc0
	[    2.897976] mmc_host mmc0: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, actual 400000HZ div = 0)
	[    2.998529] mmc_host mmc0: Bus speed (slot 0) = 148500000Hz (slot req 150000000Hz, actual 148500000HZ div = 0)
	[    3.689367] mmc0: new ultra high speed SDR104 SDHC card at address aaaa
	[    3.692071] mmcblk0: mmc0:aaaa SE16G 14.8 GiB 
	linaro@linaro-alip:~$ uname -a
	Linux linaro-alip 4.4.16 #1 SMP Thu Mar 30 22:22:19 CST 2017 armv7l GNU/Linux
	linaro@linaro-alip:~$ 
	```