File Speed v0.3 - added test of write speed and some gui changes

git-svn-id: svn://kolibrios.org@4857 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2014-04-18 23:23:40 +00:00
parent 8a3102bfde
commit 4512b4b48f
2 changed files with 199 additions and 58 deletions

View File

@ -42,9 +42,17 @@ include '../../macros.inc'
define __DEBUG__ 1 define __DEBUG__ 1
define __DEBUG_LEVEL__ 1 define __DEBUG_LEVEL__ 1
include '../../debug-fdo.inc' include '../../debug-fdo.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/load_lib.mac'
@use_library @use_library
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
struct RESULT_SLOT
text dd ?
read_speed dd ?
write_speed dd ?
chunk_size dd ?
ends
;-----------------------------------------------------------------------------
START: START:
DEBUGF 1,'FSPEED: start of programm\n' DEBUGF 1,'FSPEED: start of programm\n'
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -61,6 +69,11 @@ load_libraries l_libs_start,end_l_libs
;OpenDialog initialisation ;OpenDialog initialisation
push dword OpenDialog_data push dword OpenDialog_data
call [OpenDialog_Init] call [OpenDialog_Init]
push check1
call [init_checkbox]
mcall 40,0x27
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
red: red:
call draw_window call draw_window
@ -76,6 +89,9 @@ still:
cmp eax,3 cmp eax,3
je button je button
push dword check1
call [check_box_mouse]
jmp still jmp still
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
key: key:
@ -126,14 +142,31 @@ draw_window:
xor ebp,ebp xor ebp,ebp
mov edx,[w_work] ; color of work area RRGGBB,8->color mov edx,[w_work] ; color of work area RRGGBB,8->color
or edx,0x34000000 or edx,0x34000000
mcall 0,<100,400>,<100,270>,,,title mcall 0,<100,400>,<100,300>,,,title
call draw_PathShow
mcall 8,<5,80>,<25,15>,2,[w_work_button]
mcall 4,<5+10,25+4>,[w_work_button_text],s_text,s_text.size
mcall 8,<400-65,50>,<25,15>,3,[w_work_button]
mcall 4,<400-65+10,25+4>,[w_work_button_text],r_text,r_text.size
mov ebx,5 shl 16+47 call draw_PathShow
mov eax,[w_work_text]
or eax,0x80000000
mov [check1.text_color],eax
push dword check1
call [check_box_draw]
mcall 8,<5,80>,<25,15>,2,[w_work_button]
mcall ,<400-65,50>,,3
mov ecx,[w_work_button_text]
or ecx,0x80000000
mcall 4,<5+10,25+4>,,s_text
mcall ,<400-65+10,25+4>,,r_text
mov ecx,[w_work_text]
or ecx,0x80000000
mcall ,<10,47>,,check_box_warning_text
mcall ,<10,65>,,result_table_text
mov edx,ecx
and edx,0xffffff
mcall 38,<5,400-15>,<59,59>
; draw result table
mov ebx,10 shl 16+77
mov ebp,result_table mov ebp,result_table
mov ecx,18 mov ecx,18
;-------------------------------------- ;--------------------------------------
@ -141,15 +174,17 @@ draw_window:
push ecx push ecx
mov ecx,[w_work_text] mov ecx,[w_work_text]
or ecx,0x80000000 or ecx,0x80000000
mcall 4,,,[ebp] mcall 4,,,[ebp+RESULT_SLOT.text]
push ebx push ebx
mov edx,ebx mov edx,ebx
add edx,50 shl 16 add edx,(11*6) shl 16
mov ebx,0x800a0000 mov ebx,0x800a0000
mcall 47,,[ebp+4],,[w_work_text] mcall 47,,[ebp+RESULT_SLOT.read_speed],,[w_work_text]
add edx,(16*6) shl 16
mcall ,,[ebp+RESULT_SLOT.write_speed]
pop ebx pop ebx
add ebx,6+5 add ebx,6+5
add ebp,12 add ebp,sizeof.RESULT_SLOT
pop ecx pop ecx
dec ecx dec ecx
jnz @b jnz @b
@ -173,11 +208,20 @@ testing:
@@: @@:
push ecx push ecx
call read_chunk call read_chunk
pop ecx
add ebp,12
pusha pusha
call draw_window call draw_window
popa popa
call write_chunk
pusha
call draw_window
popa
pop ecx
add ebp,sizeof.RESULT_SLOT
dec ecx dec ecx
jnz @b jnz @b
@ -185,15 +229,15 @@ testing:
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
read_chunk: read_chunk:
mov eax,[file_info+32] ; file size mov eax,[file_info+32] ; file size
cmp [ebp+8],eax ; chunk size cmp [ebp+RESULT_SLOT.chunk_size],eax
jb @f jb @f
xor eax,eax xor eax,eax ; small file size for current chunk size
mov [ebp+4],eax ; small file size for current chunk size mov [ebp+RESULT_SLOT.read_speed],eax
ret ret
;-------------------------------------- ;--------------------------------------
@@: @@:
mcall 68,12,[ebp+8] ; chunk size mcall 68,12,[ebp+RESULT_SLOT.chunk_size]
mov [fileread.return],eax mov [fileread.return],eax
xor eax,eax xor eax,eax
mov [fileread.offset],eax ; zero current offset mov [fileread.offset],eax ; zero current offset
@ -201,7 +245,7 @@ read_chunk:
add eax,1600 ; 16 sec for iterations add eax,1600 ; 16 sec for iterations
mov esi,eax mov esi,eax
mov ecx,1 mov ecx,1
mov eax,[ebp+8] ; chunk size mov eax,[ebp+RESULT_SLOT.chunk_size]
mov [fileread.size],eax mov [fileread.size],eax
;-------------------------------------- ;--------------------------------------
.loop: .loop:
@ -211,11 +255,11 @@ read_chunk:
cmp esi,eax cmp esi,eax
jbe .end jbe .end
; correct offset ; correct offset
mov edx,[ebp+8] ; chunk size mov edx,[ebp+RESULT_SLOT.chunk_size]
add [fileread.offset],edx ; current offset add [fileread.offset],edx ; current offset
; check offset and file size ; check offset and file size
mov edx,[file_info+32] ; file size mov edx,[file_info+32] ; file size
sub edx,[ebp+8] ; chunk size sub edx,[ebp+RESULT_SLOT.chunk_size]
cmp [fileread.offset],edx cmp [fileread.offset],edx
jbe @f jbe @f
@ -227,17 +271,78 @@ read_chunk:
jmp .loop jmp .loop
;-------------------------------------- ;--------------------------------------
.end: .end:
mov eax,[ebp+8] mov eax,[ebp+RESULT_SLOT.chunk_size]
xor edx,edx xor edx,edx
mul ecx mul ecx
shr eax,10+4 ;div 1024 ; div 16 shr eax,10+4 ;div 1024 ; div 16
shl edx,18 shl edx,18
add eax,edx add eax,edx
mov [ebp+4],eax ; speed KB/s mov [ebp+RESULT_SLOT.read_speed],eax ; speed KB/s
DEBUGF 1,'FSPEED: chunk size: %s iterations: %d speed: %d KB/s\n',[ebp],ecx,eax DEBUGF 1,'FSPEED: read chunk size: %s iterations: %d speed: %d KB/s\n',\
[ebp+RESULT_SLOT.text],ecx,eax
mcall 68,13,[fileread.return] mcall 68,13,[fileread.return]
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
write_chunk:
test [check1.flags],dword 10b
jz .exit
mov eax,[file_info+32] ; file size
cmp [ebp+RESULT_SLOT.chunk_size],eax
jb @f
;--------------------------------------
.exit:
xor eax,eax ; small file size for current chunk size
mov [ebp+RESULT_SLOT.write_speed],eax
ret
;--------------------------------------
@@:
mcall 68,12,[ebp+RESULT_SLOT.chunk_size]
mov [filewrite.data],eax
xor eax,eax
mov [filewrite.offset],eax ; zero current offset
mcall 26,9 ; get start time
add eax,1600 ; 16 sec for iterations
mov esi,eax
mov ecx,1
mov eax,[ebp+RESULT_SLOT.chunk_size]
mov [filewrite.size],eax
;--------------------------------------
.loop:
mcall 70,filewrite
mcall 26,9 ; check current time
cmp esi,eax
jbe .end
; correct offset
mov edx,[ebp+RESULT_SLOT.chunk_size]
add [filewrite.offset],edx ; current offset
; check offset and file size
mov edx,[file_info+32] ; file size
sub edx,[ebp+RESULT_SLOT.chunk_size]
cmp [filewrite.offset],edx
jbe @f
xor edx,edx
mov [filewrite.offset],edx ; zero current offset
;--------------------------------------
@@:
inc ecx
jmp .loop
;--------------------------------------
.end:
mov eax,[ebp+RESULT_SLOT.chunk_size]
xor edx,edx
mul ecx
shr eax,10+4 ;div 1024 ; div 16
shl edx,18
add eax,edx
mov [ebp+RESULT_SLOT.write_speed],eax ; speed KB/s
DEBUGF 1,'FSPEED: write chunk size: %s iterations: %d speed: %d KB/s\n',\
[ebp+RESULT_SLOT.text],ecx,eax
mcall 68,13,[filewrite.data]
ret
;-----------------------------------------------------------------------------
include 'idata.inc' include 'idata.inc'
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
IM_END: IM_END:

View File

@ -1,19 +1,26 @@
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
lsz s_text,\ s_text:
ru,'‚롮ŕ ä ©« ',\ if lang eq ru
en,'Select file',\ db '‚ë¡®à ä ©« ',0
et,'Select file',\ else
it,'Select file',\ db 'Select file',0
sp,'Select file' end if
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
lsz r_text,\ r_text:
ru,'ŹăáŞ',\ if lang eq ru
en,'Start',\ db '<27>ãáª',0
et,'Start',\ else
it,'Start',\ db 'Start',0
sp,'Start' end if
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
title db 'File Speed v0.1',0 result_table_text:
if lang eq ru
db '<27> §¬¥à —⥭¨¥ (Š<>/á) ‡ ¯¨áì (Š<>/á)',0
else
db 'Size Read (KB/s) Write (KB/s)',0
end if
;-----------------------------------------------------------------------------
title db 'File Speed v0.3',0
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
include_debug_strings include_debug_strings
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -72,8 +79,9 @@ Box_lib_import:
;edit_box_mouse dd aEdit_box_mouse ;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed ;version_ed dd aVersion_ed
;check_box_draw dd aCheck_box_draw init_checkbox dd aInit_checkbox
;check_box_mouse dd aCheck_box_mouse check_box_draw dd aCheck_box_draw
check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch ;version_ch dd aVersion_ch
;option_box_draw dd aOption_box_draw ;option_box_draw dd aOption_box_draw
@ -118,9 +126,10 @@ PathShow_draw dd sz_PathShow_draw
;aEdit_box_mouse db 'edit_box_mouse',0 ;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0 ;aVersion_ed db 'version_ed',0
;aCheck_box_draw db 'check_box_draw',0 aInit_checkbox db 'init_checkbox2',0
;aCheck_box_mouse db 'check_box_mouse',0 aCheck_box_draw db 'check_box_draw2',0
;aVersion_ch db 'version_ch',0 aCheck_box_mouse db 'check_box_mouse2',0
;aVersion_ch db 'version_ch2',0
;aOption_box_draw db 'option_box_draw',0 ;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0 ;aOption_box_mouse db 'option_box_mouse',0
@ -167,6 +176,23 @@ PathShow_data:
.work_area_pointer dd text_work_area ;+32 .work_area_pointer dd text_work_area ;+32
.temp_text_length dd 0 ;+36 .temp_text_length dd 0 ;+36
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
check1 check_box2 (100 shl 16)+12,(27 shl 16)+12,6,0xFFFFFF,0,0xffffff,\
check_text1,ch_flag_middle
check_text1:
if lang eq ru
db '’¥áâ¨à®¢ âì § ¯¨áì',0
else
db 'Use testing of write',0
end if
check_box_warning_text:
if lang eq ru
db '<>ˆŒ€<C592>ˆ…! <20>஢¥àª  ᪮à®á⨠§ ¯¨á¨ ã­¨ç⮦ ¥â ᮤ¥à¦¨¬®¥ ä ©« !',0
else
db 'WARNING! Testing of write speed is destroy contents of file!',0
end if
;-----------------------------------------------------------------------------
OpenDialog_data: OpenDialog_data:
.type dd 0 .type dd 0
.procinfo dd process_info ;+4 .procinfo dd process_info ;+4
@ -217,24 +243,24 @@ default_dtp:
sector equ 512 sector equ 512
;-------------------------------------- ;--------------------------------------
result_table: result_table:
dd a512b, 0, sector*1 dd a512b, 0, 0, sector*1
dd a1K, 1, sector*2 dd a1K, 1, 1, sector*2
dd a2K, 2, sector*4 dd a2K, 2, 2, sector*4
dd a4K, 3, sector*8 dd a4K, 3, 3, sector*8
dd a8K, 4, sector*16 dd a8K, 4, 4, sector*16
dd a16K, 5, sector*32 dd a16K, 5, 5, sector*32
dd a32K, 6, sector*64 dd a32K, 6, 6, sector*64
dd a64K, 7, sector*128 dd a64K, 7, 7, sector*128
dd a128K, 8, sector*256 dd a128K, 8, 8, sector*256
dd a256K, 9, sector*512 dd a256K, 9, 9, sector*512
dd a512K, 10, sector*1024 dd a512K, 10, 10, sector*1024
dd a1M, 11, sector*2*1024 dd a1M, 11, 11, sector*2*1024
dd a2M, 12, sector*4*1024 dd a2M, 12, 12, sector*4*1024
dd a4M, 13, sector*8*1024 dd a4M, 13, 13, sector*8*1024
dd a8M, 14, sector*16*1024 dd a8M, 14, 14, sector*16*1024
dd a16M, 15, sector*32*1024 dd a16M, 15, 15, sector*32*1024
dd a32M, 16, sector*64*1024 dd a32M, 16, 16, sector*64*1024
dd a64M, -1, sector*128*1024 dd a64M, 17, 17, sector*128*1024
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
a512b db ' 512',0 a512b db ' 512',0
a1K db ' 1K',0 a1K db ' 1K',0
@ -275,3 +301,13 @@ fileread:
db 0 db 0
.name: dd fname .name: dd fname
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4
filewrite:
.subfunction dd 3
.offset dd 0
.offset_1 dd 0
.size dd 0
.data dd process_info
db 0
.name: dd fname
;-----------------------------------------------------------------------------