CPU usage of a function

Hello, I want to measure CPU and Memory usage of a function called inside my Go App. This app runs on Ubuntu/Red Hat. What tools can I use to achieve this?

Have you seen pprof?

Yes. Pprof gives top CPU consumers but not the profile for the function I wanted?

Do you want to get monitoring in the production or do you want to just profile your function? If you are running many functions and you want to profile only a spesific functionc I don’t know either how to do it, but if you want to profile only the function, i would run a test function or a main function which calls desired function and profile it.