How to measure CPU usage and memory for a process using .Net Core 3.1 for windows, Linux and Mac os?, c++, linux, macos, windows

I want to get cpu and ram utilization in windows,linux and mac os.
Also i need sql server(Sqlservr) process cpu and ram utilization.

I am trying this in asp dot net core 3.1 but not able to found any solution.

I am able to get dot net application cpu and ram usage using dotnet counters following command:

dotnet counters monitor –process-id 11812 –providers MyEventCounter

Refered link :

Please suggest me the solution or any other technology to get this done.

Environment used: Windows 10,Visual studio 2019 and dot net core 3.1

Source: Windows Questions