diff --git a/NEWS b/NEWS
index 89f3237f..279d2b02 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
2007-xx-xx:
* version 0.6
* THIS VERSION ONLY WORKS WITH FIREFOX 3.0
+ * new :time command for profiling
* added new :sidebar and :sbclose commands
* added 'more' and standard more-prompt key mappings to control
behaviour of the message list pager
diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js
index 7b291efb..261390bd 100644
--- a/chrome/content/vimperator/commands.js
+++ b/chrome/content/vimperator/commands.js
@@ -1318,16 +1318,19 @@ function Commands() //{{{
while (i--)
eval(args);
+ if (special)
+ return;
+
var after_time = Date.now();
if ((after_time - before_time) / count >= 100)
var each = " Each time: " +
((after_time - before_time) / 1000.0 / count) +
- " sec";
+ " sec
";
else
var each = " Each time: " +
((after_time - before_time) / count) +
- " msec";
+ " msec
";
if (after_time - before_time >= 100)
var total = " Total time: " +
@@ -1348,6 +1351,10 @@ function Commands() //{{{
vimperator.execute(args);
else
eval(args);
+
+ if (special)
+ return;
+
var after_time = Date.now();
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",
- help: "Runs {code} {count} 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. " +
- "If {code} starts with a :, it is executed as a vimperator command"
+ help: "Runs {code} {count} 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.
" +
+ "If {code} starts with a :, it is executed as a vimperator command.
" +
+ "Use the special version with [!] if you just want to run any command multiple times without showing profiling statistics."
}
));
addDefaultCommand(new Command(["u[ndo]"],