How long has an application been running? - Smalltalk

This is a discussion on How long has an application been running? - Smalltalk ; Aside from the "take a timestamp when the app starts up" answer does anyone know whether you can determine how long a DST (v6) has been running? If there's no DST way of determining this does anyone know the underlying ...

+ Reply to Thread
Results 1 to 10 of 10

How long has an application been running?

  1. Default How long has an application been running?

    Aside from the "take a timestamp when the app starts up" answer does
    anyone know whether you can determine how long a DST (v6) has been
    running? If there's no DST way of determining this does anyone know the
    underlying MS structure/function?

    There must be an answer somewhere but I guess I've not been asking the
    DST image or MSDN the right questions...

    TIA, Ian


  2. Default Re: How long has an application been running?

    should read "...how long a DST (v6) application has been running?"

    my proof reading's not what it should be...

    Ian


  3. Default Re: How long has an application been running?

    Ian wrote:
    > Aside from the "take a timestamp when the app starts up" answer does
    > anyone know whether you can determine how long a DST (v6) has been
    > running? If there's no DST way of determining this does anyone know the
    > underlying MS structure/function?

    The info you are searching should be available using the Toolhelp API
    (http://msdn.microsoft.com/library/de...lp_library.asp
    and http://www.codeproject.com/threads/enumprocnt5.asp). If I remember
    correctly Steve Waring's SWSysUI package contains wrappers for this
    (http://www.stevewaring.net/dolphin/SWSysUI/index.html).

    CU,

    Udo

  4. Default Re: How long has an application been running?

    Ian wrote:
    > Aside from the "take a timestamp when the app starts up" answer does
    > anyone know whether you can determine how long a DST (v6) has been
    > running? If there's no DST way of determining this does anyone know the
    > underlying MS structure/function?

    The info you are searching should be available using the Toolhelp API
    (http://msdn.microsoft.com/library/de...lp_library.asp
    and http://www.codeproject.com/threads/enumprocnt5.asp). If I remember
    correctly Steve Waring's SWSysUI package contains wrappers for this
    (http://www.stevewaring.net/dolphin/SWSysUI/index.html).

    CU,

    Udo

  5. Default Re: How long has an application been running?

    Ian wrote:

    > Aside from the "take a timestamp when the app starts up" answer does
    > anyone know whether you can determine how long a DST (v6) has been
    > running? If there's no DST way of determining this does anyone know the
    > underlying MS structure/function?


    I don't know of a record of the start time in the image. The Kernel32.dll has
    two functions which I think should suffice:

    GetCurrentProcess()
    http://msdn.microsoft.com/library/en...entprocess.asp

    GetProcessTimes()
    http://msdn.microsoft.com/library/en...ocesstimes.asp

    -- chris



  6. Default Re: How long has an application been running?

    thanks Udo and Chris. I guess I'll try and re-use Steve Waring's work
    rather than re-invent the wheel.

    Ian


  7. Default Re: How long has an application been running?

    Ian,

    > thanks Udo and Chris. I guess I'll try and re-use Steve Waring's work
    > rather than re-invent the wheel.


    Dumb question to keep in mind: does the clock wrap at any point? If so,
    you might be better off saving a time stamp that you can trust.

    Have a good one,

    Bill


    --
    Wilhelm K. Schwab, Ph.D.
    bills@anest4.anest.ufl.edu

  8. Default Re: How long has an application been running?

    Ian wrote:
    > thanks Udo and Chris. I guess I'll try and re-use Steve Waring's work
    > rather than re-invent the wheel.

    After taking a look at the MSDN stuff Chriss sent I would take the way
    Cris proposed.

    Add the following method to KernelLibrary:
    getProccessTime: hProcess lpCreationTime: lpCreationTime lpExitTime:
    lpExitTime lpKernelTime: lpKernelTime lpUserTime: lpUserTime
    "The GetProcessTimes function retrieves timing information for the
    specified process.

    BOOL GetProcessTimes(
    HANDLE hProcess,
    LPFILETIME lpCreationTime,
    LPFILETIME lpExitTime,
    LPFILETIME lpKernelTime,
    LPFILETIME lpUserTime
    );"

    <stdcall: bool GetProcessTimes handle FILETIME* FILETIME* FILETIME*
    FILETIME*>
    ^self invalidCall


    You should now be able to execute the following code:
    lpCreationTime := FILETIME new.
    lpExitTime := FILETIME new.
    lpKernelTime := FILETIME new.
    lpUserTime := FILETIME new.
    KernelLibrary default
    getProccessTime: KernelLibrary default getCurrentProcess
    lpCreationTime: lpCreationTime
    lpExitTime: lpExitTime
    lpKernelTime: lpKernelTime
    lpUserTime: lpUserTime


    The different FILETIMEs should now contain the times you are searching for.

    CU,

    Udo

  9. Default Re: How long has an application been running?

    Bill,

    > Dumb question to keep in mind: does the clock wrap at any point?


    With GetProcessTimes() everything's expressed as FILETIMEs, which overflow
    after about 6000 years. Ian should be /fairly/ safe ;-)

    -- chris




  10. Default Re: How long has an application been running?

    Chris,

    >>Dumb question to keep in mind: does the clock wrap at any point?

    >
    >
    > With GetProcessTimes() everything's expressed as FILETIMEs, which overflow
    > after about 6000 years. Ian should be /fairly/ safe ;-)


    True. Linux could run that long, but _Windows_!!!!

    Have a good one,

    Bill


    --
    Wilhelm K. Schwab, Ph.D.
    bills@anest4.anest.ufl.edu

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 08-23-2007, 10:40 AM
  2. Replies: 0
    Last Post: 08-23-2007, 10:10 AM
  3. popen and a long running process in a wx.python application
    By Application Development in forum Python
    Replies: 3
    Last Post: 06-27-2007, 07:38 AM
  4. Replies: 3
    Last Post: 07-05-2006, 10:05 PM
  5. Long running queries
    By Application Development in forum XML SOAP
    Replies: 4
    Last Post: 02-21-2006, 03:19 PM