aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2019-08-29 12:06:59 +0900
committererw7 <erw7.github@gmail.com>2019-09-04 13:40:05 +0900
commite4a47862415ee6e0c4904f9c5cc8c3453be6bf17 (patch)
tree8e5388e13007fcad88147f74fe1f0d7e963ccf5c /src/nvim/eval.c
parent0e11a106c55fd678713e0226ee37c9231851ab4b (diff)
downloadrneovim-e4a47862415ee6e0c4904f9c5cc8c3453be6bf17.tar.gz
rneovim-e4a47862415ee6e0c4904f9c5cc8c3453be6bf17.tar.bz2
rneovim-e4a47862415ee6e0c4904f9c5cc8c3453be6bf17.zip
vim-patch:8.1.0365: function profile doesn't specify where it was defined
Problem: Function profile doesn't specify where it was defined. Solution: Show the script name and line number. https://github.com/vim/vim/commit/4c7b08f6409349cf5324a26f7523c438590550ef
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 0625a63e21..8fa4e23df6 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -22138,14 +22138,27 @@ void func_dump_profile(FILE *fd)
if (fp->uf_prof_initialized) {
sorttab[st_len++] = fp;
- if (fp->uf_name[0] == K_SPECIAL)
+ if (fp->uf_name[0] == K_SPECIAL) {
fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3);
- else
+ } else {
fprintf(fd, "FUNCTION %s()\n", fp->uf_name);
- if (fp->uf_tm_count == 1)
+ }
+ bool should_free;
+ const LastSet last_set = (LastSet){
+ .script_ctx = fp->uf_script_ctx,
+ .channel_id = 0,
+ };
+ char_u *p = get_scriptname(last_set, &should_free);
+ fprintf(fd, " Defined: %s line %" PRIdLINENR "\n",
+ p, fp->uf_script_ctx.sc_lnum);
+ if (should_free) {
+ xfree(p);
+ }
+ if (fp->uf_tm_count == 1) {
fprintf(fd, "Called 1 time\n");
- else
+ } else {
fprintf(fd, "Called %d times\n", fp->uf_tm_count);
+ }
fprintf(fd, "Total time: %s\n", profile_msg(fp->uf_tm_total));
fprintf(fd, " Self time: %s\n", profile_msg(fp->uf_tm_self));
fprintf(fd, "\n");