From bac1f72c5750fa54d712411a6a3ade71dd67b673 Mon Sep 17 00:00:00 2001 From: Drew Blessing Date: Mon, 11 Feb 2019 17:51:56 +0000 Subject: Add HTML output example to profiling --- doc/development/profiling.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/development/profiling.md b/doc/development/profiling.md index 0b0c6dfc8cf..b7d9f640a3f 100644 --- a/doc/development/profiling.md +++ b/doc/development/profiling.md @@ -72,6 +72,16 @@ Gitlab::Profiler.print_by_total_time(result, max_percent: 60, min_percent: 2) # 0.02 0.865 0.000 0.000 0.864 638 *Enumerable#inject ``` +To print the profile in HTML format, use the following example: + + +```ruby +result = Gitlab::Profiler.profile('/my-user') + +printer = RubyProf::CallStackPrinter.new(result) +printer.print(File.open('/tmp/profile.html', 'w')) +``` + [GitLab-Profiler](https://gitlab.com/gitlab-com/gitlab-profiler) is a project that builds on this to add some additional niceties, such as allowing configuration with a single Yaml file for multiple URLs, and uploading of the -- cgit v1.2.3