Getting values from taskmgr.exe programatically RRS feed

  • Question

  • Hi,

    I am using SQL Server 2008 on Windows Server 2008. When I remote into the server I can run taskmgr.exe and view the cpu use and the total memory using the performance tab and it shows the information in very easy to read graphs.

    I would like to get a snapshot of these values sent to me each morning by email without loging into the server.

    I am getting the cpu values from sys.dm_os_ring_buffers and that works fine.

    But I can't seem to find any place that holds the total memory in use. I've tried record RING_BUFFER_SCHEDULER_MONITOR but the value this returns doesn't match up quite with what I see in the taskmgr graph. At the time of running the above, the graph was showing "memory / physical memory usage history = 2.23GB" but the RING_BUFFER_SCHEDULER_MONITOR output didn't show any 2.23GB values, anywhere in this output.

    I've looked at various dmv's ( eg. sys.dm_os_sys_memory ) but can't seem to tie up any values to match what I am seeing in taskmgr for memory use.

    Is there a view showing op system mem use?

    Any tips appreciated.

    Regards, Dave


    Tuesday, June 21, 2011 11:41 AM

All replies

  • You can get the values for the system state. You will need to use PDH* APIs to do that. Once you have the values, formate it the way you wish to see and save it in CSV. It will be easy to build graphs in excel once you have the values saved in CSV.

    There isn't seems to be a straight forward way of getting the snap-shots of the task manager.

    Kinect rocks !!
    Thursday, June 23, 2011 7:01 AM
  • Thanks Prateek.

    Rgds, Dave.

    Thursday, June 23, 2011 2:38 PM