1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 13:07:57 +01:00

added ! version to :time

This commit is contained in:
Martin Stubenschrott
2007-09-18 23:57:25 +00:00
parent f450fa5515
commit 578e51d8e3
2 changed files with 15 additions and 6 deletions

1
NEWS
View File

@@ -2,6 +2,7 @@
2007-xx-xx: 2007-xx-xx:
* version 0.6 * version 0.6
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0 * THIS VERSION ONLY WORKS WITH FIREFOX 3.0
* new :time command for profiling
* added new :sidebar and :sbclose commands * added new :sidebar and :sbclose commands
* added 'more' and standard more-prompt key mappings to control * added 'more' and standard more-prompt key mappings to control
behaviour of the message list pager behaviour of the message list pager

View File

@@ -1318,16 +1318,19 @@ function Commands() //{{{
while (i--) while (i--)
eval(args); eval(args);
if (special)
return;
var after_time = Date.now(); var after_time = Date.now();
if ((after_time - before_time) / count >= 100) if ((after_time - before_time) / count >= 100)
var each = " Each time: <span style=\"color: green\">" + var each = " Each time: <span style=\"color: green\">" +
((after_time - before_time) / 1000.0 / count) + ((after_time - before_time) / 1000.0 / count) +
"</span> sec</br>"; "</span> sec<br/>";
else else
var each = " Each time: <span style=\"color: green\">" + var each = " Each time: <span style=\"color: green\">" +
((after_time - before_time) / count) + ((after_time - before_time) / count) +
"</span> msec</br>"; "</span> msec<br/>";
if (after_time - before_time >= 100) if (after_time - before_time >= 100)
var total = " Total time: <span style=\"color: red\">" + var total = " Total time: <span style=\"color: red\">" +
@@ -1348,6 +1351,10 @@ function Commands() //{{{
vimperator.execute(args); vimperator.execute(args);
else else
eval(args); eval(args);
if (special)
return;
var after_time = Date.now(); var after_time = Date.now();
if (after_time - before_time >= 100) if (after_time - before_time >= 100)
@@ -1362,11 +1369,12 @@ function Commands() //{{{
} }
}, },
{ {
usage: ["{count}time {code|:command}"], usage: ["{count}time[!] {code|:command}"],
short_help: "Profile a piece of code or a command", short_help: "Profile a piece of code or a command",
help: "Runs {code} {count} times (default 1) and returns the elapsed time. " + help: "Runs <code class=\"argument\">{code} {count}</code> times (default 1) and returns the elapsed time. " +
"{code} is always passed to JavaScript's eval(), which might be slow, so take the results with a grain of salt. " + "<code class=\"argument\">{code}</code> is always passed to JavaScript's eval(), which might be slow, so take the results with a grain of salt.<br/>" +
"If {code} starts with a :, it is executed as a vimperator command" "If <code class=\"argument\">{code}</code> starts with a :, it is executed as a vimperator command.<br/>" +
"Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics."
} }
)); ));
addDefaultCommand(new Command(["u[ndo]"], addDefaultCommand(new Command(["u[ndo]"],