While there is many different ways to do it, having a dedicated tool to count how many processes an executable file are currently running was one of my need. And because I wanted a really performant way of doing it, I wrote this tiny tool named pcount
.
Here is the full C source code, no specific license attached, the code is really too trivial to claim for anything ^^: