From 54b98fc1aaf6373856e4005380ef136b4db92dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Mon, 27 Apr 2020 12:29:39 +0000 Subject: [PATCH 1/3] Sensible defaults: fontsize --- src/ProfileView.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProfileView.jl b/src/ProfileView.jl index 9997c8c..e9bdb0d 100644 --- a/src/ProfileView.jl +++ b/src/ProfileView.jl @@ -48,7 +48,7 @@ end const window_wrefs = WeakKeyDict{Gtk.GtkWindowLeaf,Nothing}() """ - ProfileView.view([fcolor], data=Profile.fetch(); lidict=nothing, C=false, recur=:off, fontsize=14, kwargs...) + ProfileView.view([fcolor], data=Profile.fetch(); lidict=nothing, C=false, recur=:off, fontsize=30, kwargs...) View profiling results. `data` and `lidict` must be a matched pair from `Profile.retrieve()`. You have several options to control the output, of which the major ones are: From b2f4fd8a4fab27a184cf8740ea6afa66721ef8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Mon, 27 Apr 2020 12:32:38 +0000 Subject: [PATCH 2/3] Fontsize and some lines merged --- README.md | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index a440b95..2a2b61d 100644 --- a/README.md +++ b/README.md @@ -7,15 +7,9 @@ # Introduction -This package contains tools for visualizing profiling data collected -with [Julia's][Julia] built-in sampling -[profiler][Profiling]. It -can be helpful for getting a big-picture overview of the major -bottlenecks in your code, and optionally highlights lines that trigger -garbage collection as potential candidates for optimization. - -This type of plot is known as a [flame -graph](https://github.com/brendangregg/FlameGraph). +This package contains tools for visualizing profiling data collected with [Julia's][Julia] built-in sampling [profiler][Profiling]. It can be helpful for getting a big-picture overview of the major bottlenecks in your code, and optionally highlights lines that trigger garbage collection as potential candidates for optimization. + +This type of plot is known as a [flame graph](https://github.com/brendangregg/FlameGraph). The main logic is handled by the [FlameGraphs][FlameGraphs] package; this package is just a visualization front-end. ## Installation @@ -28,8 +22,7 @@ Pkg.add("ProfileView") ## Usage and visual interpretation -To demonstrate ProfileView, first we have to collect some profiling -data. Here's a simple test function for demonstration: +To demonstrate ProfileView, first we have to collect some profiling data. Here's a simple test function for demonstration: ```julia function profile_test(n) @@ -74,14 +67,12 @@ The horizontal axis represents the amount of time (more precisely, the number of backtraces) spent at each line. The row at which the single long bar breaks up into multiple different-colored bars corresponds to the execution of different lines from `profile_test`. -The fact that -they are all positioned on top of the lower peach-colored bar means that all +The fact that they are all positioned on top of the lower peach-colored bar means that all of these lines are called by the same "parent" function. Within a block of code, they are sorted in order of increasing line number, to make it easier for you to compare to the source code. -From this visual representation, we can very quickly learn several -things about this function: +From this visual representation, we can very quickly learn several things about this function: - On the right side, you see a stack of calls to functions in `sort.jl`. This is because sorting is implemented using recursion (functions that call themselves). @@ -103,8 +94,7 @@ fraction of the top of a call stack, as only in such cases are they likely to be the source of a significant performance bottleneck. We can see that `mapslices` relies on run-time dispatch; from the absence of pastel-colored bars above much of the red, we -might guess that this makes a substantial -contribution to its total run time. +might guess that this makes a substantial contribution to its total run time. ## GUI features @@ -142,7 +132,7 @@ Use the format provided by FlameGraphs v0.2 and higher. The `view` command has the following syntax: ``` -function view([fcolor,] data = Profile.fetch(); lidict = nothing, C = false, fontsize = 14, kwargs...) +function view([fcolor,] data = Profile.fetch(); lidict = nothing, C = false, fontsize = 30, kwargs...) ``` Here is the meaning of the different arguments: From bb046a6e2e35223849d2303508b5bfc98f1c5691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Haraldsson?= Date: Mon, 27 Apr 2020 13:03:54 +0000 Subject: [PATCH 3/3] Line moved [skip ci] --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2a2b61d..759252d 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,10 @@ This plot is a visual representation of the *call graph* of the code that you ju The "root" of the tree is at the bottom; if you move your mouse along the long horizontal bar at the bottom, you'll see a tooltip that's something like ``` -boot.jl, eval: 330 +boot.jl, eval: 331 ``` This refers to one of Julia's own source files, [base/boot.jl][bootjl]. -`eval` is the name of the function being executed, and `330` is the line number of the file. +`eval` is the name of the function being executed, and `331` is the line number of the file. This is the function that evaluated your `profile_test(10)` command that you typed at the REPL. (Indeed, to reduce the amount of internal "overhead" in the flamegraph, some of these internals are truncated; see the `norepl` option of `FlameGraphs.flamegraph`.) If you move your mouse upwards, you'll then see bars corresponding to the function(s) you ran with `@profview` (in this case, `profile_test`).