I am trying to figure out how to monitor or figure out how much memory/cpu/time it takes to start a specific process in linux. Many tools I have looked into such as pipstat, perf and atop all require an existing pid.
The challenge for me is that I want to figure out the resource consumption at the time the process is booting up. For example, running systemctl start <process_name>
From my understanding a pid has not been assigned till it is already running.
I tried to use atop but couldn't get a very good granularity from that in the logs.
The closest thing I have so far is using systemmd-bootchart which has gotten me an idea of how long it takes to start up some processes but it does not tell me resource consumption and I have to restart the system every time.
Any ideas on how I can get the resource consumption/total boot time of a process starting up?