The command
ps -o time -p 21361
works; however what I need is the running time of the process including all the children. For example, if 21361 is a bash script, which calls other scripts, then I want the total running time, including the running time of all children.
Now the ps documentation lists the "OUTPUT MODIFIER":
S
Sum up some information, such as CPU usage, from dead child processes into their parent. This is useful for examining a system where a parent process repeatedly forks off short-lived children to do work.
Sounds just right. Unfortunately, there is no specification of the ps-syntax, so I have no clue where to place the "S"! For hours now I tried many combinations, but either I get syntax errors, or "S" makes nothing. And on the Internet you find only very basic information about ps (and always the same), specifically the "S" modifier I couldn't find mentioned anywhere, and also nobody ever explains the syntax of ps.