startuptime: always enable startuptime

Removes the STARTUPTIME define.
This commit is contained in:
Nicolas Hillegeer 2014-07-18 11:02:27 +02:00 committed by Justin M. Keyes
parent ab1eec10a1
commit fb15cbbaea
7 changed files with 16 additions and 41 deletions

View File

@ -9731,9 +9731,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
"cmdline_info",
"signs",
"smartindent",
#ifdef STARTUPTIME
"startuptime",
#endif
"statusline",
"spell",
"syntax",

View File

@ -2261,10 +2261,6 @@ do_source (
void *save_funccalp;
int save_debug_break_level = debug_break_level;
scriptitem_T *si = NULL;
#ifdef STARTUPTIME
proftime_T tv_rel;
proftime_T tv_start;
#endif
proftime_T wait_start;
p = expand_env_save(fname);
@ -2393,10 +2389,13 @@ do_source (
firstline = p;
}
#ifdef STARTUPTIME
if (time_fd != NULL)
time_push(&tv_rel, &tv_start);
#endif
// start measuring script load time if --startuptime was passed and
// time_fd was successfully opened afterwards.
proftime_T rel_time;
proftime_T start_time;
if (time_fd != NULL) {
time_push(&rel_time, &start_time);
}
if (do_profiling == PROF_YES)
prof_child_enter(&wait_start); /* entering a child now */
@ -2490,13 +2489,12 @@ do_source (
smsg((char_u *)_("continuing in %s"), sourcing_name);
verbose_leave();
}
#ifdef STARTUPTIME
if (time_fd != NULL) {
vim_snprintf((char *)IObuff, IOSIZE, "sourcing %s", fname);
time_msg((char *)IObuff, &tv_start);
time_pop(tv_rel);
time_msg((char *)IObuff, &start_time);
time_pop(rel_time);
}
#endif
/*
* After a "finish" in debug mode, need to break at first command of next

View File

@ -1207,9 +1207,7 @@ EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
/* For undo we need to know the lowest time possible. */
EXTERN time_t starttime;
#ifdef STARTUPTIME
EXTERN FILE *time_fd INIT(= NULL); /* where to write startup timing */
#endif
/*
* Some compilers warn for not using a return value, but in some situations we

View File

@ -711,7 +711,6 @@ main_loop (
do_redraw = FALSE;
#ifdef STARTUPTIME
/* Now that we have drawn the first screen all the startup stuff
* has been done, close any file for startup messages. */
if (time_fd != NULL) {
@ -720,7 +719,6 @@ main_loop (
fclose(time_fd);
time_fd = NULL;
}
#endif
}
/*
@ -1467,16 +1465,14 @@ static void init_params(mparm_T *paramp, int argc, char **argv)
*/
static void init_startuptime(mparm_T *paramp)
{
#ifdef STARTUPTIME
int i;
for (i = 1; i < paramp->argc; ++i) {
for (int i = 1; i < paramp->argc; i++) {
if (STRICMP(paramp->argv[i], "--startuptime") == 0 && i + 1 < paramp->argc) {
time_fd = mch_fopen(paramp->argv[i + 1], "a");
time_start("--- VIM STARTING ---");
break;
}
}
#endif
starttime = time(NULL);
}
@ -2221,9 +2217,7 @@ static void usage(void)
main_msg(_("-s <scriptin>\tRead Normal mode commands from file <scriptin>"));
main_msg(_("-w <scriptout>\tAppend all typed commands to file <scriptout>"));
main_msg(_("-W <scriptout>\tWrite all typed commands to file <scriptout>"));
#ifdef STARTUPTIME
main_msg(_("--startuptime <file>\tWrite startup timing messages to <file>"));
#endif
main_msg(_("-i <viminfo>\t\tUse <viminfo> instead of .viminfo"));
main_msg(_("--api-msgpack-metadata\tDump API metadata information and exit"));
main_msg(_("-h or --help\tPrint Help (this message) and exit"));

View File

@ -6,9 +6,7 @@
#include "nvim/os/time.h"
#include "nvim/func_attr.h"
#ifdef STARTUPTIME
#include "nvim/vim.h" // for the global `time_fd`
#endif
#include "nvim/globals.h" // for the global `time_fd` (startuptime)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "profile.c.generated.h"
@ -187,8 +185,7 @@ int profile_cmp(proftime_T tm1, proftime_T tm2) FUNC_ATTR_CONST
return sgn64((int64_t)(tm2 - tm1));
}
#ifdef STARTUPTIME
/// globals for use in the startuptime related functionality (time_*).
static proftime_T g_start_time;
static proftime_T g_prev_time;
@ -282,5 +279,3 @@ void time_msg(const char *mesg, const proftime_T *start)
g_prev_time = now;
fprintf(time_fd, ": %s\n", mesg);
}
#endif

View File

@ -6,13 +6,9 @@
typedef uint64_t proftime_T;
#ifdef STARTUPTIME
#define TIME_MSG(s) do { \
if (time_fd != NULL) time_msg(s, NULL); \
} while (0)
#else
#define TIME_MSG(s)
#endif
if (time_fd != NULL) time_msg(s, NULL); \
} while (0)
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "profile.h.generated.h"

View File

@ -145,11 +145,7 @@ static char *(features[]) = {
"+scrollbind",
"+signs",
"+smartindent",
#ifdef STARTUPTIME
"+startuptime",
#else // ifdef STARTUPTIME
"-startuptime",
#endif // ifdef STARTUPTIME
"+statusline",
"+syntax",
"+tag_binary",