Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ep:labs:03:contents:tasks:ex6 [2023/10/21 16:52]
andrei.mirciu [04. [30p] Perf & fuzzing]
ep:labs:03:contents:tasks:ex6 [2023/10/21 17:43] (current)
andrei.mirciu [04. [30p] Perf & fuzzing]
Line 81: Line 81:
 <code bash> <code bash>
 $ sudo su $ sudo su
-echo -1 > /​proc/​sys/​kernel/​perf_event_paranoid +echo -1 > /​proc/​sys/​kernel/​perf_event_paranoid 
-exit+exit
 </​code>​ </​code>​
  
Line 103: Line 103:
 === [10p] Task C - Flame Graph === === [10p] Task C - Flame Graph ===
  
-A [[https://​www.brendangregg.com/​flamegraphs.html|Flame Graph]] is a graphical representation of the stack traces captured by the **perf** profiler during the execution of a program. It provides a visual depiction of the call stack, showing which functions were active and how much time was spent in each one of them. By analyzing the flame graph generated by perf, we can identify performance bottlenecks and pinpoint areas of the code that may need optimization or further investigation.+A [[https://​www.brendangregg.com/​flamegraphs.html|Flame Graph]] is a graphical representation of the stack traces captured by the **perf** profiler during the execution of a program. It provides a visual depiction of the call stack, showing which functions were active and how much time was spent in each one of them. By analyzing the flame graph generated by //perf//, we can identify performance bottlenecks and pinpoint areas of the code that may need optimization or further investigation
 + 
 +When analyzing flame graphs, it's crucial to focus on the width of each stack frame, as it directly indicates the number of recorded events following the same sequence of function calls. In contrast, the height of the frames does not carry significant implications for the analysis and should not be the primary focus during interpretation.
  
 Using the samples previously obtained in //​perf.data//,​ generate a corresponding Flame Graph in SVG format and analyze it. Using the samples previously obtained in //​perf.data//,​ generate a corresponding Flame Graph in SVG format and analyze it.
 +
 +<​note>​
 +How to do:
 +  - Clone the following git repo: https://​github.com/​brendangregg/​FlameGraph.
 +  - Use the **stackcollapse-perf.pl** Perl script to convert the //​perf.data//​ output into a suitable format (it folds the perf-script output into one line per stack, with a count of the number of times each stack was seen).
 +  - Generate the Flame Graph using **flamegraph.pl** (based on the folded data) and redirect the output to an SVG file.
 +  - Open in any browser the interactive SVG graph obtained and inspect it.
 +
 +More details can also be found [[https://​www.brendangregg.com/​FlameGraphs/​cpuflamegraphs.html|here]] and [[https://​gitlab.com/​gitlab-com/​runbooks/​-/​blob/​v2.220.2/​docs/​tutorials/​how_to_use_flamegraphs_for_perf_profiling.md|here]].
 +</​note>​
  
  
    
ep/labs/03/contents/tasks/ex6.1697896334.txt.gz · Last modified: 2023/10/21 16:52 by andrei.mirciu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0