flamescope
FlameScope is a visualization tool for exploring different time ranges as Flame Graphs.
Top Related Projects
Stack trace visualizer
Performance analysis tools based on Linux perf_events (aka perf) and ftrace
Quick Overview
FlameScopeは、Netflixが開発したプロファイリングツールで、アプリケーションのパフォーマンス分析を支援します。FlameScopeは、アプリケーションのCPUプロファイルを視覚化し、パフォーマンスボトルネックを特定するのに役立ちます。
Pros
- 直感的なユーザーインターフェイスで、パフォーマンス分析が容易
- 複数のプロファイリングツールをサポート (perf、DTrace、LTTng、etc.)
- オープンソースで、コミュニティによる継続的な改善が期待できる
Cons
- 一部のプロファイリングツールに依存しているため、サポートされていないプラットフォームでは使用できない
- 大規模なデータセットの処理に時間がかかる可能性がある
- 学習曲線が少し急峻かもしれない
Getting Started
FlameScopeの使用を開始するには、以下の手順に従います:
- リポジトリをクローンします:
git clone https://github.com/Netflix/flamescope.git
- 必要な依存関係をインストールします:
cd flamescope
pip install -r requirements.txt
- FlameScopeを起動します:
python app.py
- ブラウザで
http://localhost:5000
にアクセスします。
これで、FlameScopeのWebインターフェイスが表示されます。プロファイルデータをアップロードして、アプリケーションのパフォーマンス分析を開始できます。
Competitor Comparisons
Stack trace visualizer
Pros of FlameGraph
- FlameGraph is a more mature and feature-rich tool, with a larger community and more documentation.
- FlameGraph supports a wider range of input formats, including perf, DTrace, and SystemTap.
- FlameGraph provides more customization options, such as the ability to adjust the color scheme and font size.
Cons of FlameGraph
- FlameGraph may have a steeper learning curve, as it has more advanced features and configuration options.
- FlameGraph is a standalone tool, while FlameScopeintegrates with Netflix's internal tooling and infrastructure.
- FlameGraph may not have the same level of integration and support for specific use cases as FlameScopewithin the Netflix ecosystem.
Code Comparison
FlameGraph:
#!/usr/bin/perl -w
use strict;
my $infile = shift || die "Usage: $0 input-file\n";
my $outfile = shift || "$infile.svg";
open my $fh, '<', $infile or die "Can't open $infile: $!";
my @lines = <$fh>;
close $fh;
my @stack = ();
my %counts = ();
foreach my $line (@lines) {
chomp $line;
my @frames = split /;/, $line;
push @stack, $_ foreach reverse @frames;
$counts{join(';', @stack)}++;
pop @stack while @stack;
}
FlameScopeCore:
def _build_flamegraph(self, profile_data):
"""Build a flamegraph from the profile data."""
flamegraph = defaultdict(int)
for sample in profile_data:
stack = sample.split(";")
for i in range(len(stack)):
flamegraph[";".join(stack[:i+1])] += 1
return flamegraph
Performance analysis tools based on Linux perf_events (aka perf) and ftrace
Pros of perf-tools
- Comprehensive collection of performance analysis tools for Linux, including
perf
,bpftrace
, andflamegraph
- Actively maintained with regular updates and bug fixes
- Extensive documentation and examples for using the various tools
Cons of perf-tools
- Requires a deeper understanding of Linux performance analysis concepts and tools
- May have a steeper learning curve compared to a more user-friendly tool like FlameScopeNot as visually appealing or easy to use as some other performance analysis tools
Code Comparison
FlameScopeNETFLIX/flamescope:
import flamescope
from flamescope.app import create_app
app = create_app()
app.run(host='0.0.0.0', port=5000)
perf-tools/perf-tools:
#!/bin/bash
# Generate a flamegraph from a perf record
perf record -F 99 -a -g -- sleep 60
perf script | ./stackcollapse-perf.pl | ./flamegraph.pl > perf-kernel.svg
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
FlameScope
FlameScope is a visualization tool for exploring different time ranges as Flame Graphs, allowing quick analysis of performance issues such as perturbations, variance, single-threaded execution, and more.
FlameScope begins by displaying the input data as an interactive subsecond-offset heat map. This shows patterns in the data. You can then select a time range to highlight on different patterns, and a flame graph will be generated just for that time range.
Disclaimer
FlameScope is in early stages of development and under constant change, so bugs and issues are expected. We count on your support to find and report them!
Installation / Instructions
The quickest way to get started is to run the pre-built client bundle:
$ git clone https://github.com/Netflix/flamescope
$ cd flamescope
$ pip install -r requirements.txt
$ python run.py
(Note python3 is assumed, python2 may work)
Then browse to http://127.0.0.1:5000/, and you can begin exploring profiles from the examples
directory. You can add new profiles to that directory, collected using Linux perf
. Here are instructions for a generic CPU profile at 49 Hertz for 120 seconds:
$ sudo perf record -F 49 -a -g -- sleep 120
$ sudo perf script --header > stacks.myproductionapp.2018-03-30_01
$ gzip stacks.myproductionapp.2018-03-30_01 # optional
If you are profiling C++ code, you may want to pipe stacks through c++filt
to get readable frames.
There are extra steps to fetch stacks correctly for some runtimes, depending on the runtime. For example, we've previously published Java steps in Java in Flames: java needs to be running with the -XX:+PreserveFramePointer option, and perf-map-agent must be run immediately after the perf record
to dump a JIT symbol table in /tmp.
FlameScope can visualize any Linux perf script
output that includes stack traces, including page faults, context switches, and other events. See the References section below for documentation.
FlameScope is composed of two main components, the Python backend, and a React client interface. A pre-built client bundle is distributed with the backend, so the quickest way to get started is to install the Python requirements and start the application, as described earlier.
Although not necessary, we strongly suggest using virtualenv to isolate your Python environment.
By default, FlameScope will load a list of files from the examples
directory, which includes a two profile examples.
Configuration Options
FlameScope configuration file can be found in app/config.py
.
DEBUG = True # run the web server in debug mode
PROFILE_DIR = 'examples' # path where flamescope will look for profiles
HOST = '127.0.0.1' # web server host
PORT = 5000 # web server port
JSONIFY_PRETTYPRINT_REGULAR = False # pretty print api json responses
Building Client from Source
In order to build the client application from source, the following command line tools must be installed:
Once those tools are available, you will be able to install the project dependencies and generate a build.
$ npm install
$ npm run webpack
The npm run webpack
command will generate a new build under app/public
. This directory is exposed by the Python web server.
Webpack can also watch and recompile files whenever they change. To build and start the watch task, run the following command:
$ npm run webpack-watch
Building a Docker Image
FlameScope provides a Dockerfile to build a Docker image:
$ cd flamescope
$ docker build -t flamescope .
The container expects the profiles to be bind-mounted into /profiles
and listens on port 5000. To view profiles from /tmp/profiles
, start the container with the following command:
$ docker run --rm -it -v /tmp/profiles:/profiles:ro -p 5000:5000 flamescope
Then access FlameScope on http://127.0.0.1:5000
References
Top Related Projects
Stack trace visualizer
Performance analysis tools based on Linux perf_events (aka perf) and ftrace
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot