Measure Application Launch time?

Application Launch means application has been loaded properly.

Also mean, its program is loaded finished.


To resolve this problem, key, is define the point on loading is finished.


I tries these ways:

#1, Find the loaded Window. After it is loaded, get its handle and close it. Make this duration as Application launch time + loading time.

       Failure, 

                     For some main application spend much time of loading after Computer resource has been assign include handles.

                     so, handle can be get as it is assign in memory, but this time, the process is still in loading. Example, AutoCAD


#2, Measure program resource usage like CPU Time, Memory Usage

      Failure,

                   For CPU Time or Memory Usage can not be updated in each ms, even 100ms, and 1000ms.

                   The sleep time for this should be at least 1000ms.

                   Even we make the wait time in 1000ms in each recycle, we may get the equal before Application loading finished.

                   Even the loading is finished, how to calculate the time spending duration? Should decrease the wait time? or not ?


#3, Kernel PCB contain Process status :  wait, ready, running

         It is a technology problem. 

         Can not find information on how to get WINDOWS Kernel PCB.

 

Last , i get a mind, why can i get window information? Window store process PCB information, there should be some place store windows information.

Maybe the window information can resolve this.

I find it.


//Codes

    //you also need to define this struct
    public struct WINDOWINFO
        {
            public uint cbSize;
            public RECT rcWindow; //holds the coords of the window
            public RECT rcClient;
            public uint dwStyle;
            public uint dwExStyle;
            public uint dwWindowStatus;
            public uint cxWindowBorders;
            public uint cyWindowBorders;
            public ushort atomWindowType;
            public ushort wCreatorVersion;
        }


    //this holds the coordinates
    public struct RECT 
        {
            public int Left;    // Specifies the x-coordinate of the upper-left corner of the rectangle. 
            public int Top;        // Specifies the y-coordinate of the upper-left corner of the rectangle. 
            public int Right;    // Specifies the x-coordinate of the lower-right corner of the rectangle.
            public int Bottom;    // Specifies the y-coordinate of the lower-right corner of the rectangle. 
        }


do

 {

  Helper.GetWindowInfo(hwnd, ref WINDOWINFO); 

 } while (WINDOWINFO.dwWindowStatus == 0);


If application loading is finished, it will show the one window immediately, we just need to capture this window and get this window status as it is ACTIVE.

And that time, application is loading finished.

I think so.


Hope your different suggestions. Readers.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值