WINAPI to monitor performance of VB COM


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: WINAPI to monitor performance of VB COM

  1. #1
    Dave Guest

    WINAPI to monitor performance of VB COM


    Hello all:
    Are there any WINAPIs (or any other method for that matter) that will allow
    me to gather information on the memory and CPU utilization of a specific
    COM object written in Visual Basic...particularly compiled as a .dll. I
    know in the windows NT/2000 performance monitor, you can monitor vb applications,
    but I would like to actually see the actual stats down to the object. I
    appreciate your time.

    Dave

  2. #2
    L.J. Johnson Guest

    Re: WINAPI to monitor performance of VB COM

    Dave,

    > Are there any WINAPIs (or any other method for that matter) that will

    allow
    > me to gather information on the memory and CPU utilization of a specific
    > COM object written in Visual Basic...particularly compiled as a .dll. I


    Well, the way varies depending upon the operation system. For Win9x, you
    would use ToolHelp32 api calls (there is an article on this somewhere on the
    DevX site from VBPJ. For NT, the easiest way is to use PSAPI.dll. I have the
    code from an article I did for VBPJ at my web site (below -- look under VBPJ
    Code, Create Your Own ToolHelp for NT). However, this gives you information
    on *processes*, and a DLL runs as part of a process.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




  3. #3
    L.J. Johnson Guest

    Re: WINAPI to monitor performance of VB COM

    Dave,

    > Are there any WINAPIs (or any other method for that matter) that will

    allow
    > me to gather information on the memory and CPU utilization of a specific
    > COM object written in Visual Basic...particularly compiled as a .dll. I


    Well, the way varies depending upon the operation system. For Win9x, you
    would use ToolHelp32 api calls (there is an article on this somewhere on the
    DevX site from VBPJ. For NT, the easiest way is to use PSAPI.dll. I have the
    code from an article I did for VBPJ at my web site (below -- look under VBPJ
    Code, Create Your Own ToolHelp for NT). However, this gives you information
    on *processes*, and a DLL runs as part of a process.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




  4. #4
    Dave Guest

    Re: WINAPI to monitor performance of VB COM


    L.J.,
    This looks like almost what I need. Now I am curious. Can I take a module
    ID, name, base address, etc. and find specific memory consumption and cpu
    utilization while it is loaded in memory? I assume there much be a hook
    in there somewhere. For instance, if a .dll is running on a web server,
    if I dive far enough into the IIS process... could I find my COM and verify
    its statistics aren't going to crash my server :-)
    Thanks,
    Dave


    "L.J. Johnson" <ljjohnsn@flash.net> wrote:
    >Dave,
    >
    >> Are there any WINAPIs (or any other method for that matter) that will

    >allow
    >> me to gather information on the memory and CPU utilization of a specific
    >> COM object written in Visual Basic...particularly compiled as a .dll.

    I
    >
    >Well, the way varies depending upon the operation system. For Win9x, you
    >would use ToolHelp32 api calls (there is an article on this somewhere on

    the
    >DevX site from VBPJ. For NT, the easiest way is to use PSAPI.dll. I have

    the
    >code from an article I did for VBPJ at my web site (below -- look under

    VBPJ
    >Code, Create Your Own ToolHelp for NT). However, this gives you information
    >on *processes*, and a DLL runs as part of a process.
    >
    >--
    >L.J. Johnson, Slightly Tilted Software
    >Microsoft MVP (Visual Basic)
    >LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    ><http://www.SlightlyTiltedSoftware.com>
    >Ask The NT Pro at <http://www.inquiry.com>
    >
    >
    >



  5. #5
    Dave Guest

    Re: WINAPI to monitor performance of VB COM


    L.J.,
    This looks like almost what I need. Now I am curious. Can I take a module
    ID, name, base address, etc. and find specific memory consumption and cpu
    utilization while it is loaded in memory? I assume there much be a hook
    in there somewhere. For instance, if a .dll is running on a web server,
    if I dive far enough into the IIS process... could I find my COM and verify
    its statistics aren't going to crash my server :-)
    Thanks,
    Dave


    "L.J. Johnson" <ljjohnsn@flash.net> wrote:
    >Dave,
    >
    >> Are there any WINAPIs (or any other method for that matter) that will

    >allow
    >> me to gather information on the memory and CPU utilization of a specific
    >> COM object written in Visual Basic...particularly compiled as a .dll.

    I
    >
    >Well, the way varies depending upon the operation system. For Win9x, you
    >would use ToolHelp32 api calls (there is an article on this somewhere on

    the
    >DevX site from VBPJ. For NT, the easiest way is to use PSAPI.dll. I have

    the
    >code from an article I did for VBPJ at my web site (below -- look under

    VBPJ
    >Code, Create Your Own ToolHelp for NT). However, this gives you information
    >on *processes*, and a DLL runs as part of a process.
    >
    >--
    >L.J. Johnson, Slightly Tilted Software
    >Microsoft MVP (Visual Basic)
    >LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    ><http://www.SlightlyTiltedSoftware.com>
    >Ask The NT Pro at <http://www.inquiry.com>
    >
    >
    >



  6. #6
    L.J. Johnson Guest

    Re: WINAPI to monitor performance of VB COM

    Dave,

    > This looks like almost what I need. Now I am curious. Can I take a

    module
    > ID, name, base address, etc. and find specific memory consumption and cpu
    > utilization while it is loaded in memory?


    You can find CPU utilization of a thread via the performance monitor API
    (run PerfMon.exe and look at the available items for Threads).
    I have a sample of this also on my web site ("Use PDH Interface to Capture
    NT Performance Data"). I haven't seen anything about memory consumption for
    a thread.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




  7. #7
    L.J. Johnson Guest

    Re: WINAPI to monitor performance of VB COM

    Dave,

    > This looks like almost what I need. Now I am curious. Can I take a

    module
    > ID, name, base address, etc. and find specific memory consumption and cpu
    > utilization while it is loaded in memory?


    You can find CPU utilization of a thread via the performance monitor API
    (run PerfMon.exe and look at the available items for Threads).
    I have a sample of this also on my web site ("Use PDH Interface to Capture
    NT Performance Data"). I haven't seen anything about memory consumption for
    a thread.

    --
    L.J. Johnson, Slightly Tilted Software
    Microsoft MVP (Visual Basic)
    LJJohnson@SlightlyTiltedSoftware.com or LJJohnson@mvps.org
    <http://www.SlightlyTiltedSoftware.com>
    Ask The NT Pro at <http://www.inquiry.com>




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center