Installing gProfiler with your command line interface is one of the easiest ways to get started profiling your code. First, sign up for gProfiler. Once inside the platform, go to Install Service, and then choose Command line.
Here you will see your unique API key. Before continuing, be sure to have your preferred software package management tool and are able to wget on your machine. Run
pgrep gprofilerin your machine: You should not see any output, if you do see any PIDs it means that gProfiler is running and it must be stopped before starting it again (you can stop it with
sudo pkill -TERM gprofiler).
pgrepdoesn't find any process, try running without
> /dev/null 2>&1 &so you can inspect the output, and look for errors. Once you’re sure there gProfiler isn’t already running, choose a service name and then run the following in your terminal, replacing the value with your API key string and the value with your chosen service name string:
wget https://github.com/Granulate/gprofiler/releases/latest/download/gprofiler_$(uname -m) -O gprofiler
sudo chmod +x gprofiler
sudo sh -c "setsid ./gprofiler -cu --token <token> --service-name <service>
You will see your machine begin to pull the required data from granulate/gprofiler.
To check again that gProfiler is running, run
pgrep gprofilerto ensure that the gProfiler appears on your machine’s PID list. Once you’ve confirmed, go to Profiles on the gProfiler interface. You should see profiling data from your service when filtering for data in the Last Hour. On the gProfiler Overview page, you should also see your service listed, with a Create Date of ‘Today’, and ‘Analyzing’ in the Optimization Potential column.