WO2014146612A1 - Startup item consumed time acquisition method and device - Google Patents

Startup item consumed time acquisition method and device Download PDF

Info

Publication number
WO2014146612A1
WO2014146612A1 PCT/CN2014/073922 CN2014073922W WO2014146612A1 WO 2014146612 A1 WO2014146612 A1 WO 2014146612A1 CN 2014073922 W CN2014073922 W CN 2014073922W WO 2014146612 A1 WO2014146612 A1 WO 2014146612A1
Authority
WO
WIPO (PCT)
Prior art keywords
time
consuming
startup
startup item
consumption
Prior art date
Application number
PCT/CN2014/073922
Other languages
French (fr)
Chinese (zh)
Inventor
符气康
聂科峰
魏雪
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2014146612A1 publication Critical patent/WO2014146612A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3419Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment by assessing time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Definitions

  • the present invention relates to the field of electronic communication technologies, and in particular, to a method and an apparatus for acquiring a startup item in a time-consuming manner.
  • a startup item refers to an add-on that a device (such as a computer) runs after being triggered by a non-user operation after being powered on, including but not limited to the following categories: a service item, a scheduled task to be started up, a file in a user startup folder, The keys to be run at boot time are registered in the registry.
  • the startup items referred to in this article all correspond to one process.
  • the startup item takes time, that is, the process corresponding to the startup item takes time.
  • the operating system loads a lot of startup items when it is powered on, and these startup items slow down the system and increase the user's boot time. Users only rely on the senses, it is difficult to determine which startup item makes the system boot and run slower. If the time of the process corresponding to each startup item is obtained in the booting phase, it is possible to determine the startup item that makes the system boot slower, and selectively disable or delete it to achieve the effect of increasing the booting speed.
  • Embodiments of the present invention provide a method for acquiring a startup item in a time-consuming manner, including:
  • the first process is corresponding to the startup item
  • the second process is a child process of the first process
  • the embodiment of the invention further provides a device for acquiring time-consuming time, which comprises:
  • An obtaining unit configured to acquire a time-consuming process of the first process and a time-consuming process of the second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
  • a calculating unit configured to calculate a time consuming time of the first process and the second process, and use the sum as the startup item
  • control unit is configured to disable the startup item when the startup item takes longer than a preset threshold.
  • Embodiments of the present invention provide a non-transitory storage medium on which computer executable instructions are stored. When the executable instructions are run in a computer, the following steps are performed:
  • the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
  • FIG. 1 is a schematic flowchart of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of another method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a device for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 1 is a schematic flowchart of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of another method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 4 is a schematic structural diagram of a device for acquiring a time-consuming
  • FIG. 6 is a schematic structural diagram of another time-consuming acquisition device for a startup item according to an embodiment of the present invention
  • FIG. 7 is another schematic diagram of an apparatus for time-consuming acquisition of an activation item according to an embodiment of the present invention
  • FIG. 8 is a schematic flowchart of another method for acquiring a time-consuming acquisition item according to an embodiment of the present invention
  • FIG. 9 is another startup item according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural diagram of another time-consuming acquisition device for a startup item according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
  • the present invention will be further described in detail with reference to the accompanying drawings, in which FIG. An embodiment. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
  • An embodiment of the present invention provides a method for acquiring a startup item in a time-consuming manner. As shown in FIG. 1, the method includes steps 101 to 103.
  • step 101 acquiring the first process time-consuming and the second process time-consuming, the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
  • step 102 the time consuming of the first process and the time consuming by the second process is taken as the start item.
  • step 103 when the startup item takes longer than the preset threshold, the startup item is disabled.
  • the process corresponding to the startup item ends, the process still consumes system resources and affects system startup.
  • the process by calculating the elapsed time of the process corresponding to the startup item and the time consumption of the sub-process of the process, it is possible to more accurately determine the elapsed time of the startup item during the system startup process.
  • the startup item takes longer than the preset threshold, the startup item is disabled, that is, the startup item does not run with the system startup during system startup.
  • the embodiment of the present invention provides another method for acquiring a startup item that takes time, and the method can be executed by a computer processor. As shown in FIG. 2, the method includes steps 201 to 203.
  • step 201 the first process and the second process are determined, the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
  • the computer processor can monitor each process, obtain a parent-child relationship between the processes, and determine a second process of the first process according to the parent-child relationship between the processes. process.
  • a process can have one or more child processes or no child processes.
  • the child process if the child process further has a child process, it is collectively referred to as a second process.
  • step 202 the first process is time-consuming and the second process is time-consuming.
  • the time consumption of the first process is calculated as an example. Due to the I/O of the first process
  • the I/O time consumption of the first process is also included in the time consuming of the first process.
  • the time consumption of the first process is the first process
  • the CPU consumes time and the I/O of the first process.
  • the I/O time consumption of the first process can be calculated by the following formula:
  • the first process I/O can also be registered by the kernel mode program ETW (Event Tracing for Windows, ETW provides a tracking record mechanism for event objects created by user layer applications and kernel layer drivers) The method of the event is obtained.
  • ETW Event Tracing for Windows, ETW provides a tracking record mechanism for event objects created by user layer applications and kernel layer drivers
  • the second process time-consuming acquisition method is the same as the first process time-consuming acquisition method, and will not be described herein.
  • step 203 the sum of the time consumption of the first process and the time consumption of the second process is taken as the start item.
  • the second process is a child process of the first process, and it can be understood that the second process is created by the first process.
  • QQ.exe is created by QQProtect.exe
  • QQExtemal.exe is created by QQ.exe
  • QQ.exe and QQExternal.exe are the second process. If the time spent by QQProtect.exe, QQ.exe, and QQExtemal.exe is Tl, ⁇ 2, ⁇ 3, the startup time corresponding to Bay's QQProtect.exe is Tl+T2+T3.
  • the time consumption of the startup item includes the time consumption of the corresponding process and the time consumption of the sub-process of the process, and the startup item can be more accurately determined during the system startup process. Time-consuming in the middle.
  • the embodiment of the present invention provides another method for acquiring time-consuming acquisition items. As shown in FIG. 3, the method includes steps 301 to 307.
  • step 301 the operating system is started, and each startup item is monitored.
  • the monitoring execution entity In the prior art, it is necessary to run the monitoring execution entity before the startup item is started, and the monitoring execution entity itself may consume the system resources very high. Therefore, the operation of the monitoring execution body itself may affect the system startup.
  • the monitoring execution body may be run during startup of the startup item, and the monitoring execution body may be a computer processor.
  • step 302 when a clock interrupt is reached, information about all current processes in the system is obtained.
  • one clock cycle may be preset, and the monitoring execution entity may periodically monitor the startup items in the system according to the clock cycle.
  • the clock cycle can be set according to the actual situation, which is not limited by the embodiment of the present invention.
  • the process information may include a handle of the process, an ID of the process, and the like.
  • step 303 information about the point in time at which lssass.exe appears and all processes of the current system are obtained and recorded.
  • step 304 the time point at which the user login is completed and the information of all processes of the current system are acquired and recorded.
  • the difference between the time points recorded in step 304 and step 303 can be considered as the waiting time of the user in the process of logging in to the system. Since system resources are not consumed at this stage, the time period needs to be eliminated when calculating the system startup time. That is to say, the time from the power-on of the device to the start of the system startup minus the waiting time of the user during login to the system is the startup time of the system.
  • the difference is negligible. That is, in steps 303 and 304 It is only necessary to perform the acquisition of the information of all the processes in the system. In this embodiment, the information of all the processes in the system obtained in step 304 is taken as the standard, and the subsequent calculation is performed.
  • step 304 through the information of all the processes in the system obtained in step 304, the parent-child relationship between the processes in the system and the I/O throughput of each process can be obtained.
  • step 305 it is determined whether the booting is completed; if the booting is completed within the clock cycle, then step 306 is performed; if the booting is not completed within the clocking cycle, the process returns to step 302.
  • step 306 a startup item time consuming calculation is performed.
  • the time consumption of the startup item S can be calculated according to the following formula:
  • Ts - T P + ⁇ p-childd) ( 2 ) indicates the time taken by the start item S
  • 7> indicates the time consuming of the process
  • 7— ⁇ (,) indicates the time consuming of the i-th child process of the process ⁇ .
  • the I/O time of the process can be obtained.
  • the time from the power-on of the device to the completion of the system startup minus the waiting time of the user during the login process that is, the startup time r fl / / of the system, the CPU consumption of each process ⁇ ⁇ appetizer and
  • the throughput GW can be obtained according to the information of all processes in the system recorded in step 304; the system idle time T free can be obtained from the process named System idle Process in the system task manager.
  • the CPU time of each process ⁇ ⁇ admir and the system idle time T / FT are in the number of cores of the computer CPU of the obtained value.
  • the time-consuming calculation of all the child processes of the process P can be performed as described above. It should be noted that the time-consuming calculation of the sub-process may be performed first, or the time-consuming calculation of each process may be performed at the same time, which is not limited by the embodiment of the present invention.
  • step 307 it is determined whether the startup item takes longer than a preset threshold, and when the startup item takes longer than a preset threshold, the startup item is disabled.
  • the time consumption of each startup item in the system startup process can be accurately calculated, and the user can decide which startup items are disabled according to the time consumption of each startup item acquired, so that they are not operated during the startup phase, thereby improving the user.
  • the embodiment of the present invention further provides a startup time-consuming acquisition device. As shown in FIG. 4, the device includes: an acquisition unit 401, a calculation unit 402, and a control unit 403.
  • the obtaining unit 401 is configured to acquire the time-consuming process of the first process and the time-consuming process of the second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
  • the control unit 403 is configured to disable the startup item when the startup item takes longer than the preset threshold.
  • the embodiment of the present invention further provides another startup time-consuming acquisition device, which is compared with the corresponding embodiment of FIG. 4, wherein the device further includes a determining unit 404, as shown in FIG. 5.
  • the determining unit 404 is configured to determine a first process and a second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
  • the computer processor can monitor each process, obtain a parent-child relationship between the processes, and determine a second process of the first process according to the parent-child relationship between the processes. process.
  • a process can have one or more child processes or no child processes.
  • the child process if the child process further has a child process, it is collectively referred to as a second process.
  • the calculating unit 402 may include a CPU time consuming calculation subunit 4021 and an I/O time consuming calculation subunit 4022, as shown in FIG. 6.
  • the CPU time-consuming calculation sub-unit 4021 is configured to calculate a CPU time consumption of the first process and a CPU time consumption of the second process.
  • the I/O time consumption calculation sub-unit 4022 is configured to calculate an I/O time consumption of the first process and an I/O consumption time of the second process.
  • the process corresponding to the startup item ends, the process still consumes system resources and affects system startup.
  • the process by calculating the elapsed time of the process corresponding to the startup item and the time consumption of the sub-process of the process, it is possible to more accurately determine the elapsed time of the startup item during the system startup process.
  • the I/O time consumption of the process is taken into consideration during the calculation process, thereby further improving the accuracy of the startup item.
  • the inventor found that, because a process is finished in the booting phase, it does not mean that the process stops running. In the process of loading other processes, the process is still running subsequent logic. , still consume system resources, and even pull up other processes, which will affect the system boot. It is considered that the improvement process is completed in the booting phase when the loading is completed by only one process.
  • This view of a process itself is loaded in isolation to evaluate the impact on the operation of the entire system, and the obtained process is opened. The machine will be less time consuming. Therefore, the foregoing solution cannot accurately measure the time consuming process.
  • a method for acquiring a startup item in a time-consuming manner is provided. As shown in FIG. 7, the method includes:
  • the 701 Obtain a parent-child relationship between the processes in the monitoring period, and determine the first process and the second process; the first process is a process corresponding to the startup item to be calculated, and the second process is based on the foregoing process items.
  • the child process of the first process described above determined by the parent-child relationship;
  • sub-process of a process may be empty or one or more.
  • the sub-process may also have a sub-process, which is collectively referred to as a second process. The number of specific sub-processes is not described in the embodiment of the present invention.
  • the calculation process takes time, and the calculation process takes time: calculating the time consumption of the first process and the time consumption of the second process;
  • steps 701 and 702 do not have a logical sequence.
  • 701 is performed to obtain the parent-child relationship of each process, and then execution 702 obtains the time-consuming of the first process and the time-consuming process of the second process. It is also possible to execute 702 to obtain the time consumption of all processes, and then execute 701 to obtain the parent-child relationship between the processes.
  • the inventor also finds that: the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup. Therefore, I/O time should also be part of the time-consuming process.
  • the calculation process time-consuming includes: calculating the CPU time consumption of the process and the input/output time consumption of the process, and taking the sum of the CPU time consumption of the process and the input/output time of the process as the process consumption. Time.
  • the embodiment of the present invention also provides a specific how to calculate the input/output time consumption of the process, as follows:
  • the above monitoring time period is the time period of the boot time
  • the input/output time consumption of the above calculation process includes: calculation The difference between the system boot time and the total CPU time of all processes and the system idle time, calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input of all processes/
  • the quotient of the output throughput is calculated by calculating the product of the difference and the above quotient as the input/output time of the above process.
  • the method of obtaining the time I/O of the process can also register the event of the ETW (Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver) through the kernel mode program. , capture the I/O time of each process, so you can also fine Determine the I/O time.
  • ETW Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver
  • the process may have a waiting situation, the situation is not a resource consumed in the system startup process, and therefore may be excluded, further improving the accuracy of the process time-consuming calculation, as follows: the above system startup time for calculation And the system idle time does not include the CPU time spent in the process waiting process, and the input/output throughput of all processes does not include the input/output time spent in the waiting process.
  • the ratio of the above-mentioned set input/output time to the total time may be a face value, which is set in advance, and can be directly used when calculating, as follows: The value of the above-mentioned set input/output time as a percentage of the total time The domain is (0, 1.0).
  • the inventor also finds in the process of implementing the embodiments of the present invention:
  • the monitoring execution entity since the monitoring execution entity needs to run before the monitored process, the monitoring execution entity itself may consume system resources. Therefore, the timing of the implementation of the program is too high.
  • the embodiment of the present invention further provides the following solutions: Preferably, at least one of the parent-child relationship between the processes in the monitoring period, the CPU consumption of the process, and the input/output throughput of the process is included in the foregoing monitoring period. :
  • the process of performing monitoring by the scheme of the embodiment can be performed without having to run before the monitored process, so that the requirement for execution timing can be reduced.
  • the time consuming of the first process and the time consuming of the second process are taken as the time of the startup item to be calculated.
  • the child process is created by the parent process (that is, the second process is created by the first process), one parent process may have multiple child processes, and the child process may have its own child process, in the foregoing embodiment.
  • the child process of the parent process and the child process of the child process are collectively referred to as the second process.
  • QQ.exe is created by QQProtect.exe
  • QQExternal.exe is by QQ.exe Created, if QQProtect.exe, QQ.exe, QQExternal.exe three processes themselves are time-consuming Tl, ⁇ 2, ⁇ 3 then:
  • the time spent on QQExternal.exe is ⁇ 3, the time consumption of QQ.exe is T2+T3, and the time consumption of QQProtect.exe is Tl+T2+T3.
  • the operation of the startup process can accurately obtain the time consumption of the startup item in the system during the startup phase. If the information is displayed to the user, the user can disable the startup items to prevent them from running during the startup phase, thereby increasing the startup time of the user system and thereby increasing the operating speed of the entire system.
  • indicating that the startup item takes time
  • indicating that the process is time consuming that is, the time taken by the process corresponding to the startup item
  • indicating that the child process takes time indicates that the process CPU is time consuming.
  • CNT i'() process I/O throughput which indicates the system boot time
  • c indicates the ratio of the set ⁇ / ⁇ time to the running time, and the CPU idle time in the T system.
  • 801 Determine whether the clock is interrupted. If yes, enter 802, otherwise enter 801;
  • a time interval t for controlling the interrupt needs to be preset. After the monitoring software is started, an interrupt is executed every other time interval t, t can be any time interval, and the experience value can be set to 1 second.
  • 803 Determine whether there is a new process (that is, a process that is not recorded in the memory by the monitoring software) is created; if yes, enter 804, if not, enter 808;
  • the handle of the newly created process (Handle), the process ID (IDentity, identifier) and the like are stored in the memory, and the process ID may be a PID (Process ID, process ID number);
  • the saved information may include: PID, CPU usage, I/O read/write, etc.
  • the saved location may be a memory or a file, which is not limited in this embodiment.
  • the calculation method is as follows.
  • the two processes of 805 to 806 and 807 to 806 save two times of information in the two processes, thereby obtaining the change of CPU time and I/O throughput between the two times.
  • the difference between the two can be used to obtain the difference, which is the user's consumption in the login waiting interface (CPU time and I/O throughput consumption), which is not counted in the process's consumption during the boot process.
  • Process I/O time (system boot time - total CPU time of all processes - system idle time) ⁇ set I/O time to total time ratio X process I/O throughput I I/O throughput for all processes; where C is a face value with a range of (0, 1.0).
  • Process time consumption CPU time consumed during process running + Process running process I/O time consumed.
  • All the child processes of the process can be obtained through the handle information and the API of the corresponding system.
  • the time-consuming time of the child process can be obtained by referring to the time-consuming calculation method of the process in the foregoing solution. In this way, we get the time of a startup item in the boot phase through equation (6), assuming that there are i child processes.
  • An embodiment of the present invention further provides a device for acquiring time-consuming time, as shown in FIG. 9, which includes:
  • the relationship obtaining unit 901 is configured to acquire a parent-child relationship between processes in the monitoring time period; it can be understood that the child process of one process may be empty or one or more, and the specific number of the child processes is the present invention.
  • the embodiment is not limited. This embodiment will give an example of how the parent-child relationship between processes is obtained in the following description.
  • the process determining unit 902 is configured to determine the first process and the second process.
  • the first process is a process corresponding to the startup item to be calculated, and the second process is a parent and child between the process items acquired by the relationship acquiring unit 901. The child process of the first process described above determined by the relationship;
  • the time-consuming calculation unit 903 is configured to calculate a time-consuming process, where the calculating process time-consuming includes: calculating a time consumption of the first process and a time consumption of the second process; and consuming the time of the first process and the consumption of the second process The sum of time is taken as the time of the startup item to be calculated.
  • the inventor also finds that: the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup. Cause Therefore, the I/O time should also be part of the time-consuming process.
  • the time-consuming computing unit 303 is specifically used for calculating the CPU time consumption of the process and the input/output time consumption of the process, and the sum of the CPU time consumption of the process and the input/output time of the process. Time-consuming as a process.
  • the embodiment of the present invention further provides a scheme for calculating the input/output time consumption of the process, as follows:
  • the foregoing monitoring time period is a time period of the booting time; the time consuming calculating unit 303 is specifically used for the computing system.
  • the difference between the boot time and the total CPU time of all processes and the system idle time calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input/output of all processes.
  • the quotient of the throughput calculates the product of the above difference and the above quotient as the input/output time of the above process.
  • the time-consuming computing unit 903 specifically used for calculating the system boot time and the system idle time, does not include The CPU waits while the process is waiting.
  • the input/output throughput of all processes does not include the input/output time spent in the wait process.
  • the ratio of the above-mentioned set input/output time to the total time may be an empirical value, which is set in advance, and may be directly used in the calculation, as follows:
  • the above-mentioned time-consuming calculation unit 903 is specifically used for calculating the above-mentioned settings.
  • the range of the ratio of the specified input/output time to the total time is (0, 1.0).
  • the foregoing apparatus further includes:
  • the information obtaining unit 1001 is configured to acquire at least one of a parent-child relationship between processes in the monitoring period, a CPU consumption of the process, and an input/output throughput of the process, and the obtaining manner is: The way to get all the current processes, and save the handle information of the new process compared with the previous interrupt; read the application programming interface corresponding to the above handle information.
  • the process of performing monitoring by the scheme of the embodiment can be performed without having to run before the monitored process, so that the requirement for execution timing can be reduced.
  • the embodiment of the invention further provides a terminal, which may be a mobile phone, a computer, a tablet computer, a personal digital assistant (PDA), a point of sale (POS), an in-vehicle terminal, and the like.
  • the terminal may include: A radio frequency (RF) circuit 510, a memory 520, an input unit 530, a display unit 540, a sensor 550, an audio circuit 560, a communication module 570, a processor 580, and a power supply 590.
  • the terminal may be a mobile phone, a computer, a tablet, a Personal Digital Assistant (PDA), a Point of Sales (POS), an in-vehicle terminal, or the like.
  • PDA Personal Digital Assistant
  • POS Point of Sales
  • the RF circuit 510 can be used for receiving and transmitting signals during and after receiving or transmitting information, in particular, after receiving downlink information of the base station, and processing it to the processor 580; in addition, transmitting the designed uplink data to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • the RF circuit 50 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), and code division multiple access ( Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), etc.
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • E-mail Short Messaging Service
  • the memory 520 can be used to store software programs and modules, and the processor 580 executes various functional applications and data processing of the terminals by running software programs and modules stored in the memory 520.
  • the memory 520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile phone (such as audio data, phone book, etc.).
  • memory 520 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state memory device.
  • the input unit 530 can be configured to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the terminal 500.
  • the input unit 530 can include a touch panel 531 and other input devices 532.
  • the touch panel 531 also referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger, a stylus, or the like on the touch panel 531 or near the touch panel 531. Operation), and according to a preset program Drive the corresponding connecting device.
  • the touch panel 531 can include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information
  • the processor 580 is provided and can receive commands from the processor 580 and execute them.
  • the touch panel 531 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 530 may also include other input devices 532.
  • other input devices 532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 540 can be used to display information input by the user or information provided to the user as well as various menus of the terminal.
  • the display unit 540 can include a display panel 541.
  • the display panel 541 can be configured in the form of a Liquid Crystal Display (LCD) Organic Light-Emitting Diode (OLED).
  • the touch panel 531 can cover the display panel 541. When the touch panel 531 detects a touch operation on or near it, the touch panel 531 transmits to the processor 580 to determine the type of the touch event, and then the processor 580 according to the touch event. The type provides a corresponding visual output on display panel 541.
  • the touch panel 531 and the display panel 541 are used as two independent components to implement input and input functions of the terminal, in some embodiments, the touch panel 531 may be integrated with the display panel 541. Realize the input and output functions of the terminal.
  • Terminal 500 can also include at least one type of sensor 550, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 541 according to the brightness of the ambient light, and the proximity sensor may close the display panel 541 and/or when the terminal moves to the ear. Or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity.
  • attitude of the terminal such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the terminal are no longer used here. Praise.
  • Audio circuit 560, speaker 561, and microphone 562 can provide an audio interface between the user and the terminal.
  • the audio circuit 560 can transmit the converted electrical data of the received audio data to the speaker 561.
  • the speaker 561 converts the sound signal into an audio signal.
  • the microphone 562 converts the collected sound signal into an electrical signal, which is received by the audio circuit 560 and converted into audio data, and then processed by the audio data output processor 580, and then passed through the RF circuit.
  • 510 is sent to, for example, another terminal, or audio data is output to memory 520 for further processing.
  • the terminal can help the user to send and receive emails, browse web pages, access streaming media, etc. through the communication module 570, which provides users with wireless broadband Internet access.
  • FIG. 5 shows the communication module 570, it will be understood that it does not belong to the essential configuration of the terminal 500, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 580 is the control center of the terminal, and connects various parts of the entire terminal using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 520, and calling data stored in the memory 520, executing The terminal's various functions and processing data, so as to monitor the terminal as a whole.
  • the processor 580 may include one or more processing units.
  • the processor 580 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like.
  • the modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into processor 580.
  • the terminal 500 also includes a power source 590 (such as a battery) for powering various components.
  • a power source 590 such as a battery
  • the power source can be logically coupled to the processor 580 through a power management system to perform functions such as managing charging, discharging, and power management through the power management system.
  • the terminal 500 may further include a camera, a microphone, etc., and details are not described herein.
  • the processor 580 included in the terminal may also perform time-consuming acquisition of the startup item.
  • the processor 580 can obtain the time of the startup item by the following steps:
  • the time consuming time of the first process and the second process is time consuming as the startup item.
  • sub-process of a process may be empty or one or more.
  • the sub-process may also have a sub-process, which is collectively referred to as a second process.
  • the number of the specific sub-processes is not limited in the embodiment of the present invention.
  • the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup.
  • the I/O time should also be part of the time-consuming process.
  • the calculation process time-consuming includes: calculating the CPU time consumption of the process and the input/output time consumption of the process, and taking the sum of the CPU time consumption of the process and the input/output time of the process as the process consumption. Time.
  • the embodiment of the present invention also provides a specific how to calculate the input/output time consumption of the process, as follows:
  • the above monitoring time period is the time period of the boot time
  • the input/output time consumption of the above calculation process includes: calculation The difference between the system boot time and the total CPU time of all processes and the system idle time, calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input of all processes/
  • the quotient of the output throughput is calculated by calculating the product of the difference and the above quotient as the input/output time of the above process.
  • the method of obtaining the time I/O of the process can also register the event of the ETW (Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver) through the kernel mode program. , capture the I / O time of each process, which can also accurately determine the I / O time.
  • ETW Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver
  • the process may have a waiting situation, the situation is not a resource consumed in the system startup process, and therefore may be excluded, further improving the accuracy of the process time-consuming calculation, as follows: the above system startup time for calculation And the system idle time does not include the CPU time spent in the process waiting process, and the input/output throughput of all processes does not include the input/output time spent in the waiting process.
  • the ratio of the ratio of the input/output time set to the total time set above is (0, 1.0).
  • the obtaining of at least one of a parent-child relationship between the processes in the monitoring period, a CPU consumption of the process, and an input/output throughput of the process includes:

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A startup item consumed time acquisition method, comprising: acquiring a first process consumed time and a second process consumed time, the first process being a process corresponding to the startup item, and the second process being a sub-process of the first process; using the sum of the first process consumed time and the second process consumed time as the startup item consumed time; disabling the startup item when the startup item consumed time is greater than a preset threshold.

Description

启动项耗时的获取方法和装置  Start-up item time-consuming acquisition method and device
本申请要求于 2013 年 3 月 22 日提交中国专利局、 申请号为 201310096444.5、 发明名称为"一种启动项耗时的测算方法和装置 "的中国专利 申请的优先权, 其全部内容通过引用结合在本申请中。 This application claims priority to Chinese Patent Application No. 201310096444.5, entitled "A Method and Apparatus for Time-consuming Measurement of Startup Items", filed on March 22, 2013, the entire contents of which are incorporated by reference. In this application.
技术领域 本发明涉及电子通信技术领域,特别涉及一种启动项耗时的获取方法和装 置。 TECHNICAL FIELD The present invention relates to the field of electronic communication technologies, and in particular, to a method and an apparatus for acquiring a startup item in a time-consuming manner.
背景技术 启动项是指设备(例如计算机)在开机后非用户操作触发而运行的加载项, 包括但不限于以下几类: 服务项、 开机运行的计划任务、 用户开机启动文件夹 中的文件、注册表中注册了要在开机时运行的键等。本文所称的启动项均对应 有一个进程。 启动项耗时, 也即是该启动项对应的进程耗时。 BACKGROUND A startup item refers to an add-on that a device (such as a computer) runs after being triggered by a non-user operation after being powered on, including but not limited to the following categories: a service item, a scheduled task to be started up, a file in a user startup folder, The keys to be run at boot time are registered in the registry. The startup items referred to in this article all correspond to one process. The startup item takes time, that is, the process corresponding to the startup item takes time.
开机完成是指设备上电以后,操作系统的所有开机加载项都已加载, 系统 CPU ( Central Processing Unit, 中央处理器)、 内存等资源的使用率较稳定, 用 户可以顺畅操作计算机, 此时视计算机已经开机完成。  After the device is powered on, all the bootloaders of the operating system are loaded. The usage of the CPU (Central Processing Unit) and memory is stable. The user can operate the computer smoothly. The computer has been turned on.
操作系统在开机时会加载很多启动项, 而这些启动项会拖慢系统,增加用 户的开机时间。用户仅凭感官,很难确定是哪个启动项让系统的开机和运行变 慢。若能获得各启动项对应的进程在开机阶段的耗时,这样就可以确定让系统 开机变慢的启动项, 并有选择地将其禁用或删除, 实现提高开机速度的效果。  The operating system loads a lot of startup items when it is powered on, and these startup items slow down the system and increase the user's boot time. Users only rely on the senses, it is difficult to determine which startup item makes the system boot and run slower. If the time of the process corresponding to each startup item is obtained in the booting phase, it is possible to determine the startup item that makes the system boot slower, and selectively disable or delete it to achieve the effect of increasing the booting speed.
发明内容 本发明实施例提供一种启动项耗时获取方法, 包括: SUMMARY OF THE INVENTION Embodiments of the present invention provide a method for acquiring a startup item in a time-consuming manner, including:
获取第一进程耗时和第二进程耗时,所述第一进程为所述启动项对应的进 程, 所述第二进程为所述第一进程的子进程; Obtaining the first process time-consuming and the second process time-consuming, the first process is corresponding to the startup item The second process is a child process of the first process;
将所述第一进程耗时与所述第二进程耗时的和作为所述启动项耗时;以及 当所述启动项耗时大于预设阔值时, 禁用所述启动项耗时。  The time-consuming sum of the first process and the second process is time-consuming as the startup item; and when the startup item is time-consuming greater than a preset threshold, the startup item is disabled.
本发明实施例还提供一种启动项耗时获取装置, 包括:  The embodiment of the invention further provides a device for acquiring time-consuming time, which comprises:
获取单元, 用于获取第一进程耗时和第二进程耗时, 所述第一进程为所述 启动项对应的进程, 所述第二进程为所述第一进程的子进程;  An obtaining unit, configured to acquire a time-consuming process of the first process and a time-consuming process of the second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
计算单元, 用于计算所述第一进程耗时与所述第二进程耗时的和, 并将该 和作为所述启动项耗时; 以及  a calculating unit, configured to calculate a time consuming time of the first process and the second process, and use the sum as the startup item; and
控制单元, 当所述启动项耗时大于预设阈值时, 禁用所述启动项。  And the control unit is configured to disable the startup item when the startup item takes longer than a preset threshold.
本发明实施例提供一种非瞬时性存储介质, 其上存储有计算机可执行指 令, 当计算机中运行这些可执行指令时, 执行如下步骤:  Embodiments of the present invention provide a non-transitory storage medium on which computer executable instructions are stored. When the executable instructions are run in a computer, the following steps are performed:
获取第一进程耗时和第二进程耗时 , 所述第一进程为启动项对应的进程 , 所述第二进程为所述第一进程的子进程;  Obtaining the first process time-consuming and the second process time-consuming, the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
将所述第一进程耗时与所述第二进程耗时的和作为所述启动项耗时;以及 当所述启动项耗时大于预设阈值时, 禁用所述启动项。 附图说明 图 1为本发明实施例所提供的一种启动项耗时获取方法的流程示意图; 图 2为本发明实施例所提供的另一种启动项耗时获取方法的流程示意图; 图 3为本发明实施例所提供的另一种启动项耗时获取方法的流程示意图; 图 4为本发明实施例所提供的一种启动项耗时获取装置的结构示意图; 图 5为本发明实施例所提供的另一种启动项耗时获取装置的结构示意图; 图 6为本发明实施例所提供的另一种启动项耗时获取装置的结构示意图; 图 7为发明实施例所所提供的另一种启动项耗时获取方法的流程示意图; 图 8为本发明实施例所提供的另一种启动项耗时获取方法的流程示意图; 图 9为本发明实施例所提供的另一种启动项耗时获取装置的结构示意图; 图 10 为本发明实施例所提供的另一种启动项耗时获取装置的结构示意 图; 以及  The time-consuming sum of the first process and the second process is time-consuming as the startup item; and when the startup item is time-consuming greater than a preset threshold, the startup item is disabled. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a schematic flowchart of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention; FIG. 2 is a schematic flowchart of another method for acquiring a time-consuming acquisition item according to an embodiment of the present invention; FIG. 4 is a schematic structural diagram of a method for acquiring a time-consuming acquisition item according to an embodiment of the present invention; FIG. 4 is a schematic structural diagram of a device for acquiring a time-consuming acquisition item according to an embodiment of the present invention; FIG. 6 is a schematic structural diagram of another time-consuming acquisition device for a startup item according to an embodiment of the present invention; FIG. 7 is another schematic diagram of an apparatus for time-consuming acquisition of an activation item according to an embodiment of the present invention; A schematic flowchart of a method for acquiring a time-consuming acquisition of a startup item; FIG. 8 is a schematic flowchart of another method for acquiring a time-consuming acquisition item according to an embodiment of the present invention; FIG. 9 is another startup item according to an embodiment of the present invention. FIG. 10 is a schematic structural diagram of another time-consuming acquisition device for a startup item according to an embodiment of the present invention;
图 11为本发明实施例所提供的一种终端的结构示意图。 具体实施方式 为了使本发明的目的、技术方案和优点更加清楚, 下面将结合附图对本发 明作进一步地详细描述, 显然, 所描述的实施例仅仅是本发明一部份实施例, 而不是全部的实施例。基于本发明中的实施例, 本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其它实施例, 都属于本发明保护的范围。 FIG. 11 is a schematic structural diagram of a terminal according to an embodiment of the present invention. The present invention will be further described in detail with reference to the accompanying drawings, in which FIG. An embodiment. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
本发明实施例提供一种启动项耗时的获取方法,如图 1所示,该方法包括 步骤 101至步骤 103。  An embodiment of the present invention provides a method for acquiring a startup item in a time-consuming manner. As shown in FIG. 1, the method includes steps 101 to 103.
在步骤 101中: 获取第一进程耗时和第二进程耗时, 第一进程为该启动项 对应的进程, 第二进程为该第一进程的子进程;  In step 101: acquiring the first process time-consuming and the second process time-consuming, the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
在步骤 102中:将该第一进程耗时与该第二进程耗时的和作为该启动项耗 时。  In step 102, the time consuming of the first process and the time consuming by the second process is taken as the start item.
在步骤 103中: 当该启动项耗时大于预设阈值时, 禁用该启动项。  In step 103: when the startup item takes longer than the preset threshold, the startup item is disabled.
在系统启动过程中, 启动项所对应的进程加载结束时,该进程仍会消耗系 统资源, 并对系统启动产生影响。 在本发明实施例中, 通过计算启动项所对应 进程耗时以及该进程的子进程耗时,能够更准确地确定该启动项在系统启动过 程中的耗时。 当该启动项耗时大于预设阈值时, 禁用该启动项, 即, 在系统启 动过程中, 该启动项不会随着系统的启动而运行。  During the system startup process, when the process corresponding to the startup item ends, the process still consumes system resources and affects system startup. In the embodiment of the present invention, by calculating the elapsed time of the process corresponding to the startup item and the time consumption of the sub-process of the process, it is possible to more accurately determine the elapsed time of the startup item during the system startup process. When the startup item takes longer than the preset threshold, the startup item is disabled, that is, the startup item does not run with the system startup during system startup.
本发明实施例提供另一种启动项耗时的获取方法,该方法可由计算机处理 器执行。 如图 2所示, 该方法包括步骤 201至步骤 203。  The embodiment of the present invention provides another method for acquiring a startup item that takes time, and the method can be executed by a computer processor. As shown in FIG. 2, the method includes steps 201 to 203.
在步骤 201中,确定第一进程和第二进程, 所述第一进程为所述启动项对 应的进程, 所述第二进程为所述第一进程的子进程。  In step 201, the first process and the second process are determined, the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
在本发明实施例中,在系统启动过程中,计算机处理器可对各进程进行监 控,获取各进程之间的父子关系, 并根据各进程之间的父子关系确定第一进程 的子进程第二进程。 一个进程可以具有一个或多个子进程,也可以不具有子进 程。 另外,在本发明实施例中,如果子进程还具有子进程,则统称为第二进程。  In the embodiment of the present invention, during the system startup process, the computer processor can monitor each process, obtain a parent-child relationship between the processes, and determine a second process of the first process according to the parent-child relationship between the processes. process. A process can have one or more child processes or no child processes. In addition, in the embodiment of the present invention, if the child process further has a child process, it is collectively referred to as a second process.
在步骤 202中, 获取所述第一进程耗时和所述第二进程耗时。  In step 202, the first process is time-consuming and the second process is time-consuming.
在本步骤中,以计算所述第一进程耗时为例进行说明。由于第一进程的 I/O In this step, the time consumption of the first process is calculated as an example. Due to the I/O of the first process
( Input/Output )会对系统启动构成影响, 因此, 第一进程的 I/O耗时也包括在 该第一进程的耗时之中。在本发明实施例中, 第一进程的耗时为该第一进程的 CPU耗时与该第一进程的 I/O耗时之和。 (Input/Output) will affect the system startup, so the I/O time consumption of the first process is also included in the time consuming of the first process. In the embodiment of the present invention, the time consumption of the first process is the first process The CPU consumes time and the I/O of the first process.
其中, 第一进程的 I/O耗时可以通过以下公式进行计算:  The I/O time consumption of the first process can be calculated by the following formula:
Τ = (Τ -V Γ -T , ) * C* ~ 70 ~ Τ = (Τ -V Γ -T , ) * C* ~ 70 ~
∑CNT  ∑CNT
-1 ( 1 ) - 1 ( 1 )
。表示第一进程的 I/O耗时; Γα„表示系统启动时间; Γφ,φ)表示系统中第 i个进程的 CPU耗时; τ 表示系统 CPU空闲时间; C表示进程 I/O耗时占进 程运行时间的比例, 该值为一个经险值, 值域为 (0, 1.0 ); CNTf。表示该第一 进程的 I/O吞吐量; CA¾W表示系统中第 i个进程的 I/O吞吐量, n 表示系统 中所有进程的个数。 . Indicates the I/O time of the first process; Γ α „ indicates the system startup time; Γ φ , φ) indicates the CPU consumption of the i-th process in the system; τ indicates the system CPU idle time; C indicates the process I/O consumption The ratio of the running time of the process, the value is a risk value, the value range is (0, 1.0); CNT f is the I/O throughput of the first process; CA3⁄4 W is the i-th process of the system. I/O throughput, where n is the number of all processes in the system.
除此之外, 第一进程 I/O耗时还可以通过内核态程序注册 ETW ( Event Tracing for Windows , ETW提供了一种对用户层应用程序和内核层驱动创建的 事件对象的跟踪记录机制)事件的方法进行获取。  In addition, the first process I/O can also be registered by the kernel mode program ETW (Event Tracing for Windows, ETW provides a tracking record mechanism for event objects created by user layer applications and kernel layer drivers) The method of the event is obtained.
第二进程耗时获取方法与第一进程耗时获取方法相同, 在此不作赘述。 在步骤 203中,将所述第一进程耗时与所述第二进程耗时的和作为所述启 动项耗时。  The second process time-consuming acquisition method is the same as the first process time-consuming acquisition method, and will not be described herein. In step 203, the sum of the time consumption of the first process and the time consumption of the second process is taken as the start item.
在本发明实施例中, 第二进程为第一进程的子进程, 且可以理解为, 第二 进程由第一进程创建。例如, QQ.exe是由 QQProtect.exe创建,而 QQExtemal.exe 是由 QQ.exe 创建, 则可认为, QQProtect.exe 为第一进程, 而 QQ.exe 和 QQExternal.exe为第二进程。 如果 QQProtect.exe、 QQ.exe、 QQExtemal.exe三 个进程自身的耗时分别是 Tl、 Τ2、 Τ3 , 贝' j QQProtect.exe所对应的启动项耗 时为 Tl+T2+T3。  In the embodiment of the present invention, the second process is a child process of the first process, and it can be understood that the second process is created by the first process. For example, QQ.exe is created by QQProtect.exe, and QQExtemal.exe is created by QQ.exe, then QQProtect.exe can be considered as the first process, and QQ.exe and QQExternal.exe are the second process. If the time spent by QQProtect.exe, QQ.exe, and QQExtemal.exe is Tl, Τ2, Τ3, the startup time corresponding to Bay's QQProtect.exe is Tl+T2+T3.
在本发明实施例所提供的启动项耗时的获取方法中,启动项耗时包括其所 对应进程的耗时以及该进程的子进程耗时,能够更准确地确定该启动项在系统 启动过程中的耗时。  In the acquisition method of the startup item time-consuming provided by the embodiment of the present invention, the time consumption of the startup item includes the time consumption of the corresponding process and the time consumption of the sub-process of the process, and the startup item can be more accurately determined during the system startup process. Time-consuming in the middle.
本发明实施例提供另一种启动项耗时获取方法,如图 3所示, 该方法包括 步骤 301至步骤 307。  The embodiment of the present invention provides another method for acquiring time-consuming acquisition items. As shown in FIG. 3, the method includes steps 301 to 307.
在步骤 301中, 启动操作系统, 并对各启动项进行监控。 在现有技术中, 需要在启动项启动之前运行监控执行主体, 而监控执行主 体自身对系统资源的消耗可能就很高, 因此,监控执行主体本身的运行就会对 系统启动产生影响。在本实施例中, 可以在启动项启动的过程中运行监控执行 主体, 该监控执行主体可以是计算机处理器。 In step 301, the operating system is started, and each startup item is monitored. In the prior art, it is necessary to run the monitoring execution entity before the startup item is started, and the monitoring execution entity itself may consume the system resources very high. Therefore, the operation of the monitoring execution body itself may affect the system startup. In this embodiment, the monitoring execution body may be run during startup of the startup item, and the monitoring execution body may be a computer processor.
在步骤 302中,当达到一个时钟中断时,获取系统中当前所有进程的信息。 在本步骤中,可以预先设定一个时钟周期,监控执行主体可以根据该时钟 周期对系统中的启动项进行周期性监控。 该时钟周期可根据实际情况进行设 置, 本发明实施例对此不做限制。  In step 302, when a clock interrupt is reached, information about all current processes in the system is obtained. In this step, one clock cycle may be preset, and the monitoring execution entity may periodically monitor the startup items in the system according to the clock cycle. The clock cycle can be set according to the actual situation, which is not limited by the embodiment of the present invention.
当需要说明的是,如果本次时钟中断是首次时钟中断, 则记录获取的系统 中所有进程的信息, 并保存至内存中; 如果本次时钟中断不是首次时钟中断, 则将新创建的进程的信息进行保存即可。在本实施例中,进程信息可以包括进 程的句柄( Handle )、 进程的 ID等。  When it is necessary to note that if the current clock interrupt is the first clock interrupt, the information of all processes in the acquired system is recorded and saved to the memory; if the current clock interrupt is not the first clock interrupt, the newly created process will be The information can be saved. In this embodiment, the process information may include a handle of the process, an ID of the process, and the like.
在步骤 303中, 获取并记录出现 lssass.exe的时间点以及当前系统的所有 进程的信息。  In step 303, information about the point in time at which lssass.exe appears and all processes of the current system are obtained and recorded.
在步骤 304中,获取并记录用户登录完成的时间点以及当前系统的所有进 程的信息。  In step 304, the time point at which the user login is completed and the information of all processes of the current system are acquired and recorded.
在本实施例中,步骤 304和步骤 303中所记录时间点的差值可认为是用户 在登录系统过程中的等待时间。 由于在该阶段时, 系统资源并没有被消耗, 因 此在计算系统启动时间时, 需要将该时间段剔除。 也就是说, 从设备上电到系 统启动完成所需时间减去用户在登录系统过程中的等待时间 ,即为系统的启动 时间 Γ。„。 另外, 需要说明的是, 由于步骤 303和 304中所获取系统中所有进 程的信息差异微小, 因此, 在本实施例中, 该差异可忽略不计。 也就是说, 步 骤 303和步骤 304中只需执行一次对系统中所有进程的信息的获取即可。在本 实施例中, 以步骤 304中所获取系统中所有进程的信息为准, 进行后续计算。  In this embodiment, the difference between the time points recorded in step 304 and step 303 can be considered as the waiting time of the user in the process of logging in to the system. Since system resources are not consumed at this stage, the time period needs to be eliminated when calculating the system startup time. That is to say, the time from the power-on of the device to the start of the system startup minus the waiting time of the user during login to the system is the startup time of the system. In addition, it should be noted that, since the information difference of all the processes in the system acquired in steps 303 and 304 is small, in the present embodiment, the difference is negligible. That is, in steps 303 and 304 It is only necessary to perform the acquisition of the information of all the processes in the system. In this embodiment, the information of all the processes in the system obtained in step 304 is taken as the standard, and the subsequent calculation is performed.
另外, 通过步骤 304中所获取的系统中所有进程的信息, 可以获取系统中 各个进程之间的父子关系以及各个进程的 I/O吞吐量。  In addition, through the information of all the processes in the system obtained in step 304, the parent-child relationship between the processes in the system and the I/O throughput of each process can be obtained.
在步骤 305中, 判断开机是否完成; 如果在该时钟周期内, 开机完成, 则 执行步骤 306; 如果在该时钟周期内, 开机未完成, 返回执行步骤 302。  In step 305, it is determined whether the booting is completed; if the booting is completed within the clock cycle, then step 306 is performed; if the booting is not completed within the clocking cycle, the process returns to step 302.
在步骤 306中, 执行启动项耗时计算。 在本实施例中, 假设进程 P为启动项 S所对应的进程, 而该进程 P具有 m个子进程, 则该启动项 S的耗时可根据下列公式进行计算: In step 306, a startup item time consuming calculation is performed. In this embodiment, assuming that the process P is the process corresponding to the startup item S, and the process P has m sub-processes, the time consumption of the startup item S can be calculated according to the following formula:
m  m
Ts - TP + ^p-childd) ( 2 ) 表示启动项 S的耗时, 7>表示进程 Ρ的耗时, 7— ^(,)表示进程 Ρ的第 i 个子进程的耗时。 Ts - T P + ^p-childd) ( 2 ) indicates the time taken by the start item S, 7> indicates the time consuming of the process ,, and 7—^(,) indicates the time consuming of the i-th child process of the process Ρ.
由于每个进程耗时需要考虑该进程 I/O耗时,进程 P的耗时可采用以下公 式计算:  Since each process takes time to consider the I/O time of the process, the time spent by process P can be calculated using the following formula:
P 1 cpu ^ 1 I/O ( 3 ) P 1 cpu ^ 1 I/O ( 3 )
7„表示进程 P的 CPU耗时, ^。表示进程 Ρ的 I/O耗时。 同理, 进程 Ρ 的子进程耗时采用相同方法进行计算。 7 „ indicates that the CPU of process P is time-consuming, ^. indicates the I/O time of the process. Similarly, the process of the process Ρ is calculated in the same way.
根据公式(1 )可获取进程 Ρ的 I/O耗时。 其中, 如上所述, 从设备上电 到系统启动完成所需时间减去用户在登录系统过程中的等待时间,即为系统的 启动时间 rfl//, 各个进程的 CPU耗时 Γφ„以及吞吐量 GW;。可根据步骤 304中所 记录的系统中所有进程的信息获取; 系统空闲时间 Tfree可从系统任务管理器中 名称为 System idle Process的进程中获取。 According to formula (1), the I/O time of the process can be obtained. Wherein, as described above, the time from the power-on of the device to the completion of the system startup minus the waiting time of the user during the login process, that is, the startup time r fl / / of the system, the CPU consumption of each process Γ φ „ and The throughput GW can be obtained according to the information of all processes in the system recorded in step 304; the system idle time T free can be obtained from the process named System idle Process in the system task manager.
另外, 当该计算机为多核计算机时, 每个进程的 CUP耗时 Γφ„以及系统空 闲时间 T/FT要在所获得的数值上处于该计算机 CPU的核数。 In addition, when the computer is a multi-core computer, the CPU time of each process Γ φ „ and the system idle time T / FT are in the number of cores of the computer CPU of the obtained value.
完成进程 P的耗时计算之后,可进行进程 P的所有子进程的耗时计算,方 法如上所述。 需要说明的是, 也可首先进行子进程的耗时计算, 或者对各个进 程耗时同时进行计算, 本发明实施例对此不做限制。  After the time-consuming calculation of the process P is completed, the time-consuming calculation of all the child processes of the process P can be performed as described above. It should be noted that the time-consuming calculation of the sub-process may be performed first, or the time-consuming calculation of each process may be performed at the same time, which is not limited by the embodiment of the present invention.
在步骤 307中, 判断该启动项耗时是否大于预设阈值, 当该启动项耗时大 于预设阔值时, 禁用该启动项。  In step 307, it is determined whether the startup item takes longer than a preset threshold, and when the startup item takes longer than a preset threshold, the startup item is disabled.
通过本发明实施例的方案, 可以精确计算系统启动过程中各启动项耗时, 用户可根据所获取的各个启动项耗时, 决定将哪些启动项禁用, 让其不在开机 阶段运行, 从而提高用户系统的开机时间和整个系统的运行速度。 本发明实施例还提供了一种启动项耗时获取设备, 如图 4所示, 该设备包 括: 获取单元 401、 计算单元 402和控制单元 403。 获取单元 401用于获取第一进程耗时和第二进程耗时,所述第一进程为所 述启动项对应的进程, 所述第二进程为所述第一进程的子进程。 Through the solution of the embodiment of the present invention, the time consumption of each startup item in the system startup process can be accurately calculated, and the user can decide which startup items are disabled according to the time consumption of each startup item acquired, so that they are not operated during the startup phase, thereby improving the user. The system's boot time and the speed of the entire system. The embodiment of the present invention further provides a startup time-consuming acquisition device. As shown in FIG. 4, the device includes: an acquisition unit 401, a calculation unit 402, and a control unit 403. The obtaining unit 401 is configured to acquire the time-consuming process of the first process and the time-consuming process of the second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
计算单元 402用于计算所述第一进程耗时与所述第二进程耗时的和,并将 该和作为所述启动项耗时。  The calculating unit 402 is configured to calculate a sum of the time consumption of the first process and the time consumption of the second process, and consume the sum as the startup item.
控制单元 403用于当启动项耗时大于预设阈值时, 禁用该启动项。  The control unit 403 is configured to disable the startup item when the startup item takes longer than the preset threshold.
本发明实施例还提供了另一种启动项耗时获取设备,与图 4所对应实施例 相比较, 该实施例中所述设备还包括确定单元 404, 如图 5所示。  The embodiment of the present invention further provides another startup time-consuming acquisition device, which is compared with the corresponding embodiment of FIG. 4, wherein the device further includes a determining unit 404, as shown in FIG. 5.
所述确定单元 404用于确定第一进程和第二进程,所述第一进程为所述启 动项对应的进程, 所述第二进程为所述第一进程的子进程。  The determining unit 404 is configured to determine a first process and a second process, where the first process is a process corresponding to the startup item, and the second process is a child process of the first process.
在本发明实施例中,在系统启动过程中, 计算机处理器可对各进程进行监 控,获取各进程之间的父子关系, 并根据各进程之间的父子关系确定第一进程 的子进程第二进程。 一个进程可以具有一个或多个子进程,也可以不具有子进 程。 另外,在本发明实施例中,如果子进程还具有子进程,则统称为第二进程。  In the embodiment of the present invention, during the system startup process, the computer processor can monitor each process, obtain a parent-child relationship between the processes, and determine a second process of the first process according to the parent-child relationship between the processes. process. A process can have one or more child processes or no child processes. In addition, in the embodiment of the present invention, if the child process further has a child process, it is collectively referred to as a second process.
在本发明实施例中,计算单元 402可包括 CPU耗时计算子单元 4021和 I/O 耗时计算子单元 4022, 如图 6所示。  In the embodiment of the present invention, the calculating unit 402 may include a CPU time consuming calculation subunit 4021 and an I/O time consuming calculation subunit 4022, as shown in FIG. 6.
所述 CPU耗时计算子单元 4021用于计算所述第一进程的 CPU耗时和所 述第二进程的 CPU耗时。  The CPU time-consuming calculation sub-unit 4021 is configured to calculate a CPU time consumption of the first process and a CPU time consumption of the second process.
所述 I/O耗时计算子单元 4022用于计算所述第一进程的 I/O耗时和所述 第二进程的 I/O耗时。  The I/O time consumption calculation sub-unit 4022 is configured to calculate an I/O time consumption of the first process and an I/O consumption time of the second process.
在系统启动过程中, 启动项所对应的进程加载结束时,该进程仍会消耗系 统资源, 并对系统启动产生影响。 在本发明实施例中, 通过计算启动项所对应 进程耗时以及该进程的子进程耗时,能够更准确地确定该启动项在系统启动过 程中的耗时。 另外, 根据本发明实施例, 在计算进程耗时, 进程的 I/O耗时被 考虑在内, 从而进一步提高了启动项耗时的精确度。  During the system startup process, when the process corresponding to the startup item ends, the process still consumes system resources and affects system startup. In the embodiment of the present invention, by calculating the elapsed time of the process corresponding to the startup item and the time consumption of the sub-process of the process, it is possible to more accurately determine the elapsed time of the startup item during the system startup process. In addition, according to the embodiment of the present invention, the I/O time consumption of the process is taken into consideration during the calculation process, thereby further improving the accuracy of the startup item.
发明人在实现本发明实施例的过程中发现, 由于在开机阶段, 一个进程加 载结束了, 并不代表该进程就停止运行了, 在其他进程加载的过程中, 该进程 还在运行后续的逻辑, 仍会消耗系统资源, 甚至还会拉起其他进程, 这些都会 影响系统的开机。仅以一个进程完成加载就认为改进程在开机阶段已完成,这 种孤立地看待一个进程自身加载来评估对整个系统运行的影响,得到的进程开 机耗时将会偏少。 因此前述方案不能准确的测算进程耗时。基于此本发明实施 例提供了一种启动项耗时获取方法, 如图 7所示, 包括: During the process of implementing the embodiment of the present invention, the inventor found that, because a process is finished in the booting phase, it does not mean that the process stops running. In the process of loading other processes, the process is still running subsequent logic. , still consume system resources, and even pull up other processes, which will affect the system boot. It is considered that the improvement process is completed in the booting phase when the loading is completed by only one process. This view of a process itself is loaded in isolation to evaluate the impact on the operation of the entire system, and the obtained process is opened. The machine will be less time consuming. Therefore, the foregoing solution cannot accurately measure the time consuming process. Based on this embodiment of the present invention, a method for acquiring a startup item in a time-consuming manner is provided. As shown in FIG. 7, the method includes:
701 : 获取监控时间段内各进程之间的父子关系, 并确定第一进程和第二 进程; 上述第一进程为待计算的启动项对应的进程, 上述第二进程为依据上述 各进程项之间的父子关系确定的上述第一进程的子进程;  701: Obtain a parent-child relationship between the processes in the monitoring period, and determine the first process and the second process; the first process is a process corresponding to the startup item to be calculated, and the second process is based on the foregoing process items. The child process of the first process described above determined by the parent-child relationship;
可以理解的是,一个进程的子进程可以为空,也可以为一个或者一个以上, 子进程还可以有子进程, 统称为第二进程, 具体的子进程个数本发明实施例不 说明。  It can be understood that the sub-process of a process may be empty or one or more. The sub-process may also have a sub-process, which is collectively referred to as a second process. The number of specific sub-processes is not described in the embodiment of the present invention.
702: 计算进程耗时, 上述计算进程耗时包括: 计算上述第一进程的耗时 以及第二进程的耗时;  702: The calculation process takes time, and the calculation process takes time: calculating the time consumption of the first process and the time consumption of the second process;
需要说明的是, 以上步骤 701和 702并不存在逻辑上的先后次序,先执行 701得到各进程的父子关系, 然后执行 702得到第一进程的耗时和第二进程的 耗时, 是可以的; 先执行 702获得所有进程的耗时, 然后再执行 701获得个进 程之间的父子关系, 也是可以的。  It should be noted that the above steps 701 and 702 do not have a logical sequence. First, 701 is performed to obtain the parent-child relationship of each process, and then execution 702 obtains the time-consuming of the first process and the time-consuming process of the second process. It is also possible to execute 702 to obtain the time consumption of all processes, and then execute 701 to obtain the parent-child relationship between the processes.
发明人在实现本发明实施例的过程中,还发现: 进程的 I/O ( Input/Output, 输入 /输出)是进程在启动过程中所占用的资源, 会对进程启动构成影响。 因 此, I/O时间也应属于进程耗时的一部分。 优选采用如下方式: 上述计算进程 耗时包括: 计算进程的中央处理器耗时以及进程的输入 /输出耗时, 将进程的 中央处理器耗时与进程的输入 /输出耗时的和作为进程耗时。  In the process of implementing the embodiments of the present invention, the inventor also finds that: the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup. Therefore, I/O time should also be part of the time-consuming process. Preferably, the following manner is adopted: The calculation process time-consuming includes: calculating the CPU time consumption of the process and the input/output time consumption of the process, and taking the sum of the CPU time consumption of the process and the input/output time of the process as the process consumption. Time.
更具体地, 本发明实施例还给出了具体如何计算进程的输入 /输出耗时的 方案, 如下: 上述监控时间段为开机时间的时间段, 上述计算进程的输入 /输 出耗时包括:计算系统开机时间与所有进程的中央处理器时间总和以及系统空 闲时间的差, 计算设定的输入 /输出时间占系统开机时间的比例与进程的输入 / 输出吞吐量的积再与所有进程的输入 /输出吞吐量的商, 计算上述差与上述商 的积作为上述进程的输入 /输出耗时。  More specifically, the embodiment of the present invention also provides a specific how to calculate the input/output time consumption of the process, as follows: The above monitoring time period is the time period of the boot time, and the input/output time consumption of the above calculation process includes: calculation The difference between the system boot time and the total CPU time of all processes and the system idle time, calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input of all processes/ The quotient of the output throughput is calculated by calculating the product of the difference and the above quotient as the input/output time of the above process.
获取进程 I/O耗时的方法,也可以通过内核态程序注册 ETW( Event Tracing for Windows , ETW提供了一种对用户层应用程序和内核层驱动创建的事件对 象的跟踪记录机制)事件的方法, 捕获每一个进程的 I/O时间, 这样也可以精 确的确定 I/O耗时。 The method of obtaining the time I/O of the process can also register the event of the ETW (Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver) through the kernel mode program. , capture the I/O time of each process, so you can also fine Determine the I/O time.
更具体地, 由于进程可能存在等待的情况, 该情况不属于系统启动过程中 耗费的资源, 因此可以排除在外, 进一步提高进程耗时计算的准确度, 具体如 下:用于计算的上述系统开机时间以及系统空闲时间不包含进程等待过程中的 中央处理器耗时, 所有进程的输入 /输出吞吐量不包含等待过程中的输入 /输出 耗时。  More specifically, since the process may have a waiting situation, the situation is not a resource consumed in the system startup process, and therefore may be excluded, further improving the accuracy of the process time-consuming calculation, as follows: the above system startup time for calculation And the system idle time does not include the CPU time spent in the process waiting process, and the input/output throughput of all processes does not include the input/output time spent in the waiting process.
上述设定的输入 /输出时间占总时间的比例可以是一个经臉值,预先设置, 计算的时候直接采用就可以了, 具体如下: 上述设定的输入 /输出时间占总时 间的比例的值域为 (0, 1.0 )。  The ratio of the above-mentioned set input/output time to the total time may be a face value, which is set in advance, and can be directly used when calculating, as follows: The value of the above-mentioned set input/output time as a percentage of the total time The domain is (0, 1.0).
发明人在实现本发明实施例的过程中还发现: 背景技术中的方案中, 由于 监控执行主体需要在被监控的进程之前运行,监控执行主体自身对系统资源消 耗就可能很高。 因此该方案对执行的时机要求过高。本发明实施例还提供了以 下解决方案: 优选地, 上述监控时间段内各进程之间的父子关系、 进程的中央 处理器耗、 进程的输入 /输出吞吐量中的至少一项的获取方式包括:  The inventor also finds in the process of implementing the embodiments of the present invention: In the solution in the background art, since the monitoring execution entity needs to run before the monitored process, the monitoring execution entity itself may consume system resources. Therefore, the timing of the implementation of the program is too high. The embodiment of the present invention further provides the following solutions: Preferably, at least one of the parent-child relationship between the processes in the monitoring period, the CPU consumption of the process, and the input/output throughput of the process is included in the foregoing monitoring period. :
釆用定时中断的方式获取当前的所有进程,并保存本次中断与前次中断相 比的新的进程的句柄信息; 读取与上述句柄信息对应的应用程序编程接口得 到。  获取 Obtain all current processes by means of timed interrupts, and save the handle information of the new process whose current interrupt is compared with the previous interrupt; read the application programming interface corresponding to the above handle information.
釆用本实施例方案执行监控的进程可以不必在被监控的进程之前运行,这 样就可以降低对执行时机的要求。  The process of performing monitoring by the scheme of the embodiment can be performed without having to run before the monitored process, so that the requirement for execution timing can be reduced.
703 : 将上述第一进程的耗时以及第二进程的耗时之和作为待计算的启动 项的耗时。  703: The time consuming of the first process and the time consuming of the second process are taken as the time of the startup item to be calculated.
釆用如上方案, 不仅记录了启动项对应的进程的耗时,还计算了该进程的 子进程的耗时,分析进程对系统启动时间的影响, 不再终止于其其自身加载结 束, 而是综合考虑进程在整个监控时间段内进程自身以及其子进程, 因而能够 更加准确的确定启动项在开机阶段的耗时。  Using the above scheme, not only the time consumption of the process corresponding to the startup item is recorded, but also the time consumption of the child process of the process is calculated, and the influence of the analysis process on the system startup time is no longer terminated at the end of its own loading, but Considering the process itself and its sub-processes throughout the monitoring period, it is possible to more accurately determine the elapsed time of the startup item during the startup phase.
在以上实施例中, 子进程由父进程创建(即第二进程由第一进程创建), 一个父进程可能有多个子进程, 而子进程也可能有他自己的子进程,在前述实 施例中将父进程的子进程以及子进程的子进程全部统称为第二进程。  In the above embodiment, the child process is created by the parent process (that is, the second process is created by the first process), one parent process may have multiple child processes, and the child process may have its own child process, in the foregoing embodiment. The child process of the parent process and the child process of the child process are collectively referred to as the second process.
例如: QQ.exe是由 QQProtect.exe创建的, 而 QQExternal.exe是由 QQ.exe 创建的, 如果 QQProtect.exe、 QQ.exe、 QQExternal.exe三个进程自身的耗时分 别是 Tl、 Τ2、 Τ3 那么: For example: QQ.exe is created by QQProtect.exe, and QQExternal.exe is by QQ.exe Created, if QQProtect.exe, QQ.exe, QQExternal.exe three processes themselves are time-consuming Tl, Τ2, Τ3 then:
QQExternal.exe的耗时是 Τ3 , QQ.exe 的耗时是 T2+T3, QQProtect.exe的 耗时是 Tl+T2+T3。  The time spent on QQExternal.exe is Τ3, the time consumption of QQ.exe is T2+T3, and the time consumption of QQProtect.exe is Tl+T2+T3.
通过本发明实施例的方案,只需要将监控软件设为一个服务在开机过程中 运行便能较准确的获得系统中的启动项在开机阶段的耗时。如果将这些信息展 示给用户, 用户可以自行决定将那些启动项禁用掉, 让其不在开机阶段运行, 从而提高用户系统的开机时间, 进而提高整个系统的运行速度。  With the solution of the embodiment of the present invention, it is only necessary to set the monitoring software to be a service, and the operation of the startup process can accurately obtain the time consumption of the startup item in the system during the startup phase. If the information is displayed to the user, the user can disable the startup items to prevent them from running during the startup phase, thereby increasing the startup time of the user system and thereby increasing the operating speed of the entire system.
以下给出一个以上方案的具体实现举例, 为方便表述, 首先定义了如下参 数: Τ、表示启动项耗时, 表示进程耗时 (即启动项对应的进程的耗时), 表示子进程耗时, 表示进程 CPU耗时, 。表示进程的 I/O耗时, CNTi'() 进程 I/O吞吐量, 表示系统开机时间, c表示设定的 ί/ο时间占运行时间的 比例, T 系统中的 CPU空闲时间。 The specific implementation examples of one or more schemes are given below. For convenience of description, the following parameters are first defined: Τ , indicating that the startup item takes time, indicating that the process is time consuming (that is, the time taken by the process corresponding to the startup item), indicating that the child process takes time , indicates that the process CPU is time consuming. Indicates the I/O time of the process, CNT i'() process I/O throughput, which indicates the system boot time, c indicates the ratio of the set ί/ο time to the running time, and the CPU idle time in the T system.
可以理解的是, ""是指从机器上电开始到判定开机启动完成的时间, 即 为系统开机时间。但是这个时间包括了用户在登录界面的等待时间, 这段时间 需要剔除, 这段时间的长度的获取方法是用当前会话(Session )的创建时间减 去 lssas.exe进程的创建时间, 剔除后的时间就是系统开机时间。  It can be understood that "" refers to the time from the start of power-on of the machine to the completion of the start-up, that is, the system boot time. However, this time includes the waiting time of the user on the login interface. This time needs to be culled. The length of the time is obtained by subtracting the creation time of the lssas.exe process from the creation time of the current session (Session). Time is the system boot time.
TCNT"o和 T 以及所有进程的 CPU耗时和 I/O吞吐量的过程如下, 具 体请参阅图 8, 包括: The process of T , CNT "o and T, and the CPU time and I/O throughput of all processes is as follows. Please refer to Figure 8, for details:
801 : 判断是否时钟中断, 如果是, 进入 802, 否则进入 801 ;  801: Determine whether the clock is interrupted. If yes, enter 802, otherwise enter 801;
本步骤中需要预先设定一个用于控制中断的时间间隔 t, 在监控软件启动 以后, 每隔一个时间间隔 t执行一次中断, t可以为任意时间间隔, 经验值可 以设为 1秒。  In this step, a time interval t for controlling the interrupt needs to be preset. After the monitoring software is started, an interrupt is executed every other time interval t, t can be any time interval, and the experience value can be set to 1 second.
802: 枚举系统上所有进程并获得其进程信息;  802: Enumerate all processes on the system and get their process information;
803: 判断有没有新的进程 (即未被监控软件记录在内存的进程 )被创建; 如果有, 进入 804, 如果没有, 进入 808;  803: Determine whether there is a new process (that is, a process that is not recorded in the memory by the monitoring software) is created; if yes, enter 804, if not, enter 808;
804: 将新建进程的句柄(Handle ), 进程 ID ( IDentity, 标识)等信息保 存在内存, 进程 ID可以是 PID ( Process ID , 进程 ID号);  804: The handle of the newly created process (Handle), the process ID (IDentity, identifier) and the like are stored in the memory, and the process ID may be a PID (Process ID, process ID number);
805: 判断是否发现首次出现 lsass.exe进程, 如果是, 进入 806, 如果否, 进入 807; 805: Determine whether the first occurrence of the lsass.exe process, if yes, enter 806, if no, Enter 807;
806: 将当前所有进程的信息保存;  806: save information of all current processes;
本步骤中, 保存的信息可以有: PID、 CPU使用率、 I/O读写量等, 保存 的位置可以是内存, 也可以是文件, 本实施例不予限定。  In this step, the saved information may include: PID, CPU usage, I/O read/write, etc., and the saved location may be a memory or a file, which is not limited in this embodiment.
807: 判断是否为用户首次登录, 如果是, 进入 806, 如果否进入 808; 807: Determine whether the user is logged in for the first time, if yes, enter 806, if no, enter 808;
808: 判断本次开机是否已经完成, 如果是, 进入 809, 否则进入 801 ;808: Determine whether the boot is completed. If yes, enter 809, otherwise enter 801;
809: 结束时钟, 并计算每个进程的耗时, 以及启动项耗时。 809: End the clock, and calculate the elapsed time of each process, as well as the time spent on the startup item.
计算方法如下, 805到 806以及 807到 806的的两个过程, 在这两个过程 中保存了两次信息, 据此可以得到这两次之间的 CPU时间和 I/O吞吐量的变 化, 两者相减可以得到差值, 这差值是用户在登录等待界面的消耗(CPU 时 间和 I/O吞吐量的消耗), 该部分不算在进程在开机过程的消耗里。  The calculation method is as follows. The two processes of 805 to 806 and 807 to 806 save two times of information in the two processes, thereby obtaining the change of CPU time and I/O throughput between the two times. The difference between the two can be used to obtain the difference, which is the user's consumption in the login waiting interface (CPU time and I/O throughput consumption), which is not counted in the process's consumption during the boot process.
保存进程句柄信息, 可以通过视窗 ( Windows ) API ( Application Programming Interface, 应用程序编程接口)得到最后获得进程在保存句柄信 息时的 CPU时间、 I/O吞吐量、 各进程之间的父子关系。 此时的 CPU时间和 I/O吞吐量减去前述差值,这个就得到了这个进程在整个开机阶段的 CPU耗时 和 I/O吞吐量。 所有进程中, 名称为 "System idle Process"进程的 CPU时间就 是7^ (该时间也需减去登录等待阶段的那部分时间)。 此处需要注意的是, 在 CPU为多核的机器上, 我们计算的 和 '都要除以 CPU的核数。 Save the process handle information, you can use the Windows (Windows) API (Application Programming Interface) to get the CPU time, I / O throughput, and the parent-child relationship between the processes when the process saves the handle information. At this time, the CPU time and I/O throughput are subtracted from the aforementioned difference, which gives the CPU time and I/O throughput of the process during the entire boot phase. In all processes, the CPU time for the process named "System idle Process" is 7 ^ (this time also subtracts the portion of the login wait phase). It should be noted here that on a machine with a multi-core CPU, the sum we calculate is divided by the number of cores of the CPU.
经过上面可以得到各个进程的 CPU时间 ", I/O吞吐量^^"。, 再用 和7^套用可以得到每一进程的 假定进程数为 i, 如式(4 ) 所示: After the above, you can get the CPU time of each process ", I / O throughput ^ ^". , and then use 7 ^ to get the number of hypothetical processes for each process is i, as shown in equation (4):
n  n
Τ θ二 d _ Σ  Τ θ 2 d _ Σ
^、 ^,
Figure imgf000013_0001
式(4 ) 描述: 进程 I/O耗时 = (系统开机时间 -所有进程的 CPU时间总和 -系统 闲时间)χ设定的 I/O时间占总时间的比例 X进程的 I/O吞吐量 ÷全部进程的 I/O 吞吐量; 其中 C是一个经臉值, 值域为 (0, 1.0 )。
Figure imgf000013_0001
Equation (4) Description: Process I/O time = (system boot time - total CPU time of all processes - system idle time) χ set I/O time to total time ratio X process I/O throughput I I/O throughput for all processes; where C is a face value with a range of (0, 1.0).
在得到 。后, 再计算得到每一个进程的开机耗时 , 如式(6 )所示:  In getting. After that, calculate the boot time of each process, as shown in equation (6):
ΤΡ = Τ + Τυο 式(6 ) 描述:进程耗时 =进程运行过程中消耗的 CPU时间 +进程运行过程中消 耗的 I/O时间。 Τ Ρ = Τ + Τ υο Equation (6) Description: Process time consumption = CPU time consumed during process running + Process running process I/O time consumed.
通过句柄信息以及对应的系统的 API可以获得进程的所有子进程,子进程 的开机耗时可以参考前述方案中进程耗时的计算方法得到。这样, 我们通过式 ( 6 )就得到了一个启动项在开机阶段的耗时 , 假定有 i个子进程。  All the child processes of the process can be obtained through the handle information and the API of the corresponding system. The time-consuming time of the child process can be obtained by referring to the time-consuming calculation method of the process in the foregoing solution. In this way, we get the time of a startup item in the boot phase through equation (6), assuming that there are i child processes.
m  m
τ 二 τ +  τ 2 τ +
'■=' 式( 5 ) 发明人在实现本发明实施例的过程中发现, 由于在开机阶段, 一个进程加 载结束了, 并不代表该进程就停止运行了, 在其他进程加载的过程中, 该进程 还在运行后续的逻辑, 仍会消耗系统资源, 甚至还会拉起其他进程, 这些都会 影响系统的开机。仅以一个进程完成加载就认为改进程在开机阶段已完成,这 种孤立地看待一个进程自身加载来评估对整个系统运行的影响,得到的进程开 机耗时将会偏少。 因此前述方案不能准确的测算进程耗时。基于此本发明实施 例还提供了一种启动项耗时获取装置, 如图 9所示, 包括:  '■=' (5) The inventor found in the process of implementing the embodiment of the present invention that since the loading of a process is finished during the booting phase, it does not mean that the process stops running, in the process of loading other processes, The process is still running subsequent logic, still consuming system resources, and even pulling up other processes, which will affect the system boot. When the loading is completed by only one process, the improvement process is considered to have been completed during the booting phase. This is an isolated view of the loading of a process itself to evaluate the impact on the operation of the entire system, and the resulting process will take less time to start. Therefore, the foregoing solution cannot accurately measure the time consuming process. An embodiment of the present invention further provides a device for acquiring time-consuming time, as shown in FIG. 9, which includes:
关系获取单元 901 , 用于获取监控时间段内各进程之间的父子关系; 可以理解的是,一个进程的子进程可以为空,也可以为一个或者一个以上, 具体的子进程个数本发明实施例不予限定。本实施例在后续说明中会给出各进 程之间的父子关系如何获得的举例说明。  The relationship obtaining unit 901 is configured to acquire a parent-child relationship between processes in the monitoring time period; it can be understood that the child process of one process may be empty or one or more, and the specific number of the child processes is the present invention. The embodiment is not limited. This embodiment will give an example of how the parent-child relationship between processes is obtained in the following description.
进程确定单元 902, 用于确定第一进程和第二进程; 上述第一进程为待计 算的启动项对应的进程,上述第二进程为依据上述关系获取单元 901获取的各 进程项之间的父子关系确定的上述第一进程的子进程;  The process determining unit 902 is configured to determine the first process and the second process. The first process is a process corresponding to the startup item to be calculated, and the second process is a parent and child between the process items acquired by the relationship acquiring unit 901. The child process of the first process described above determined by the relationship;
耗时计算单元 903 , 用于计算进程耗时, 上述计算进程耗时包括: 计算上 述第一进程的耗时以及第二进程的耗时;将上述第一进程的耗时以及第二进程 的耗时之和作为待计算的启动项的耗时。  The time-consuming calculation unit 903 is configured to calculate a time-consuming process, where the calculating process time-consuming includes: calculating a time consumption of the first process and a time consumption of the second process; and consuming the time of the first process and the consumption of the second process The sum of time is taken as the time of the startup item to be calculated.
采用如上方案, 不仅记录了启动项对应的进程的耗时,还计算了该进程的 子进程的耗时,分析进程对系统启动时间的影响, 不再终止于其其自身加载结 束, 而是综合考虑进程在整个监控时间段内进程自身以及其子进程, 因而能够 更加准确的确定启动项在开机阶段的耗时。  Using the above scheme, not only the time consumption of the process corresponding to the startup item is recorded, but also the time consumption of the child process of the process is calculated, and the influence of the analysis process on the system startup time is no longer terminated at the end of its own loading, but is integrated. Considering that the process itself and its sub-processes during the entire monitoring period, it is possible to more accurately determine the elapsed time of the startup item in the startup phase.
发明人在实现本发明实施例的过程中,还发现: 进程的 I/O ( Input/Output , 输入 /输出)是进程在启动过程中所占用的资源, 会对进程启动构成影响。 因 此, I/O时间也应属于进程耗时的一部分。 优选采用如下方式: 上述耗时计算 单元 303 ,具体用于计算进程的中央处理器耗时以及进程的输入 /输出耗时,将 进程的中央处理器耗时与进程的输入 /输出耗时的和作为进程耗时。 In the process of implementing the embodiments of the present invention, the inventor also finds that: the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup. Cause Therefore, the I/O time should also be part of the time-consuming process. Preferably, the following method is adopted: The time-consuming computing unit 303 is specifically used for calculating the CPU time consumption of the process and the input/output time consumption of the process, and the sum of the CPU time consumption of the process and the input/output time of the process. Time-consuming as a process.
更具体地, 本发明实施例还给出了具体如何计算进程的输入 /输出耗时的 方案, 如下: 上述监控时间段为开机时间的时间段; 上述耗时计算单元 303 , 具体用于计算系统开机时间与所有进程的中央处理器时间总和以及系统空闲 时间的差, 计算设定的输入 /输出时间占系统开机时间的比例与进程的输入 /输 出吞吐量的积再与所有进程的输入 /输出吞吐量的商, 计算上述差与上述商的 积作为上述进程的输入 /输出耗时。  More specifically, the embodiment of the present invention further provides a scheme for calculating the input/output time consumption of the process, as follows: The foregoing monitoring time period is a time period of the booting time; the time consuming calculating unit 303 is specifically used for the computing system. The difference between the boot time and the total CPU time of all processes and the system idle time, calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input/output of all processes. The quotient of the throughput calculates the product of the above difference and the above quotient as the input/output time of the above process.
更具体地, 由于进程可能存在等待的情况, 该情况不属于系统启动过程中 耗费的资源, 因此可以排除在外, 上述耗时计算单元 903 , 具体用于计算的系 统开机时间以及系统空闲时间不包含进程等待过程中的中央处理器耗时,所有 进程的输入 /输出吞吐量不包含等待过程中的输入 /输出耗时。  More specifically, because the process may have a waiting situation, the situation is not a resource consumed in the system startup process, and therefore may be excluded. The time-consuming computing unit 903, specifically used for calculating the system boot time and the system idle time, does not include The CPU waits while the process is waiting. The input/output throughput of all processes does not include the input/output time spent in the wait process.
上述设定的输入 /输出时间占总时间的比例可以是一个经验值, 预先设置, 计算的时候直接釆用就可以了, 具体如下: 上述耗时计算单元 903 , 具体用于 计算使用的上述设定的输入 /输出时间占总时间的比例的值域为 (0, 1.0 )。  The ratio of the above-mentioned set input/output time to the total time may be an empirical value, which is set in advance, and may be directly used in the calculation, as follows: The above-mentioned time-consuming calculation unit 903 is specifically used for calculating the above-mentioned settings. The range of the ratio of the specified input/output time to the total time is (0, 1.0).
发明人在实现本发明实施例的过程中还发现: 背景技术中的方案中, 由于 监控执行主体需要在被监控的进程之前运行,监控执行主体自身对系统资源消 耗就可能很高。 因此该方案对执行的时机要求过高。本发明实施例还提供了以 下解决方案: 进一步地, 如图 10所示, 上述装置, 还包括:  The inventor also finds in the process of implementing the embodiments of the present invention: In the solution in the background art, since the monitoring execution entity needs to run before the monitored process, the monitoring execution entity itself may consume system resources. Therefore, the timing of the implementation of the program is too high. The embodiment of the present invention further provides the following solutions: Further, as shown in FIG. 10, the foregoing apparatus further includes:
信息获取单元 1001 , 用于获取上述监控时间段内各进程之间的父子关系、 进程的中央处理器耗、 进程的输入 /输出吞吐量中的至少一项, 且获取方式为: 釆用定时中断的方式获取当前的所有进程,并保存本次中断与前次中断相比的 新的进程的句柄信息; 读取与上述句柄信息对应的应用程序编程接口得到。  The information obtaining unit 1001 is configured to acquire at least one of a parent-child relationship between processes in the monitoring period, a CPU consumption of the process, and an input/output throughput of the process, and the obtaining manner is: The way to get all the current processes, and save the handle information of the new process compared with the previous interrupt; read the application programming interface corresponding to the above handle information.
釆用本实施例方案执行监控的进程可以不必在被监控的进程之前运行,这 样就可以降低对执行时机的要求。  The process of performing monitoring by the scheme of the embodiment can be performed without having to run before the monitored process, so that the requirement for execution timing can be reduced.
本发明实施例还提供了一种终端, 该终端可以是手机、 电脑、 平板电脑、 个人数字助理( Personal Digital Assistant, PDA ), 销售终端 ( Point of Sales , POS ) 以及车载终端等。 如图 11所示, 可终端可以包括: 射频(Radio Frequency, RF ) 电路 510、 存储器 520、 输入单元 530、 显 示单元 540、 传感器 550、 音频电路 560、 通信模块 570、 处理器 580、 以及电 源 590等部件。 在本发明实施例中, 该终端可以是手机、 电脑、 平板电脑、 个 人数字助理( Personal Digital Assistant, PDA )、销售终端( Point of Sales, POS ) 以及车载终端等。 The embodiment of the invention further provides a terminal, which may be a mobile phone, a computer, a tablet computer, a personal digital assistant (PDA), a point of sale (POS), an in-vehicle terminal, and the like. As shown in FIG. 11, the terminal may include: A radio frequency (RF) circuit 510, a memory 520, an input unit 530, a display unit 540, a sensor 550, an audio circuit 560, a communication module 570, a processor 580, and a power supply 590. In the embodiment of the present invention, the terminal may be a mobile phone, a computer, a tablet, a Personal Digital Assistant (PDA), a Point of Sales (POS), an in-vehicle terminal, or the like.
RF电路 510可用于收发信息或通话过程中,信号的接收和发送,特别地, 将基站的下行信息接收后, 给处理器 580处理; 另外, 将设计上行的数据发送 给基站。 通常, RF电路包括但不限于天线、 至少一个放大器、 收发信机、 耦 合器、 低噪声放大器(Low Noise Amplifier, LNA )、 双工器等。 此外, RF电 路 50还可以通过无线通信与网络和其他设备通信。 上述无线通信可以使用任 一通信标准或协议, 包括但不限于全球移动通讯系统 ( Global System of Mobile communication , GSM )、 通用分组无线月良务 ( General Packet Radio Service, GPRS )、 码分多址( Code Division Multiple Access, CDMA ), 宽带码 分多址( Wideband Code Division Multiple Access, WCDMA )、长期演进 ( Long Term Evolution, LTE )、电子邮件、短消息服务( Short Messaging Service, SMS ) 等。  The RF circuit 510 can be used for receiving and transmitting signals during and after receiving or transmitting information, in particular, after receiving downlink information of the base station, and processing it to the processor 580; in addition, transmitting the designed uplink data to the base station. Typically, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuit 50 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), and code division multiple access ( Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), E-mail, Short Messaging Service (SMS), etc.
存储器 520可用于存储软件程序以及模块,处理器 580通过运行存储在存 储器 520的软件程序以及模块, 从而执行终端的各种功能应用以及数据处理。 存储器 520可主要包括存储程序区和存储数据区, 其中,存储程序区可存储操 作系统、至少一个功能所需的应用程序 (比如声音播放功能、图像播放功能等) 等; 存储数据区可存储根据手机的使用所创建的数据(比如音频数据、 电话本 等)等。 此外, 存储器 520可以包括高速随机存取存储器, 还可以包括非易失 性存储器, 例如至少一个磁盘存储器件、 闪存器件、 或其他易失性固态存储器 件。  The memory 520 can be used to store software programs and modules, and the processor 580 executes various functional applications and data processing of the terminals by running software programs and modules stored in the memory 520. The memory 520 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored according to Data created by the use of the mobile phone (such as audio data, phone book, etc.). In addition, memory 520 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state memory device.
输入单元 530 可用于接收输入的数字或字符信息, 以及产生与终端 500 的用户设置以及功能控制有关的键信号输入。具体地,输入单元 530可包括触 控面板 531 以及其他输入设备 532。 触控面板 531 , 也称为触摸屏, 可收集用 户在其上或附近的触摸操作 (比如用户使用手指、触笔等任何适合的物体或附 件在触控面板 531上或在触控面板 531附近的操作 ), 并根据预先设定的程式 驱动相应的连接装置。可选的,触控面板 531可包括触摸检测装置和触摸控制 器两个部分。 其中, 触摸检测装置检测用户的触摸方位, 并检测触摸操作带来 的信号,将信号传送给触摸控制器; 触摸控制器从触摸检测装置上接收触摸信 息, 并将它转换成触点坐标, 再送给处理器 580, 并能接收处理器 580发来的 命令并加以执行。 此外, 可以采用电阻式、 电容式、 红外线以及表面声波等多 种类型实现触控面板 531。 除了触控面板 531, 输入单元 530还可以包括其他 输入设备 532。 具体地, 其他输入设备 532可以包括但不限于物理键盘、 功能 键(比如音量控制按键、 开关按键等)、 轨迹球、 鼠标、 操作杆等中的一种或 多种。 The input unit 530 can be configured to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the terminal 500. Specifically, the input unit 530 can include a touch panel 531 and other input devices 532. The touch panel 531, also referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger, a stylus, or the like on the touch panel 531 or near the touch panel 531. Operation), and according to a preset program Drive the corresponding connecting device. Optionally, the touch panel 531 can include two parts: a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information The processor 580 is provided and can receive commands from the processor 580 and execute them. In addition, the touch panel 531 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 531, the input unit 530 may also include other input devices 532. Specifically, other input devices 532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
显示单元 540 可用于显示由用户输入的信息或提供给用户的信息以及终 端的各种菜单。 显示单元 540可包括显示面板 541 , 可选的, 可以釆用液晶显 示器 ( Liquid Crystal Display, LCD ) 有机发光二极管 ( Organic Light-Emitting Diode, OLED )等形式来配置显示面板 541。 进一步的, 触控面板 531可覆盖 显示面板 541 , 当触控面板 531检测到在其上或附近的触摸操作后, 传送给处 理器 580以确定触摸事件的类型,随后处理器 580根据触摸事件的类型在显示 面板 541上提供相应的视觉输出。 虽然在图 5 中, 触控面板 531与显示面板 541是作为两个独立的部件来实现终端的输入和输入功能, 但是在某些实施例 中, 可以将触控面板 531与显示面板 541集成而实现终端的输入和输出功能。  The display unit 540 can be used to display information input by the user or information provided to the user as well as various menus of the terminal. The display unit 540 can include a display panel 541. Alternatively, the display panel 541 can be configured in the form of a Liquid Crystal Display (LCD) Organic Light-Emitting Diode (OLED). Further, the touch panel 531 can cover the display panel 541. When the touch panel 531 detects a touch operation on or near it, the touch panel 531 transmits to the processor 580 to determine the type of the touch event, and then the processor 580 according to the touch event. The type provides a corresponding visual output on display panel 541. Although in FIG. 5, the touch panel 531 and the display panel 541 are used as two independent components to implement input and input functions of the terminal, in some embodiments, the touch panel 531 may be integrated with the display panel 541. Realize the input and output functions of the terminal.
终端 500还可包括至少一种传感器 550, 比如光传感器、 运动传感器以及 其他传感器。 具体地, 光传感器可包括环境光传感器及接近传感器, 其中, 环 境光传感器可根据环境光线的明暗来调节显示面板 541的亮度,接近传感器可 在终端移动到耳边时, 关闭显示面板 541和 /或背光。 作为运动传感器的一种, 加速计传感器可检测各个方向上(一般为三轴 )加速度的大小, 静止时可检测 出重力的大小及方向, 可用于识别终端姿态的应用 (比如横竖屏切换、相关游 戏、 磁力计姿态校准)、 振动识别相关功能(比如计步器、 敲击)等; 至于终 端还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器, 在此不再赞述。  Terminal 500 can also include at least one type of sensor 550, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 541 according to the brightness of the ambient light, and the proximity sensor may close the display panel 541 and/or when the terminal moves to the ear. Or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes). When it is stationary, it can detect the magnitude and direction of gravity. It can be used to identify the attitude of the terminal (such as horizontal and vertical screen switching, related Game, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can be configured in the terminal are no longer used here. Praise.
音频电路 560、 扬声器 561 , 传声器 562可提供用户与终端之间的音频接 口。音频电路 560可将接收到的音频数据转换后的电信号,传输到扬声器 561 , 由扬声器 561转换为声音信号输出; 另一方面,传声器 562将收集的声音信号 转换为电信号, 由音频电路 560接收后转换为音频数据,再将音频数据输出处 理器 580处理后, 经 RF电路 510以发送给比如另一终端, 或者将音频数据输 出至存储器 520以便进一步处理。 Audio circuit 560, speaker 561, and microphone 562 can provide an audio interface between the user and the terminal. The audio circuit 560 can transmit the converted electrical data of the received audio data to the speaker 561. The speaker 561 converts the sound signal into an audio signal. On the other hand, the microphone 562 converts the collected sound signal into an electrical signal, which is received by the audio circuit 560 and converted into audio data, and then processed by the audio data output processor 580, and then passed through the RF circuit. 510 is sent to, for example, another terminal, or audio data is output to memory 520 for further processing.
终端通过通信模块 570可以帮助用户收发电子邮件、浏览网页和访问流式 媒体等, 它为用户提供了无线的宽带互联网访问。 虽然图 5 示出了通信模块 570, 但是可以理解的是, 其并不属于终端 500的必须构成, 完全可以根据需 要在不改变发明的本质的范围内而省略。  The terminal can help the user to send and receive emails, browse web pages, access streaming media, etc. through the communication module 570, which provides users with wireless broadband Internet access. Although FIG. 5 shows the communication module 570, it will be understood that it does not belong to the essential configuration of the terminal 500, and may be omitted as needed within the scope of not changing the essence of the invention.
处理器 580是终端的控制中心,利用各种接口和线路连接整个终端的各个 部分, 通过运行或执行存储在存储器 520 内的软件程序和 /或模块, 以及调用 存储在存储器 520内的数据,执行终端的各种功能和处理数据,从而对终端进 行整体监控。 可选的, 处理器 580可包括一个或多个处理单元; 优选的, 处理 器 580可集成应用处理器和调制解调处理器, 其中,应用处理器主要处理操作 系统、 用户界面和应用程序等, 调制解调处理器主要处理无线通信。 可以理解 的是, 上述调制解调处理器也可以不集成到处理器 580中。  The processor 580 is the control center of the terminal, and connects various parts of the entire terminal using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 520, and calling data stored in the memory 520, executing The terminal's various functions and processing data, so as to monitor the terminal as a whole. Optionally, the processor 580 may include one or more processing units. Preferably, the processor 580 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application, and the like. The modem processor primarily handles wireless communications. It will be appreciated that the above described modem processor may also not be integrated into processor 580.
终端 500还包括给各个部件供电的电源 590 (比如电池), 优选的, 电源 可以通过电源管理系统与处理器 580逻辑相连,从而通过电源管理系统实现管 理充电、 放电、 以及功耗管理等功能。  The terminal 500 also includes a power source 590 (such as a battery) for powering various components. Preferably, the power source can be logically coupled to the processor 580 through a power management system to perform functions such as managing charging, discharging, and power management through the power management system.
尽管未示出, 终端 500还可以包括摄像头、 话筒等, 在此不再赘述。  Although not shown, the terminal 500 may further include a camera, a microphone, etc., and details are not described herein.
在本发明实施例中,该终端所包括的处理器 580还可执行对启动项耗时的 获取。 处理器 580可通过以下步骤获取启动项耗时:  In the embodiment of the present invention, the processor 580 included in the terminal may also perform time-consuming acquisition of the startup item. The processor 580 can obtain the time of the startup item by the following steps:
获取第一进程耗时和第二进程耗时 , 所述第一进程为启动项对应的进程 , 所述第二进程为所述第一进程的子进程;  Obtaining the first process time-consuming and the second process time-consuming, the first process is a process corresponding to the startup item, and the second process is a child process of the first process;
将所述第一进程耗时与所述第二进程耗时的和作为所述启动项耗时。  The time consuming time of the first process and the second process is time consuming as the startup item.
可以理解的是,一个进程的子进程可以为空,也可以为一个或者一个以上, 子进程还可以有子进程, 统称为第二进程,具体的子进程个数本发明实施例不 予限定。  It can be understood that the sub-process of a process may be empty or one or more. The sub-process may also have a sub-process, which is collectively referred to as a second process. The number of the specific sub-processes is not limited in the embodiment of the present invention.
发明人在实现本发明实施例的过程中,还发现: 进程的 I/O ( Input/Output , 输入 /输出)是进程在启动过程中所占用的资源, 会对进程启动构成影响。 因 此, I/O时间也应属于进程耗时的一部分。 优选采用如下方式: 上述计算进程 耗时包括: 计算进程的中央处理器耗时以及进程的输入 /输出耗时, 将进程的 中央处理器耗时与进程的输入 /输出耗时的和作为进程耗时。 In the process of implementing the embodiments of the present invention, the inventor also finds that: the I/O (Input/Output) of the process is the resource occupied by the process during the startup process, which will affect the process startup. Cause Therefore, the I/O time should also be part of the time-consuming process. Preferably, the following manner is adopted: The calculation process time-consuming includes: calculating the CPU time consumption of the process and the input/output time consumption of the process, and taking the sum of the CPU time consumption of the process and the input/output time of the process as the process consumption. Time.
更具体地, 本发明实施例还给出了具体如何计算进程的输入 /输出耗时的 方案, 如下: 上述监控时间段为开机时间的时间段, 上述计算进程的输入 /输 出耗时包括:计算系统开机时间与所有进程的中央处理器时间总和以及系统空 闲时间的差, 计算设定的输入 /输出时间占系统开机时间的比例与进程的输入 / 输出吞吐量的积再与所有进程的输入 /输出吞吐量的商, 计算上述差与上述商 的积作为上述进程的输入 /输出耗时。  More specifically, the embodiment of the present invention also provides a specific how to calculate the input/output time consumption of the process, as follows: The above monitoring time period is the time period of the boot time, and the input/output time consumption of the above calculation process includes: calculation The difference between the system boot time and the total CPU time of all processes and the system idle time, calculate the ratio of the set input/output time to the system boot time and the input/output throughput of the process and the input of all processes/ The quotient of the output throughput is calculated by calculating the product of the difference and the above quotient as the input/output time of the above process.
获取进程 I/O耗时的方法,也可以通过内核态程序注册 ETW( Event Tracing for Windows , ETW提供了一种对用户层应用程序和内核层驱动创建的事件对 象的跟踪记录机制)事件的方法, 捕获每一个进程的 I/O时间, 这样也可以精 确的确定 I/O耗时。  The method of obtaining the time I/O of the process can also register the event of the ETW (Event Tracing for Windows, ETW provides a tracking and recording mechanism for the event object created by the user layer application and the kernel layer driver) through the kernel mode program. , capture the I / O time of each process, which can also accurately determine the I / O time.
更具体地, 由于进程可能存在等待的情况, 该情况不属于系统启动过程中 耗费的资源, 因此可以排除在外, 进一步提高进程耗时计算的准确度, 具体如 下:用于计算的上述系统开机时间以及系统空闲时间不包含进程等待过程中的 中央处理器耗时, 所有进程的输入 /输出吞吐量不包含等待过程中的输入 /输出 耗时。  More specifically, since the process may have a waiting situation, the situation is not a resource consumed in the system startup process, and therefore may be excluded, further improving the accuracy of the process time-consuming calculation, as follows: the above system startup time for calculation And the system idle time does not include the CPU time spent in the process waiting process, and the input/output throughput of all processes does not include the input/output time spent in the waiting process.
可选地, 上述设定的输入 /输出时间占总时间的比例的值域为 (0, 1.0 )。 可选地,上述监控时间段内各进程之间的父子关系、进程的中央处理器耗、 进程的输入 /输出吞吐量中的至少一项的获取方式包括:  Optionally, the ratio of the ratio of the input/output time set to the total time set above is (0, 1.0). Optionally, the obtaining of at least one of a parent-child relationship between the processes in the monitoring period, a CPU consumption of the process, and an input/output throughput of the process includes:
釆用定时中断的方式获取当前的所有进程,并保存本次中断与前次中断相 比的新的进程的句柄信息; 读取与上述句柄信息对应的应用程序编程接口得 到。  获取 Obtain all current processes by means of timed interrupts, and save the handle information of the new process whose current interrupt is compared with the previous interrupt; read the application programming interface corresponding to the above handle information.
值得注意的是, 上述装置实施例中, 所包括的各个单元只是按照功能逻辑 进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另夕卜, 各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护 范围。  It should be noted that, in the foregoing device embodiments, the respective units included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be implemented; in addition, each functional unit The specific names are also for convenience of distinguishing from each other and are not intended to limit the scope of the present invention.
另外,本领域普通技术人员可以理解实现上述各方法实施例中的全部或部 分步骤是可以通过程序来指令相关的硬件完成,相应的程序可以存储于一种计 算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。 In addition, those skilled in the art can understand that all or part of the foregoing method embodiments are implemented. The sub-steps can be completed by a program to instruct related hardware, and the corresponding programs can be stored in a computer-readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk.
以上仅为本发明较佳的具体实施方式, 但本发明的保护范围并不局限于 此,任何熟悉本技术领域的技术人员在本发明实施例揭露的技术范围内,可轻 易想到的变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保 护范围应该以权利要求的保护范围为准。  The above is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the embodiments of the present invention. All should be covered by the scope of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

权 利 要 求 Rights request
1、 一种启动项耗时获取方法, 其特征在于, 包括: 1. A time-consuming method for obtaining startup items, which is characterized by including:
获取第一进程耗时和第二进程耗时,所述第一进程为所述启动项对应的进 程, 所述第二进程为所述第一进程的子进程; Obtain the time consumption of the first process and the time consumption of the second process, the first process is the process corresponding to the startup item, and the second process is a child process of the first process;
将所述第一进程耗时与所述第二进程耗时的和作为所述启动项耗时;以及 当所述启动项耗时大于预设阈值时, 禁用所述启动项。 The sum of the time consumption of the first process and the time consumption of the second process is used as the time consumption of the startup item; and when the time consumption of the startup item is greater than a preset threshold, disable the startup item.
2、 根据权利要求 1所述的方法, 其特征在于, 还包括: 根据所述第一进 程和所述第二进程之间的父子关系确定所述第一进程和所述第二进程。 2. The method according to claim 1, further comprising: determining the first process and the second process according to the parent-child relationship between the first process and the second process.
3、 根据权利要求 1或 2所述的方法, 其特征在于, 3. The method according to claim 1 or 2, characterized in that,
所述获取第一进程耗时包括: The time taken to obtain the first process includes:
获取所述第一进程的 CPU耗时和所述第一进程的 I/O耗时; 以及 将所述第一进程的 CPU耗时与所述第一进程的 I/O耗时作为所述第一进 程耗时。 Obtain the CPU time consumption of the first process and the I/O time consumption of the first process; and use the CPU time consumption of the first process and the I/O time consumption of the first process as the first process. A process takes time.
4、 根据权利要求 3所述的方法, 其特征在于, 所述第一进程的 I/O耗时 通过如下公式继续计算 4. The method according to claim 3, characterized in that, the I/O time consumption of the first process is continued to be calculated through the following formula
τ 二(τ -Υτ - Τ X * 10 ~ τ 二 (τ -Υτ - Τ X * 10 ~
-l ∑CNTIO{i) 其中, 。表示所述第一进程的 I/O耗时; rfl„表示系统启动时间; Γφίφ.)表 示所述系统中第 i个进程的 CPU耗时; 1^表示所述系统的 CPU空闲时间; C 表示 I/O耗时占运行时间的比例; C 。表示该所述第一进程的 I/O吞吐量; CM。w表示所述系统中第 i个进程的 I/O吞吐量, n 表示所述系统中所有进 程的个数。 - l ∑CNT IO{i) where, . represents the I/O time consumption of the first process; r fl „ represents the system startup time; Γ φίφ .) represents the CPU time consumption of the i-th process in the system; 1^ represents the CPU idle time of the system; C represents the proportion of I/O time-consuming to running time; C. represents the I/O throughput of the first process; CM. w represents the I/O throughput of the i-th process in the system, n represents The number of all processes in the system.
5、 根据权利要求 4所述的方法, 其特征在于, 所述系统启动时间为设备 开机时间减去用户登录所述系统的等待时间。 5. The method according to claim 4, wherein the system startup time is the device boot time minus the waiting time for a user to log in to the system.
6、 一种启动项耗时获取装置, 其特征在于, 包括: 6. A time-consuming device for obtaining startup items, which is characterized by including:
获取单元, 用于获取第一进程耗时和第二进程耗时, 所述第一进程为所述 启动项对应的进程, 所述第二进程为所述第一进程的子进程; The acquisition unit is used to obtain the time consumption of the first process and the time consumption of the second process. The first process is the process corresponding to the startup item, and the second process is a child process of the first process;
计算单元, 用于计算所述第一进程耗时与所述第二进程耗时的和, 并将该 和作为所述启动项耗时; 以及 A computing unit, configured to calculate the sum of the time consuming of the first process and the time consuming of the second process, and use the sum as the time consuming of the startup item; and
控制单元, 当所述启动项耗时大于预设阔值时, 禁用所述启动项。 The control unit disables the startup item when the startup item takes longer than a preset threshold.
7、 根据权利要求 6所述的装置, 其特征在于, 还包括: 7. The device according to claim 6, further comprising:
确定单元,用于根据所述第一进程和所述第二进程之间的父子关系确定所 述第一进程和所述第二进程。 A determining unit, configured to determine the first process and the second process according to the parent-child relationship between the first process and the second process.
8、 根据权利要求 6或 7所述的装置, 其特征在于, 所述计算单元包括: CPU耗时计算子单元, 用于计算所述第一进程的 CPU耗时和所述第二进 程的 CPU耗时; 以及 8. The device according to claim 6 or 7, characterized in that the calculation unit includes: a CPU time-consuming calculation subunit, used to calculate the CPU time-consuming of the first process and the CPU time of the second process. time consuming; and
I/O耗时计算子单元, 用于计算所述第一进程的 I/O耗时和所述第二进程 的 I/O耗时。 The I/O time-consuming calculation subunit is used to calculate the I/O time-consuming of the first process and the I/O time-consuming of the second process.
9、 一种非瞬时性存储介质, 其上存储有计算机可执行指令, 当计算机中 运行这些可执行指令时, 执行如下步骤: 9. A non-transitory storage medium on which computer executable instructions are stored. When these executable instructions are run in the computer, the following steps are performed:
获取第一进程耗时和第二进程耗时 , 所述第一进程为启动项对应的进程 , 所述第二进程为所述第一进程的子进程; 以及 Obtain the time consumption of the first process and the time consumption of the second process, the first process is the process corresponding to the startup item, and the second process is the child process of the first process; and
将所述第一进程耗时与所述第二进程耗时的和作为所述启动项耗时。 The sum of the time consumption of the first process and the time consumption of the second process is used as the time consumption of the startup item.
PCT/CN2014/073922 2013-03-22 2014-03-24 Startup item consumed time acquisition method and device WO2014146612A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310096444.5 2013-03-22
CN201310096444.5A CN103150248B (en) 2013-03-22 2013-03-22 Method and device for measuring and calculating startup time consumption

Publications (1)

Publication Number Publication Date
WO2014146612A1 true WO2014146612A1 (en) 2014-09-25

Family

ID=48548343

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/073922 WO2014146612A1 (en) 2013-03-22 2014-03-24 Startup item consumed time acquisition method and device

Country Status (2)

Country Link
CN (1) CN103150248B (en)
WO (1) WO2014146612A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110716660A (en) * 2019-09-02 2020-01-21 Oppo(重庆)智能科技有限公司 Touch screen starting method, terminal and storage medium

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103150248B (en) * 2013-03-22 2015-03-18 腾讯科技(深圳)有限公司 Method and device for measuring and calculating startup time consumption
CN104199692B (en) * 2014-08-25 2017-08-04 北京金山安全软件有限公司 Method, device and terminal for acquiring starting time of application program
CN107341094B (en) * 2016-04-29 2020-01-31 腾讯科技(深圳)有限公司 Method and device for measuring time consumed by starting item
CN107992334B (en) * 2016-10-27 2021-06-01 腾讯科技(深圳)有限公司 Startup optimization method and terminal
CN106775712B (en) * 2016-12-14 2021-02-05 深圳Tcl数字技术有限公司 Response method and device for android system starting process
CN107168839B (en) * 2017-05-18 2020-10-30 浙江红绿蓝纺织印染有限公司 Method for detecting starting time length of mobile terminal
CN111176869B (en) * 2019-08-01 2022-05-10 腾讯云计算(北京)有限责任公司 Timeout detection method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8060734B1 (en) * 2008-10-13 2011-11-15 Symantec Corporation Systems and methods for providing recommendations to improve boot performance based on community data
CN102298532A (en) * 2011-09-15 2011-12-28 奇智软件(北京)有限公司 Startup-item-based management method and device
CN102831045A (en) * 2012-06-21 2012-12-19 北京奇虎科技有限公司 Method and device for detecting starting items in terminal equipment
CN102981863A (en) * 2011-09-07 2013-03-20 奇智软件(北京)有限公司 Management method and device of starting up projects
CN103150248A (en) * 2013-03-22 2013-06-12 腾讯科技(深圳)有限公司 Method and device for measuring and calculating startup time consumption

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8010995B2 (en) * 2006-09-08 2011-08-30 International Business Machines Corporation Methods, systems, and computer program products for implementing inter-process integrity serialization
CN102096591A (en) * 2011-03-01 2011-06-15 云浮南风数字科技有限公司 Method for quickening start of embedded Linux system
CN102591770B (en) * 2011-12-27 2016-06-29 北京奇虎科技有限公司 A kind of intended application starts time detecting method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8060734B1 (en) * 2008-10-13 2011-11-15 Symantec Corporation Systems and methods for providing recommendations to improve boot performance based on community data
CN102981863A (en) * 2011-09-07 2013-03-20 奇智软件(北京)有限公司 Management method and device of starting up projects
CN102298532A (en) * 2011-09-15 2011-12-28 奇智软件(北京)有限公司 Startup-item-based management method and device
CN102831045A (en) * 2012-06-21 2012-12-19 北京奇虎科技有限公司 Method and device for detecting starting items in terminal equipment
CN103150248A (en) * 2013-03-22 2013-06-12 腾讯科技(深圳)有限公司 Method and device for measuring and calculating startup time consumption

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110716660A (en) * 2019-09-02 2020-01-21 Oppo(重庆)智能科技有限公司 Touch screen starting method, terminal and storage medium
CN110716660B (en) * 2019-09-02 2023-05-09 Oppo(重庆)智能科技有限公司 Touch screen starting method, terminal and storage medium

Also Published As

Publication number Publication date
CN103150248A (en) 2013-06-12
CN103150248B (en) 2015-03-18

Similar Documents

Publication Publication Date Title
WO2014146612A1 (en) Startup item consumed time acquisition method and device
WO2017206916A1 (en) Method for determining kernel running configuration in processor and related product
TWI520043B (en) Method, device and moving terminal for examining messages
US10664088B2 (en) Method for controlling touch screen and electronic device supporting thereof
US20160315999A1 (en) Device and method for associating applications
WO2017206902A1 (en) Application control method and related device
CN107590057B (en) Screen freezing monitoring and solving method, mobile terminal and computer readable storage medium
WO2015043194A1 (en) Virtual keyboard display method and apparatus, and terminal
CN106775833B (en) Device driver loading method, terminal and system
WO2015027856A1 (en) Information feedback method, apparatus, and terminal
JP6616896B2 (en) Fingerprint recognition method and electronic device
WO2017193496A1 (en) Application data processing method and apparatus, and terminal device
WO2017206915A1 (en) Method for determining kernel running configuration in processor and related product
WO2017206918A1 (en) Terminal awakening accelerating method and related product
WO2015035835A1 (en) Method and apparatus for detecting application program
CN110865884A (en) Memory management method and device
CN103631625B (en) A kind of method of data acquisition, user terminal, server and system
WO2018209555A1 (en) Bluetooth device connection method and terminal device
WO2019007371A1 (en) Method for preventing information from being stolen, storage device, and mobile terminal
US20200004578A1 (en) Method for fingerprint recognition and related products
WO2014032250A1 (en) Method and device for controlling central processing unit
WO2015074387A1 (en) Sliding operation response method, apparatus and terminal device
WO2019128571A1 (en) Resource management method and device, mobile terminal, as well as computer readable storage medium
WO2015062234A1 (en) Mobile terminal resource processing method, device and apparatus
WO2017206860A1 (en) Processing method of mobile terminal and mobile terminal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14767942

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 01.02.2016)

122 Ep: pct application non-entry in european phase

Ref document number: 14767942

Country of ref document: EP

Kind code of ref document: A1