Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Specialised task manager

Specialised task manager

Scheduled Pinned Locked Moved C#
performancegraphicsquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    clatten
    wrote on last edited by
    #1

    I was thinking of creating a simple, specialised task manager. It seems quite easy to use the Diagnostics.Process class to get processes memory and CPU usage. But I also need to get GDI and USER objects per process. Is there any similar class for that or is it performance counters or WMI I need to look into?

    H 1 Reply Last reply
    0
    • C clatten

      I was thinking of creating a simple, specialised task manager. It seems quite easy to use the Diagnostics.Process class to get processes memory and CPU usage. But I also need to get GDI and USER objects per process. Is there any similar class for that or is it performance counters or WMI I need to look into?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      clatten wrote: Is there any similar class for that or is it performance counters or WMI I need to look into? Yes, you do need to use performance counters for this. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

      C 1 Reply Last reply
      0
      • H Heath Stewart

        clatten wrote: Is there any similar class for that or is it performance counters or WMI I need to look into? Yes, you do need to use performance counters for this. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

        C Offline
        C Offline
        clatten
        wrote on last edited by
        #3

        Hi Heath, thanks for your answer. I did look into the performance objects in PerfMon (I have a XP Home WS at home and a Win2K WS at work) and could not find any counters for the process object. Actually I could not find any counter for this. I have looked with exctrlst.exe and could not find any disabled counters. So I have to ask if you can point me in the right direction on how to proceed: 1. Do I have to do something to add more counters to the process object (or they might just not are available in WS PerfMon). 2. Is there any other performance object I should look into (but I still want the count per process as in the Task manager).

        H 1 Reply Last reply
        0
        • C clatten

          Hi Heath, thanks for your answer. I did look into the performance objects in PerfMon (I have a XP Home WS at home and a Win2K WS at work) and could not find any counters for the process object. Actually I could not find any counter for this. I have looked with exctrlst.exe and could not find any disabled counters. So I have to ask if you can point me in the right direction on how to proceed: 1. Do I have to do something to add more counters to the process object (or they might just not are available in WS PerfMon). 2. Is there any other performance object I should look into (but I still want the count per process as in the Task manager).

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          If you can't find performance counters that suit your needs, you'll need to P/Invoke native APIs when appropriate, like GetPerformanceInfo or GetProcessMemoryInfo, both defined in psapi.dll on XP and newer. I recommend reading the native performance monitoring and Processes sections of the Platform SDK at http://msdn.microsoft.com/library[^]. The .NET BCL by no means provides a full set of diagnostic APIs for issues like this. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

          C 1 Reply Last reply
          0
          • H Heath Stewart

            If you can't find performance counters that suit your needs, you'll need to P/Invoke native APIs when appropriate, like GetPerformanceInfo or GetProcessMemoryInfo, both defined in psapi.dll on XP and newer. I recommend reading the native performance monitoring and Processes sections of the Platform SDK at http://msdn.microsoft.com/library[^]. The .NET BCL by no means provides a full set of diagnostic APIs for issues like this. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles] [My Blog]

            C Offline
            C Offline
            clatten
            wrote on last edited by
            #5

            Through googling I later found that the easiest way was to use the GetGuiResources method in User32.dll. This provides the GDI and USER objects counters for each process.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups