diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index fa3dcef8c..7a0e61434 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -90,6 +90,9 @@ Settings/NavigationHistory/Caption: Navigation History Settings/NavigationHistory/Hint: Update browser history when navigating to a tiddler: Settings/NavigationHistory/No/Description: Do not update history Settings/NavigationHistory/Yes/Description: Update history +Settings/PerformanceInstrumentation/Caption: Performance Instrumentation +Settings/PerformanceInstrumentation/Hint: Displays performance statistics in the browser developer console. Requires reload to take effect +Settings/PerformanceInstrumentation/Description: Enable performance instrumentation Settings/ToolbarButtonStyle/Caption: Toolbar Button Style Settings/ToolbarButtonStyle/Hint: Choose the style for toolbar buttons: Settings/ToolbarButtonStyle/Styles/Borderless: Borderless diff --git a/core/modules/startup/startup.js b/core/modules/startup/startup.js index 6bdb2e9a9..08f9641e3 100755 --- a/core/modules/startup/startup.js +++ b/core/modules/startup/startup.js @@ -18,7 +18,7 @@ exports.after = ["load-modules"]; exports.synchronous = true; // Set to `true` to enable performance instrumentation -var PERFORMANCE_INSTRUMENTATION = false; +var PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE = "$:/config/Performance/Instrumentation"; var widget = require("$:/core/modules/widgets/widget.js"); @@ -29,7 +29,7 @@ exports.startup = function() { } $tw.version = $tw.utils.extractVersionInfo(); // Set up the performance framework - $tw.perf = new $tw.Performance(PERFORMANCE_INSTRUMENTATION); + $tw.perf = new $tw.Performance($tw.wiki.getTiddlerText(PERFORMANCE_INSTRUMENTATION_CONFIG_TITLE,"no") === "yes"); // Kick off the language manager and switcher $tw.language = new $tw.Language(); $tw.languageSwitcher = new $tw.PluginSwitcher({ diff --git a/core/modules/utils/performance.js b/core/modules/utils/performance.js index c8896c27e..3e7acfac3 100644 --- a/core/modules/utils/performance.js +++ b/core/modules/utils/performance.js @@ -28,9 +28,9 @@ Performance.prototype.report = function(name,fn) { self.measures = {}; var startTime = $tw.utils.timer(), result = fn.apply(this,arguments); - self.logger.log(name + ": " + $tw.utils.timer(startTime) + "ms"); + self.logger.log(name + ": " + $tw.utils.timer(startTime).toFixed(2) + "ms"); for(var m in self.measures) { - self.logger.log("+" + m + ": " + self.measures[m] + "ms"); + self.logger.log("+" + m + ": " + self.measures[m].toFixed(2) + "ms"); } return result; }; diff --git a/core/ui/ControlPanel/Settings/PerformanceInstrumentation.tid b/core/ui/ControlPanel/Settings/PerformanceInstrumentation.tid new file mode 100644 index 000000000..b3d1d9763 --- /dev/null +++ b/core/ui/ControlPanel/Settings/PerformanceInstrumentation.tid @@ -0,0 +1,8 @@ +title: $:/core/ui/ControlPanel/Settings/PerformanceInstrumentation +tags: $:/tags/ControlPanel/Settings +caption: {{$:/language/ControlPanel/Settings/PerformanceInstrumentation/Caption}} + +\define lingo-base() $:/language/ControlPanel/Settings/PerformanceInstrumentation/ +<> + +<$checkbox tiddler="$:/config/Performance/Instrumentation" field="text" checked="yes" unchecked="no" default="no"> <$link to="$:/config/Performance/Instrumentation"><> diff --git a/core/wiki/config/PerformanceInstrumentation.tid b/core/wiki/config/PerformanceInstrumentation.tid new file mode 100644 index 000000000..e4220f287 --- /dev/null +++ b/core/wiki/config/PerformanceInstrumentation.tid @@ -0,0 +1,2 @@ +title: $:/config/Performance/Instrumentation +text: yes