-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
[RDY] Add ":profile dump" and ":profile stop" #2427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How do you make sure the profile doesn't get dumped twice? |
@splinterofchaos Why do you think this is needed? |
At exit it will be overwritten again. I guess I could also add |
Good point.
Maybe it's not as necessary as I thought, but if we want to give the user finer control over when to dump the profiling info, I think it also makes sense to let the user specify whether we should or not. |
} else if (STRCMP(eap->arg, "stop") == 0) { | ||
profile_dump(); | ||
do_profiling = PROF_NONE; | ||
set_vim_var_nr(VV_PROFILING, 0L); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering what will happen if you do profile start
after profile stop
? It should start new profiling, but AFAIR neither of profile_dump
, set_vim_var
is clearing the associated structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. I'll fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
profile_fname
also needs to be freed.
143115f
to
04e855e
Compare
I added |
scriptitem_T *si; | ||
|
||
for (int id = 1; id <= script_items.ga_len; id++) { | ||
si = &SCRIPT_ITEM(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
si
should be declared here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected!
LGTM 👍 |
07514a8
to
96303c3
Compare
The |
@@ -3,6 +3,47 @@ | |||
|
|||
#include "nvim/profile.h" | |||
|
|||
// All user-defined functions are found in this hashtable. | |||
hashtab_T func_hashtab; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be a declaration, like extern hashtab_T func_hashtab;
and only be defined in one file (eval.c?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is something we're changing, but the current convention I see is to use EXTERN
(defined in nvim/globals.h
), which initializes it when included from main.c
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
d0d10d9
to
e17d195
Compare
Uhm, what's the proper fix of:
Just making it non-static is probably the wrong approach. And I can't just use Maybe there's is another way where we don't have to use that dummy variable in the first place? |
That's what |
@splinterofchaos I guess I was a bit tired already, since I didn't see that it has to be |
079952c
to
dc6868e
Compare
Why would http://neovim-qb.szakmeister.net/build/581 fail for me (this branch doesn't touch these functions) but not for other PRs? |
There might be a couple of explanations. First, I recently changed the build steps to enable errors on warnings (just like the Travis build). The difference here is that the QB instance is also doing a full release build (without asserts) which may expose some things the Travis build (currently) does not. #2353 fixed several, but it appears there are a couple more. They either slid enable before I got things enabled, or I just missed them somehow (which is entirely possible--though I was pretty certain I ran a build everywhere to make sure it was clean before turning it on). So, I'd say ignore the error for this PR. Hopefully the remaining warnings can be fixed in short order (though someone else might have to step and do it since I'm at a conference for the next few days). |
Okeydokey, thanks for the explanation. (And have fun at the conference!) |
BTW, the |
9c42b2e
to
f31f29d
Compare
This adds two new tests for: :profile dump :profile stop
Currently the logfile (":profile start {logfile}") only gets written when Vim exits. This new command allows to dump the log immediately without exiting.
This writes the logfile and stops profiling.
f31f29d
to
1902ee5
Compare
Currently the logfile (":profile start {logfile}") only gets written when Vim
exits. This new command allows to dump the log immediately without exiting.