1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

core: add option "time" in command /debug

This commit is contained in:
Sébastien Helleu
2016-11-28 21:52:14 +01:00
parent 9c76d80d4d
commit 93ef6b0a3e
23 changed files with 249 additions and 165 deletions
+19 -4
View File
@@ -1688,6 +1688,7 @@ COMMAND_CALLBACK(debug)
{
struct t_config_option *ptr_option;
struct t_weechat_plugin *ptr_plugin;
struct timeval time_start, time_end;
int debug;
/* make C compiler happy */
@@ -1861,6 +1862,16 @@ COMMAND_CALLBACK(debug)
return WEECHAT_RC_OK;
}
if (string_strcasecmp (argv[1], "time") == 0)
{
COMMAND_MIN_ARGS(3, "time");
gettimeofday (&time_start, NULL);
(void) input_data (buffer, argv_eol[2]);
gettimeofday (&time_end, NULL);
debug_display_time_elapsed (&time_start, &time_end, argv_eol[2], 1);
return WEECHAT_RC_OK;
}
COMMAND_ERROR;
}
@@ -7127,13 +7138,14 @@ command_init ()
&command_cursor, NULL, NULL);
hook_command (
NULL, "debug",
N_("control debug for core/plugins"),
N_("debug functions"),
N_("list"
" || set <plugin> <level>"
" || dump [<plugin>]"
" || buffer|color|infolists|memory|tags|term|windows"
" || mouse|cursor [verbose]"
" || hdata [free]"),
" || hdata [free]"
" || time <command>"),
N_(" list: list plugins with debug levels\n"
" set: set debug level for plugin\n"
" plugin: name of plugin (\"core\" for WeeChat core)\n"
@@ -7153,7 +7165,9 @@ command_init ()
" mouse: toggle debug for mouse\n"
" tags: display tags for lines\n"
" term: display infos about terminal\n"
" windows: display windows tree"),
" windows: display windows tree\n"
" time: measure time to execute a command or to send text to "
"the current buffer"),
"list"
" || set %(plugins_names)|core"
" || dump %(plugins_names)|core"
@@ -7169,7 +7183,8 @@ command_init ()
" || mouse verbose"
" || tags"
" || term"
" || windows",
" || windows"
" || time %(commands)",
&command_debug, NULL, NULL);
hook_command (
NULL, "eval",