profile_<timestamp>.col) and a flamegraph file (
profile_<timestamp>.html). Two symbolic links (
last_flamegraph.html) always point to the last output files.
-ooption to specify the output directory.
--rotating-outputis given, only the last results are kept (available via
last_flamegraph.html). This can be used to avoid increasing gProfiler's disk usage over time. Useful in conjunction with
--upload-results(explained ahead) - historical results are available in the Granulate Performance Studio, and the very latest results are available locally.
--no-flamegraphcan be given to avoid generation of the
profile_<timestamp>.htmlfile - only the collapsed stack samples file will be created.
-uflag. Pass the
--tokenoption to specify the token provided by Granulate Performance Studio, and the
--service-nameoption to specify an identifier for the collected profiles, as will be viewed in the Granulate Performance Studio. Profiles sent from numerous gProfilers using the same service name will be aggregated together.
--profiling-frequency: The sampling frequency of the profiling, in hertz.
--profiling-duration: The duration of the each profiling session, in seconds.
--java-mode disabled: Disable profilers for Java.
--no-java-async-profiler-buildids: Disable embedding of buildid+offset in async-profiler native frames (used when debug symbols are unavailable).
--no-python: Alias of
--python-mode: Controls which profiler is used for Python.
auto- (default) try with PyPerf (eBPF), fall back to py-spy.
pyperf- Use PyPerf with no py-spy fallback.
pyspy- Use py-spy.
disabled- Disable profilers for Python.
--php-mode disabled: Disable profilers for PHP.
--php-proc-filter: Process filter (
pgrep) to select PHP processes for profiling (this is phpspy's
--ruby-mode disabled: Disable profilers for Ruby.
--nodejs-mode: Controls which profiler is used for NodeJS.
none- (default) no profiler is used.
perf- augment the system profiler (
perf) results with jitdump files generated by NodeJS. This requires running your
--perf-prof(and for Node >= 10, with
--interpreted-frames-native-stack). See this NodeJS page for more information.
--perf-mode: Controls the global perf strategy. Must be one of the following options:
fp- Use Frame Pointers for the call graph
dwarf- Use DWARF for the call graph (adds the
--call-graph dwarfargument to the
smart- Run both
dwarf, then choose the result with the highest average of stack frames count, per process.
-uflag) This behavior can be disabled by passing
--dont-send-logsor the setting environment variable
-uflag is not set. Otherwise, you can disable metrics and metadata by using the following parameters:
--disable-metrics-collectionto disable metrics collection
--disable-metadata-collectionto disable metadata collection
-cflag. Note that when using
--output-dir, a new file will be created during each sampling interval. Aggregations are only available when uploading to the Granulate Performance Studio.
/lib/modules/$(uname -r)/build. On Ubuntu, this directory is a symlink pointing to
/usr/src. The command above mounts both of these directories.
/tmpby default; if your
/tmpis marked with
noexec, you can add
TMPDIR=/proc/self/cwdto have everything unpacked in your current working directory.
<SERVICE NAME>in the command line with the service name you wish to use
Services, and choose
EC2launch type and the
granulate-gprofilertask definition with the latest revision
Next stepuntil you reach the
Reviewpage, and then click
"pidMode": "host"in the task definition (see documentation of
pidModehere). Host PID is required for gProfiler to be able to profile processes running in other containers (in case of Fargate, other containers under the same
commandparameter of your entry in the
containerDefinitionsarray. The new command should include downloading of gProfiler & executing it in the background.
["python", "/path/to/my/app.py"], we will now change it to:
"bash", "-c", "(wget -q https://github.com/Granulate/gprofiler/releases/latest/download/gprofiler -O /tmp/gprofiler; chmod +x /tmp/gprofiler; /tmp/gprofiler -cu --token <TOKEN> --service-name <SERVICE NAME> --disable-pidns-check --perf-mode none) > /tmp/gprofiler_log 2>&1 & python /path/to/my/app.py". This new command will start the downloading of gProfiler in the background, then run your application.
--disable-pidns-checkis required because, well, we won't run in init PID NS :)
--perf-mode noneis required because our container will not have permissions to run system-wide
perf, so gProfiler will profile only runtime processes. See perf-less mode for more information.
wgetinstalled - you can make sure
wgetis installed, or substitute it with
curlor any other HTTP-downloader you wish.
linuxParametersto the container definition (this goes directly in your entry in
SYS_PTRACEis required by various profilers, and Fargate by default denies it for containers.
Dockerfileto avoid having to download it every time in run-time. Then you just need to invoke it upon container start-up.
<SERVICE NAME>should be replaced with whatever service name you wish to use
commandsection. For example, if you wish to use the
py-spyprofiler, you could replace the command with
-cu --token "<TOKEN>" --service-name "<SERVICE NAME>" --python-mode pyspy.
perfin system wide mode, collecting profiling data for all running processes. Alongside
perf, gProfiler invokes runtime-specific profilers for processes based on these environments:
perfwhich produces native stacks of the JVM / CPython interpreter. The runtime stacks are then merged into the data collected by
perf, substituting the native stacks
perfhas collected for those processes.
perf- this is useful where
perfcan't be used, for whatever reason (e.g permissions). This mode is enabled by
perf). This means that, although the results from different profilers are viewed on the same graph, they are not necessarily of the same scale: so you can compare the samples count of Java to Java, but not Java to Python.
__version__update) and push it.