[openfirmware] [commit] r1915 - in cpu/x86: . pc/olpc pc/olpc/via
repository service
svn at openfirmware.info
Thu Aug 5 02:46:03 CEST 2010
Author: wmb
Date: Thu Aug 5 02:46:03 2010
New Revision: 1915
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1915
Log:
OLPC - new ".speed" command for measuring read/write speeds of mass storage devices.
Added:
cpu/x86/pc/olpc/diskspeed.fth
Modified:
cpu/x86/acpitimer.fth
cpu/x86/pc/olpc/fw.bth
cpu/x86/pc/olpc/via/fw.bth
cpu/x86/tsc.fth
Modified: cpu/x86/acpitimer.fth
==============================================================================
--- cpu/x86/acpitimer.fth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/acpitimer.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -71,8 +71,9 @@
\ Subtracting 10 accounts for the time it takes to read the ACPI timer,
\ which is an I/O port and therefore slow to read
: ))t1 ( -- d.ticks ) get-timer timestamp 2@ d- d# 10. d- 0. dmax ;
+: ))t-usecs ( -- usec ) ))t1 acpi-ticks>usecs ;
: )t ( -- )
- ))t1 acpi-ticks>usecs ( microseconds )
+ ))t-usecs ( microseconds )
push-decimal
<# u# u# u# [char] , hold u# u#s u#> type ." uS "
pop-base
Added: cpu/x86/pc/olpc/diskspeed.fth
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ cpu/x86/pc/olpc/diskspeed.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -0,0 +1,77 @@
+\ See license at end of file
+purpose: Disk raw read/write speed test
+
+\ Example: ok .speed ext:0
+\
+\ The test is non-destructive unless a write failure occurs.
+\ It reads first, then writes the same data back.
+
+0 value disk-ih
+0 value disk-speed-transfer
+0 value disk-speed-#blocks
+0 value disk-speed-/block
+0 value disk-speed-total-blocks
+h# 200.0000 constant disk-speed-len \ 32 MB
+
+: .mb/sec ( usecs -- )
+ disk-speed-len d# 20 rot */ ( 20*mb/sec )
+ 1+ 2/ ( 10*mb/sec-rounded )
+ push-decimal
+ <# u# [char] . hold u#s u#> type
+ pop-base
+ ." Mb/sec"
+;
+: .speed ( "devname" -- )
+ safe-parse-word open-dev to disk-ih
+ disk-ih 0= abort" Can't open device"
+ " block-size" disk-ih $call-method to disk-speed-/block
+
+ " max-transfer" disk-ih $call-method to disk-speed-transfer
+ disk-speed-transfer disk-speed-/block / to disk-speed-#blocks
+
+ disk-speed-len disk-speed-/block / to disk-speed-total-blocks
+
+ ." Read speed: "
+ t(
+ disk-speed-total-blocks 0 do
+ load-base i disk-speed-/block * + ( adr )
+ i disk-speed-#blocks " read-blocks" disk-ih $call-method drop
+ disk-speed-#blocks +loop
+ ))t-usecs ( usecs )
+ .mb/sec space
+
+ ." Write speed: "
+ t(
+ disk-speed-total-blocks 0 do
+ load-base i disk-speed-/block * + ( adr )
+ i disk-speed-#blocks " write-blocks" disk-ih $call-method drop
+ disk-speed-#blocks +loop
+ ))t-usecs ( usecs )
+ .mb/sec cr
+
+ disk-ih close-dev
+;
+
+\ LICENSE_BEGIN
+\ Copyright (c) 2010 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Modified: cpu/x86/pc/olpc/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/fw.bth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/pc/olpc/fw.bth Thu Aug 5 02:46:03 2010 (r1915)
@@ -679,6 +679,8 @@
\ Fancy battery charge logger.
fload ${BP}/cpu/x86/pc/olpc/charge.fth
+fload ${BP}/cpu/x86/pc/olpc/diskspeed.fth \ Mass storage speed test
+
\ This helps with TeraTerm, which sends ESC-O as the arrow key prefix
also hidden also keys-forth definitions
warning @ warning off
Modified: cpu/x86/pc/olpc/via/fw.bth
==============================================================================
--- cpu/x86/pc/olpc/via/fw.bth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/pc/olpc/via/fw.bth Thu Aug 5 02:46:03 2010 (r1915)
@@ -748,6 +748,8 @@
\ Fancy battery charge logger.
fload ${BP}/cpu/x86/pc/olpc/charge.fth
+fload ${BP}/cpu/x86/pc/olpc/diskspeed.fth \ Mass storage speed test
+
\ This helps with TeraTerm, which sends ESC-O as the arrow key prefix
also hidden also keys-forth definitions
warning @ warning off
Modified: cpu/x86/tsc.fth
==============================================================================
--- cpu/x86/tsc.fth Thu Aug 5 02:37:12 2010 (r1914)
+++ cpu/x86/tsc.fth Thu Aug 5 02:46:03 2010 (r1915)
@@ -46,8 +46,9 @@
: t-update ;
: t( ( -- ) tsc@ timestamp 2! ;
: ))t ( -- d.ticks ) tsc@ timestamp 2@ d- ;
+: ))t-usecs ( -- usecs ) ))t us-factor um/mod nip ;
: )t ( -- )
- ))t us-factor um/mod nip ( microseconds )
+ ))t-usecs ( microseconds )
push-decimal
<# u# u# u# [char] , hold u# u#s u#> type ." uS "
pop-base
More information about the openfirmware
mailing list