METHOD AND DEVICE FOR OBTAINING STARTING-UP TIME

Disclosed are a method and device for obtaining starting-up time, relating to the technical field of computer. The method for obtaining starting-up time comprises: obtaining a first time quantum and a second time quantum, processes corresponding to a boot program in the first time quantum being all spaced by the time of established moment, and the usage rates of the Central Processing Unit (CPU) within preset time in the second time quantum being all lower than a preset threshold value; and judging whether a program is run within the second time quantum by a user, and if so, obtaining the starting-up time according to the first time quantum, the second time quantum and a preset error factor. The present invention improves accuracy of the starting-up time.

TECHNICAL FIELD

The present invention relates to computer technology, and particularly relates to a method and apparatus for obtaining boot time.

BACKGROUND ART

In the process of the user computer, the length of the computer boot time directly affects the user experience, so the user needs the system optimization processing in a timely manner according to the acquired boot time; start time wherein the computer is a computer from the start-up time to start fully loaded program completion time intervals.

The prior art, when the computer start-up, the program detected by the registry or file registered in the corresponding boot program to determine whether the process is to create a start-up is completed, when the boot program all registered in the registry or file after the corresponding process have been created, the computer (app l icat ion programming Interface, application programming Interface) function to obtain the time of the acquisition time by the runtime system API, thereby acquiring start time of the computer.

However, start-up services corresponding processes are being created does not mean start the program have all been loaded, so the method to obtain start-up time of the computer all the time from the start of the loaded program that the user can use the computer as well as normal period of time, reducing the accuracy of the computer boot time.

SUMMARY

In order to improve the accuracy of the boot time, the embodiment of the present invention provides a method and apparatus for obtaining boot time. The technical solutions are as follows:

One kind of boot time acquisition method, comprising:

Obtaining a first time period and the second period, the first period of time wherein the boot program corresponding to the process are created, the second time period within the predetermined time the central processor CPU utilization rate below a predetermined set threshold;

Said second time period determines that the user program is running, if, according to the first time period, the second time period and a preset error factor acquisition start time.

One kind of boot time acquisition device comprising:

Mo ^ eligible ear block for obtaining a first time period and second time period, wherein said first period of time corresponding to the boot process program are created, the second time period within the predetermined time the central processing device CPU use rate lower than a preset threshold;

Determination processing means for determining whether a user of said second period of time to run the program, if it is, according to the first time period, the second time period and a preset error factor acquisition start time.

Technical solutions provided by the embodiments of the present invention is beneficial effects: obtaining a first time period and the second period, the second time period when the user runs the program, according to the first time period, the second time period and a preset error factor acquisition starting time, the present embodiment considers the influence of the second time period associated with the user operation or the like factors during the boot process to boot time accuracy, as compared to the prior art only the first as the period of time in terms of power, according to the present embodiment, the first time period, a second period and a predetermined accuracy error factor acquisition increased boot time.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to more clearly illustrate the technical solutions in the embodiments of the present invention, briefly describes the accompanying drawings required for describing the embodiments used in the following embodiments will be apparent in the following description of the accompanying drawings are merely some embodiments of the present invention, for ordinary skill in the art, without creative efforts, you can obtain other drawings based on these drawings.

FIG 1 is a flowchart illustrating an embodiment of a method of obtaining a starting time according to an embodiment of the present invention; FIG. 2 is a flowchart of an embodiment of a method of obtaining start time according to the second embodiment of the present invention is provided; FIG. 3 is present a first configuration example of an apparatus for obtaining start time Example 3 provides a schematic view of the embodiment of the invention;

FIG 4 is a schematic structural diagram of a second embodiment of an apparatus for obtaining start time Example 3 of the present embodiment of the invention is provided;

FIG 5 is a diagram showing the structure of a third embodiment of an apparatus for acquiring 3 boot time according to an embodiment of the present invention;

FIG 6 is a schematic structural diagram of a fourth embodiment of an apparatus for obtaining start time Example 3 of the present embodiment of the invention is provided; FIG. 7 is a schematic structural diagram of a fifth embodiment of an apparatus for acquiring 3 boot time according to an embodiment of the present invention.

DETAILED DESCRIPTION

The present embodiment provides a method and apparatus for obtaining boot time.

To make the objectives, technical solutions, and advantages of the present invention will become apparent in conjunction with the accompanying drawings of the following embodiments of the present invention will be described in further detail.

Example 1

Referring to FIG 1, FIG. 1 is a flowchart of an embodiment of the method of obtaining one kind of start time according to an embodiment of the present invention is provided; start time of the acquisition method comprising:

S 101: obtaining a first time period and the second period, the first period of time wherein the boot program corresponding process have been created, said second predetermined period of time within a central processing unit CPU utilization rate below a preset threshold.

In this step, the first time the time period from the time of boot program to boot the corresponding process intervals are created; the second period of time starting from the time power to the CPU usage is below the predetermined time threshold time interval, wherein the CPU usage is below the CPU utilization rate within the predetermined time before the preset threshold is lower than a preset time threshold, i.e. when the duration is below a preset threshold CPU usage status reaches a preset time, at this time as the end time of the second time period, the time of the boot as a starting point a second time period, only to obtain a second time period, e.g., at 10:00:00 boot, the boot time is 10:00:00, as the predetermined time is 5 seconds, when it is determined at 10:00:15 to 10:00 20 seconds during this time CPU utilization rate is lower than the preset threshold, then 10:00:20 4 Di as CPU utilization threshold to the predetermined time, this time, the second period of 10:00 time period between 00 seconds to 10:00:20.

S 102: determining whether the user of the second period of time to run the program, if it is, according to the first time period, the second time period and a preset error factor acquisition start time.

Preferably, the user determines whether to run the program in the second time period comprises: determining the time between a start time corresponding to the program to start the process have been created and the CPU usage is below a predetermined threshold if a new process is created.

Preferably, the boot program corresponding to the determination process are created and the time

Is there a time between CPU usage falls below a preset threshold of a new process is created, including: through all the processes of the second time period;

Determine whether there is a new process created after the time of the boot program corresponding processes are being created all the processes. The new process created after the time of creation are included:

The process of obtaining all the power on the new process created after the program start time corresponding processes are created;

Determining whether the new process identity PID of the parent process is the process or the Explorer icon management software processes.

Preferably, the determining whether a boot between the boot program corresponding to the process time are created and the time of usage is below a predetermined threshold value the new process is created by the CPU comprising:

The boot program corresponding to the process time are created, the process of creating a first snapshot; time the CPU usage is below a predetermined threshold, the process of creating a second snapshot;

Whether there is a new process other than the first process in the process of determining the snapshot and the second snapshot process.

Preferably, the second process determines the presence of the new snapshot processes except the first process snapshot process comprising:

The process of obtaining the second snapshot new process other than the first process snapshot process; determining whether the new process is the parent PID Process Explorer icon management software or process. Preferably, said second time period determines that the user is running the program comprising: obtaining a second period of time the parent PID all processes;

Determining whether the parent PID is the Explorer icon process or process management software.

Preferably, said second time period determines that the user is running the program comprising: obtaining a time the user clicks a mouse;

Between time determining whether the user clicks the mouse at the time of start-up procedures for the corresponding processes are created time and the CPU usage falls below a preset threshold.

Preferably, before the according to the first time period and said second time period preset error factor acquisition starting time, further comprising:

Determining whether the difference between the second period and the first time period is greater than a predetermined value;

Accordingly, according to the the first time period, the second time period and the start time preset error factor acquisition specifically is: the difference between the second time period and if the first time period is greater than the pre- set value, according to the first time period, the second time period and a preset error factor acquisition boot time, comprising:

The difference with a predetermined error factor of the second period and the first period is multiplied by the estimated error generation time;

The first period of time and adding the estimated error to generate boot time.

Preferably, the method further comprising:

If the user is not running the program in a second time period, the second time period as the start time.

Alternatively, if the user runs the program a second time period, and when the difference between the second period and the first time period is less than the predetermined value, the second time period as the start time.

In this embodiment, the first acquisition period and the second period, the second time period when the user runs the program, according to the first time period, the second time period and a preset error factor acquisition starting time , the present embodiment considers the influence of the second time period associated with the user operation or the like factors during the boot process to boot time accuracy, as compared to the prior art only in terms of a first time period as the start time, the present embodiment the embodiment of the first time period, a second period and a predetermined accuracy error factor acquisition increased boot time. Example 2

Referring to FIG 1, FIG 2 is a flowchart of an embodiment of a method of obtaining start time provided by Example 2 of the present embodiment of the invention; terminal in the present embodiment may be a computer, but is not limited to this;

The start time acquiring method comprising:

S201: terminal obtains a first time period and second time period.

In this step, obtaining a first time period and the prior art method is similar to, not be described herein, wherein said first period of time the terminal are created from time to boot the boot program corresponding to the timing of the process time interval.

When the terminal startup, program monitoring CPU (Centra l Process ing Uni t, central processing unit) utilization terminal by polling mode, if the preset time is detected by the CPU use rate lower than a preset threshold value , then that end of the boot, the terminal acquires time below a predetermined threshold CPU usage by acquiring runtime system API function, so as to obtain a second time period; wherein said second time period is from the boot of time before the time to the CPU usage is below a predetermined threshold time interval, the CPU usage is below a predetermined threshold time of the CPU utilization rate within the preset time is less than the pre- set threshold; the second time period is greater than said first time period.

Wherein said predetermined time, the predetermined threshold may be set by a program developer, and is not particularly limited, for example, the predetermined time is 5 seconds, the preset threshold is 5%, but not limited.

Time present embodiment, the first period of time can also be used to replace a third time, wherein the third time is the time from start-up to detect Explorer. Exe start completion (i.e., complete desktop display) of the time interval, or the first time period may also be replaced by a fourth time, wherein the fourth time period starting from the time of completion of the start-up process to the service interval is detected.

S202: the user terminal determines whether a second period of time to run the program, such as whether Gao, S203 execution, such as Gao is performed S204.

In this step, the user terminal determines whether a time period in the second run the program comprising: a terminal determines the time corresponding to the start-up program processes are created and the CPU usage is below a predetermined threshold of time between whether a new process is created.

Between the time wherein the boot program if the corresponding process are created and the time the CPU usage is below a predetermined threshold of the new process is created, the user has performed the second time period the program.

Wherein, the terminal can be created according to the progress of time to determine whether there is a time between the start-up procedure corresponding process have been created and the time the CPU usage is below a predetermined threshold value a new process is created, in particular, when the after start-up terminal, the terminal records the program start time corresponding to the boot process are created timestamp corresponding ^^ ^ ‘^^ n, then the preset time when the CPU utilization rate is lower than the preset after the threshold value, the second period of time traversing all the processes, it is determined whether there is a new process Sta r tupTiim Aut Stamping created after all processes, the new process is considered to start after a start-up manually by the user process.

Preferably, the process of determining the presence or absence of all ^ tort: Ρ 77 “^ – » “P m ^ ‘^ new process is created after the timestamp comprises the process of obtaining the all 1 ^^.” the new process created after the time stamp; the process of determining whether the new parent PID (Proces s Ident i fy, the process of identity) whether the Explorer icon process Explorer exe or process management software, and if so, it means the new. process for the user to manually start the boot process the icon management software process for the third-party programs, such as Q +, QQ Desktop and other procedures; the icon management software process may be stored in the form or whitelist, the terminal may #. a snapshot of the process both time points before and after the ranking to determine whether there is time between the start-up procedures for the corresponding processes are being created and time usage is below a preset threshold of the CPU new process is created, in particular, after the start-up terminal, the terminal program at boot time of the corresponding process are created, the process of creating a first snapshot; pre-terminal in the CPU usage below Time threshold, the process of creating a second snapshot; whether there is a new process other than the first process in the process of the snapshot terminal determines the second snapshot process, the new process is considered to be after the start-up manually by the user the process started.

Preferably, the second process determines whether there is a snapshot of a new process other than the first process snapshot process comprising: obtaining a new snapshot of the second process than the first process in addition to the snapshot process process; the process of determining whether the new parent PID is whether the Explorer icon process or process management software, and if so, it means that the new process for the user to manually start the boot process. The icon for the third-party process management software programs, such as Q +, QQ Desktop and other procedures.

In this embodiment, the user terminal may further comprise determining whether operation of the second time period in the program:

Obtaining the second period of the parent PID of all the processes; determining whether the parent PID is the Explorer icon process or process management software.

Specifically, the injection period of ready detection code to the system via API HOOK (hooks) technology. When boot terminal, a process is created before any are performed before the code injection detection system, and the current PID of the parent process is recorded in the detection code; then the terminal determines whether the PID of the parent resource manager process Explorer, exe icon management software or process, if it is, then that boot stage users to manually run the relevant procedures.

Or get the user clicks the mouse time; determining whether the user clicks the mouse’s time is the time to start the boot process corresponding to the program have been created and the time between CPU usage is below the preset threshold.

Specifically, the terminal user is acquired by clicking the mouse to the time the operating system registration message global hook, and then determined using the user clicking the mouse at the time whether the time corresponding to the boot program have been created and the process of the CPU between the time the rate is lower than the preset threshold, and if so, think boot stage users to manually run the relevant procedures.

S203: terminal, the second time period as the start time.

If the user is not running the program in a second period of time, i.e. during start-up from the terminal to all the boot program loaded in the user program is not running or related operations, then at this time the second time period It is the precise terminal boot time. After the completion of the terminal boot, officially entered the normal use of the computer state that the computer’s CPU, memory and other free resources can be assigned user state manually start the process.

If a user runs the program in the second period, and the difference between the second period and the first time period is less than the preset value, the terminal may start a second period of time. For example, the default value is 5 seconds, the second time period and the small difference between the first time period is one second, then even if the user is detected in the second period of the operating program, then the program has little effect on the boot, is negligible, so you can still talk about the second period as the start time. Wherein the predetermined value can be set manually, it can be calculated automatically according to the corresponding algorithm, which is not particularly limited.

S204: the terminal determines whether a difference between the first period and the second period is greater than a predetermined value, and if not, performing S203, if yes, S205.

If a user runs in the second period of the program, the terminal that is to start during the startup program loaded in all the user runs a program or related operations, then the time is not the second time period the exact start time, because the program will be preempted by a user to run the computer’s resources, thereby delay the start of the program start time to complete, and therefore the exact start time should be located in the second time period of said first time period and between.

When a user in the second period of the operating program, the terminal needs to judge the difference between a first time period and said second time period is greater than a preset value, the corresponding subsequent processing according to the determination result obtain accurate boot time.

S205: The terminal of the first period, a second period and a preset error factor acquisition boot time.

In this step, when the user runs the program in the second period and the second time period and the difference between the first time period is greater than a predetermined value, obtain accurate power terminal according to the following two formulas time;

 

Shows the first time period, 7 ^^ ^ 6 – represents the second period of time, “terra / represents the difference between the second period and the first time period, the ctor ^ represents a predetermined error factor. For example, assume a first period of time is 35 seconds, the second time period is 40 seconds, f actor of 0.2, according to the above equation (1) (2) and the calculated apparent, startupTime _ Final boot time of 36 seconds.

f actor parameter may be determined according to the size of Interval. Under normal circumstances, I represent all run from the moment the program starts from the start of the system to smooth the time. The more customers start running the program, the more steady state system long time used, ^ v ^ will increase the overall value, the smaller the value of f actor; for the larger value indicates a user operation which led to the boot the larger the delayed start completion time, a value that is larger by a user of the influence, the value should be as small fi ^ °. Conversely, if the smaller the value of ^ erw ^, the larger value, because a user operation toerraZ smaller the smaller the resulting delayed start-up completion time, i.e. erra / value smaller by user influence, then f value should be greater actor.

Factor parameters can be introduced up to a certain extent when the boot program in addition to the interference user to manually run the boot time, the boot time so that the accuracy is improved.

For example, the present embodiment to the preset threshold is defined as the time stamp StartupTime Aut StartPmcess 50% as an example to describe the relationship between the factor and Nerval, particularly in table 1.

Table 1

 

Table 1 name just one example only, the correspondence relationship with factor I l embodiment of the present embodiment is not limited to Table 1, the developer may also be preset width value according to the actual situation and the correspondence between the corresponding factor adjustment, which is not – enumeration.

In this embodiment, the first acquisition period and the second period, the second time period when the user runs the program, according to the first time period, the second time period and a preset error factor acquisition starting time , the present embodiment considers the influence of the second time period associated with the user operation or the like factors during the boot process to boot time accuracy, as compared to the prior art only in terms of a first time period as the start time, the present embodiment the embodiment of the first time period, a second period and a predetermined accuracy error factor acquisition increased boot time. Program, for subsequent use. cto / “parameter is introduced up to a certain extent in addition to manual operation of the user program disturbance during boot time to boot, the boot time so that improved accuracy of Example 3

Referring to FIG 3, FIG. 3 is a schematic structural diagram of a first embodiment of the apparatus according to obtain one kind of boot time provided in the embodiment 3 of the present invention; acquisition device described in the present embodiment the boot time may be a terminal, specifically may be a computer, but not limited to this.

The start time acquiring means comprises:

4 Mo eligible ear block 301, for obtaining a first time period and second time period, wherein said first period of time corresponding to the boot process program are created, the center of a second predetermined time period processor CPU usage rate is lower than the preset threshold.

Determining a processing module 302 configured to determine whether the user is running in the second period of the program, such as Gao, in accordance with the first time period, the second time period and a preset error factor acquisition boot time.

Wherein said judgment processing module 302 includes: a first judging sub-module 3021;

If a new process is created the first time between the time determining submodule 3021, configured to determine the start-up procedure corresponding process have been created and the CPU usage is below a predetermined threshold.

The first determination sub-module 3021 and 30211 traversal unit comprises a first judging unit 30212, as shown in FIG. 4, FIG. 4 is a schematic structural diagram of a second embodiment of the present invention an apparatus embodiment according to obtain one kind of boot time provided 3;

The traversal unit 30211, configured to traverse all the processes of the second time period; the first determining unit 30212, configured to determine whether there is a program corresponding to all processes of the boot process are created the new process after time.

Wherein the first determination unit 30212 comprises:

Acquiring a first sub-unit, configured to obtain the new process after all the processes in the corresponding program start time to start the process have been created;

Determining whether the first sub-unit, for determining whether the new process identity PID of the parent process is the process or the Explorer icon management software processes.

Another embodiment of the present embodiment, the first determination sub-module 3021 includes: a first creating unit 30213, a second creation unit 30214 and a second judging unit 30215, as shown in FIG. 5, FIG. 5 is an embodiment of the present invention the third embodiment of the structure of a boot time of Example 3 provides a schematic diagram of the acquisition means; a first creating unit 30213, configured to boot the boot program corresponding to the process time are created, the process of creating a first snapshot;

A second creating unit 30214, the CPU usage for ^ Di to a preset time threshold, the process of creating a second snapshot;

The second judging unit 30215, whether there is a new process other than the first process in the process of determining the snapshot and the second snapshot process.

Wherein the second judging unit 30215 comprises:

Second obtaining sub-unit, configured to obtain the second snapshot process a new process other than the first process in the process of the snapshot;

Second determining sub-unit, for determining whether the new process is the parent P ID Explorer icon management processes or software processes.

Another embodiment of the present embodiment, the determination processing module 302 may include: a first obtaining sub-module 3022 and a second determining sub-module 3023, shown in FIG. 6, FIG. 6 is an embodiment of the present invention provides 3 species boot time acquiring means schematic structural diagram of a fourth embodiment;

The first obtaining submodule 3022, configured to obtain the second period of the parent PID all processes; the second determining sub-module 3023, configured to determine whether the parent P ID is the resource manager processes or prison standard software process management.

Another embodiment of the present embodiment, the determination processing module 302 includes: a second obtaining sub-module 3024 and a third judging sub-module 3025, as shown in FIG. 7, FIG. 7 is an embodiment of the present invention to provide 3 a fifth configuration example of the boot time acquiring means schematic embodiment;

Obtaining a second sub-module 3024, the user clicks the mouse for acquiring time;

Determining the time between the third sub-module 3025, configured to determine whether the user clicking the mouse at the time are created boot program corresponding to the process time and the CPU usage is below a predetermined threshold .

On the basis of all of the above-described embodiment, the apparatus further comprising:

Determination means for obtaining prior to the start time in accordance with the first time period, the second time period and the preset error factor, determining the difference between the second period and the first time period is greater than default value;

Accordingly, the determination processing module 302 includes:

Obtaining sub-module, a difference is greater than the preset value if the second period and the first time period, according to the first time period, the second time period and the preset power error factor acquisition time; wherein the obtaining sub-module comprises:

Error time generating unit for multiplying the difference with a predetermined error factor of the first period and the second period, generating the estimation error time; start time generating means, for the first time period and adding the estimated time error, generating boot time.

In another embodiment of the present embodiment, the start time acquiring module acquiring means comprises

Base 301 and the determination processing module 302 further comprises: a first generating module or a second generation module; the first generating means for a second period of time if the user is not running the program, in the second period of time as the start time.

or,

The second generation module is configured to run the program if the user is in the second period, and when the difference between the second period and the first time period is less than the preset value, said first two time periods as boot time.

In this embodiment, the first acquisition period and the second period, the second time period when the user runs the program, according to the first time period, the second time period and a preset error factor acquisition starting time , the present embodiment considers the influence of the second time period associated with the user operation or the like factors during the boot process to boot time accuracy, as compared to the prior art only in terms of a first time period as the start time, the present embodiment the embodiment of the first time period, a second period and a predetermined accuracy error factor acquisition increased boot time. Program, for subsequent use. introducing ctor parameters up to a certain extent in addition to manual operation of the user program disturbance during boot time to boot, the boot time so that accuracy is improved. It is noted that, in this specification, various embodiments are described in a progressive way, differences from the embodiment and the other embodiments each of which emphasizes embodiment, the same or similar portions to each other between the respective embodiments Referring i.e. can. For the device class of embodiments, since the embodiment which is substantially similar method, it is relatively simple description, see Methods section of Example place related to embodiments described.

Incidentally, herein, relational terms such as first and second and the like are only used to distinguish one entity or operation from another entity or operation separate, without necessarily requiring or implying these entities or operations of between the presence of any such actual relationship or order. Further, the term “comprising”, “containing” or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, article, or apparatus not include only those elements but not expressly listed further comprising the other elements, or further comprising such process, method, article, or apparatus inherent elements. Without more constraints, by the wording “include a ……” defined does not exclude the existence of additional identical elements in the element comprising a process, method, article, or apparatus.

Those of ordinary skill in the art may understand that the above embodiments all or part of the steps may be implemented by hardware, by a program instruction may be relevant hardware, the program may be stored in a computer-readable storage medium, the above-described storage medium may be a read-only memory, magnetic or optical disk.

The above are only preferred embodiments of the present invention, not intended to limit the present invention, any modifications within the spirit and principle of the present invention, the, equivalent substitutions, improvements should be included in the protection of the present invention within range.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *