VirtualBox

Changeset 53195 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
Nov 4, 2014 12:44:27 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96741
Message:

src/ValidationKit/bootsector: Added RDTSC benchmark and improved precision a little while calculating ins/sec.

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bootsector2-common-routines-template-1.mac

    r52776 r53195  
    11911191        jae     .div_overflow
    11921192        mov     eax, [sAX]
     1193        shld    edx, eax, 10
     1194        shl     eax,10
    11931195        div     ecx                     ; eax = NS per test
    11941196
     
    11971199        cmp     ecx, 0
    11981200        jz      .div_zero
    1199         xor     edx, edx
    1200         mov     eax, 1000000000         ; 1G
     1201        mov     edx, 0xee
     1202        mov     eax, 0x6b280000         ; 1024G
    12011203        div     ecx                     ; eax = tests per second
    12021204
  • trunk/src/VBox/ValidationKit/bootsectors/bootsector2-test1-template.mac

    r52776 r53195  
    9292        db TMPL_MODE_STR, ', CPUID', 0
    9393ENDPROC TMPL_NM(BenchmarkCpuId_rm)
     94
     95TMPL_BEGINCODE
     96BITS TMPL_BITS
     97
     98
     99;;
     100; Run the RDTSC benchmark for this mode.
     101;
     102; @uses nothing
     103;
     104BEGINCODELOW
     105BITS 16
     106BEGINPROC TMPL_NM(BenchmarkRdTsc_rm)
     107        call    TMPL_NM(Bs2IsModeSupported_rm)
     108        jz      .done
     109        call    TMPL_NM(Bs2EnterMode_rm)
     110BITS TMPL_BITS
     111        push    xBP
     112        mov     xBP, xSP
     113        push    sAX
     114        push    sBX
     115        push    sCX
     116        push    sDX
     117        push    sDI
     118        sub     sSP, 20h
     119
     120        ; Get the current time.
     121        mov     xAX, xSP
     122        call    TMPL_NM_CMN(GetNanoTS)
     123
     124        ; Do the test.
     125        mov     edi, TEST_INSTRUCTION_COUNT_RDTSC / 4
     126.again:
     127        rdtsc
     128        rdtsc
     129        rdtsc
     130        rdtsc
     131        dec     edi
     132        jnz     .again
     133
     134        ; Calc the elapsed time and report the result.
     135        mov     xAX, xSP
     136        call    TMPL_NM_CMN(GetElapsedNanoTS)
     137
     138        mov     xCX, .s_szTestName
     139        mov     edx, TEST_INSTRUCTION_COUNT_RDTSC
     140        mov     xAX, xSP
     141        call    TMPL_NM_CMN(ReportResult)
     142
     143        add     sSP, 20h
     144        pop     sDI
     145        pop     sDX
     146        pop     sCX
     147        pop     sBX
     148        pop     sAX
     149        leave
     150
     151        call    TMPL_NM(Bs2ExitMode)
     152BITS 16
     153.done:
     154        ret
     155
     156.s_szTestName:
     157        db TMPL_MODE_STR, ', RDTSC', 0
     158ENDPROC TMPL_NM(BenchmarkRdTsc_rm)
    94159
    95160TMPL_BEGINCODE
  • trunk/src/VBox/ValidationKit/bootsectors/bootsector2-test1.asm

    r52776 r53195  
    3434;; The number of instructions to test.
    3535%define TEST_INSTRUCTION_COUNT_IO       2000000
     36
     37;; The number of RDTSC instructions to test.
     38%define TEST_INSTRUCTION_COUNT_RDTSC    4000000
    3639
    3740;; The number of instructions to test.
     
    7881
    7982        ;
     83        ; RDTSC.
     84        ;
     85        mov     ax, .s_szTstRdTsc
     86        call    TestSub_r86
     87        call    BenchmarkRdTsc_rm_pp32
     88        call    BenchmarkRdTsc_rm_pae32
     89        call    BenchmarkRdTsc_rm_lm64
     90        call    BenchmarkRdTsc_rm_pe16
     91        call    BenchmarkRdTsc_rm_pe32
     92        call    BenchmarkRdTsc_rm_rm
     93
     94        ;
    8095        ; I/O port access.
    8196        ;
     
    111126.s_szTstCpuId:
    112127        db      'CPUID EAX=1', 0
     128.s_szTstRdTsc:
     129        db      'RDTSC', 0
    113130.s_szTstNopIoPort:
    114131        db      'NOP I/O Port Access', 0
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette