Was wondering how I can programmatically get performance metrics for a given sql server instance or database by using SMO (sql management objects). Basically similar to what the Activity Monitor in Sql Management Studio displays.
So for example if I want to know things like the CPU usage, I/O writes, etc, which SMO object will give me that?
I've tried using the following but I don't think I'm on the right track.
Server srv = new Server(conn);
DataRow[] datarows = srv.EnumPerformanceCounters().Select();