mirror of
https://github.com/neovim/neovim.git
synced 2026-07-19 07:31:35 +00:00
vim-patch:partial:8.2.2400: Vim9: compiled functions are not profiled
Problem: Vim9: compiled functions are not profiled.
Solution: Add initial changes to profile compiled functions. Fix that a
script-local function was hard to debug.
b204990346
Port only test_profile.vim.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -8,22 +8,27 @@ source screendump.vim
|
|||||||
source vim9.vim
|
source vim9.vim
|
||||||
|
|
||||||
func Test_profile_func()
|
func Test_profile_func()
|
||||||
|
call RunProfileFunc('func', 'let', 'let')
|
||||||
|
" call RunProfileFunc('def', 'var', '')
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func RunProfileFunc(command, declare, assign)
|
||||||
let lines =<< trim [CODE]
|
let lines =<< trim [CODE]
|
||||||
profile start Xprofile_func.log
|
profile start Xprofile_func.log
|
||||||
profile func Foo*
|
profile func Foo*
|
||||||
func! Foo1()
|
XXX Foo1()
|
||||||
endfunc
|
endXXX
|
||||||
func! Foo2()
|
XXX Foo2()
|
||||||
let l:count = 100
|
DDD counter = 100
|
||||||
while l:count > 0
|
while counter > 0
|
||||||
let l:count = l:count - 1
|
AAA counter = counter - 1
|
||||||
endwhile
|
endwhile
|
||||||
sleep 1m
|
sleep 1m
|
||||||
endfunc
|
endXXX
|
||||||
func! Foo3()
|
XXX Foo3()
|
||||||
endfunc
|
endXXX
|
||||||
func! Bar()
|
XXX Bar()
|
||||||
endfunc
|
endXXX
|
||||||
call Foo1()
|
call Foo1()
|
||||||
call Foo1()
|
call Foo1()
|
||||||
profile pause
|
profile pause
|
||||||
@@ -38,6 +43,10 @@ func Test_profile_func()
|
|||||||
delfunc Foo3
|
delfunc Foo3
|
||||||
[CODE]
|
[CODE]
|
||||||
|
|
||||||
|
call map(lines, {k, v -> substitute(v, 'XXX', a:command, '') })
|
||||||
|
call map(lines, {k, v -> substitute(v, 'DDD', a:declare, '') })
|
||||||
|
call map(lines, {k, v -> substitute(v, 'AAA', a:assign, '') })
|
||||||
|
|
||||||
call writefile(lines, 'Xprofile_func.vim')
|
call writefile(lines, 'Xprofile_func.vim')
|
||||||
call system(GetVimCommand()
|
call system(GetVimCommand()
|
||||||
\ . ' -es --clean'
|
\ . ' -es --clean'
|
||||||
@@ -71,10 +80,10 @@ func Test_profile_func()
|
|||||||
call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[12])
|
call assert_match('^ Self time:\s\+\d\+\.\d\+$', lines[12])
|
||||||
call assert_equal('', lines[13])
|
call assert_equal('', lines[13])
|
||||||
call assert_equal('count total (s) self (s)', lines[14])
|
call assert_equal('count total (s) self (s)', lines[14])
|
||||||
call assert_match('^\s*1\s\+.*\slet l:count = 100$', lines[15])
|
call assert_match('^\s*1\s\+.*\s\(let\|var\) counter = 100$', lines[15])
|
||||||
call assert_match('^\s*101\s\+.*\swhile l:count > 0$', lines[16])
|
call assert_match('^\s*101\s\+.*\swhile counter > 0$', lines[16])
|
||||||
call assert_match('^\s*100\s\+.*\s let l:count = l:count - 1$', lines[17])
|
call assert_match('^\s*100\s\+.*\s \(let\)\= counter = counter - 1$', lines[17])
|
||||||
call assert_match('^\s*101\s\+.*\sendwhile$', lines[18])
|
call assert_match('^\s*10[01]\s\+.*\sendwhile$', lines[18])
|
||||||
call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19])
|
call assert_match('^\s*1\s\+.\+sleep 1m$', lines[19])
|
||||||
call assert_equal('', lines[20])
|
call assert_equal('', lines[20])
|
||||||
call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21])
|
call assert_equal('FUNCTIONS SORTED ON TOTAL TIME', lines[21])
|
||||||
|
|||||||
Reference in New Issue
Block a user