WO2013123815A1 - 一种开机时间的获取方法及装置 - Google Patents

一种开机时间的获取方法及装置 Download PDF

Info

Publication number
WO2013123815A1
WO2013123815A1 PCT/CN2012/087636 CN2012087636W WO2013123815A1 WO 2013123815 A1 WO2013123815 A1 WO 2013123815A1 CN 2012087636 W CN2012087636 W CN 2012087636W WO 2013123815 A1 WO2013123815 A1 WO 2013123815A1
Authority
WO
WIPO (PCT)
Prior art keywords
time
time period
created
determining
booting
Prior art date
Application number
PCT/CN2012/087636
Other languages
English (en)
French (fr)
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 腾讯科技(深圳)有限公司
Priority to BR112013033103A priority Critical patent/BR112013033103A2/pt
Publication of WO2013123815A1 publication Critical patent/WO2013123815A1/zh

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

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for acquiring a boot time. Background technique
  • the length of the computer boot time directly affects the user's experience. Therefore, the user needs to optimize the system according to the obtained boot time; wherein the boot time of the computer is from the booting time to the startup. The time interval at which the program is fully loaded.
  • the program determines whether the booting is completed by detecting whether the process corresponding to the booting program registered in the registry or the file is created, when all the booting programs registered in the registry or the file are completed. After the corresponding process is created, the computer obtains the time of the moment by acquiring the API (Application Programming Interface) function of the system running time, thereby obtaining the booting time of the computer.
  • API Application Programming Interface
  • the process corresponding to the startup service does not mean that the startup program has been completely loaded, so the startup time of the computer obtained by the method is the time from the completion of the startup of the startup program, that is, the time when the user can normally use the computer. For a while, the accuracy of the computer's boot time is reduced.
  • an embodiment of the present invention provides a method and an apparatus for acquiring a boot time.
  • the technical solution is as follows:
  • a method for obtaining boot time including:
  • a device for acquiring boot time comprising:
  • the determining processing module is configured to determine whether the user runs the program during the second time period, and if yes, obtain the boot time according to the first time period, the second time period, and a preset error factor.
  • the technical solution provided by the embodiment of the present invention has the following beneficial effects: obtaining a first time period and a second time period, when the user runs the program in the second time period, according to the first time period, the second time
  • the time period and the preset error factor obtain the boot time.
  • the influence of the second time period and the related operation of the user during the booting process on the accuracy of the boot time is comprehensively considered, and the first one is compared with the prior art.
  • the time period as the power-on time is improved, and the accuracy of the boot time obtained according to the first time period, the second time period, and the preset error factor in the embodiment is improved.
  • FIG. 1 is a flowchart of an embodiment of a method for acquiring boot time according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of an embodiment of a method for acquiring boot time according to Embodiment 2 of the present invention
  • FIG. 4 is a second schematic structural diagram of an embodiment of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention.
  • FIG. 5 is a schematic diagram of a third structure of an embodiment of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention.
  • FIG. 6 is a fourth schematic structural diagram of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention
  • FIG. 7 is a fifth schematic structural diagram of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention.
  • This embodiment provides a method and an apparatus for acquiring a boot time.
  • FIG. 1 is a flowchart of an embodiment of a method for acquiring a boot time according to Embodiment 1 of the present invention
  • S101 Obtain a first time period and a second time period, where a process corresponding to the booting process in the first time period is created, and a CPU usage of the central processing unit is preset in the second time period. Below the preset threshold.
  • the first time period is a time interval from a time when the power is started to a time when the process corresponding to the power-on startup program is created;
  • the second time period is from a time when the power is started to when the CPU usage is lower than a time interval of the preset threshold, wherein the CPU usage in the preset time before the moment when the CPU usage is lower than the preset threshold is lower than a preset threshold, that is, When the CPU usage rate is lower than the preset threshold, the duration reaches the preset time, and the time at this time is used as the end time of the second time period, and the time when the power is started is used as the starting time of the second time period.
  • the second time period is obtained.
  • the time for starting the power is 10:00:00, and if the preset time is 5 seconds, then it is determined at 10:00:15.
  • the CPU usage is lower than the preset threshold, then 10:00:20 is used as the CPU usage rate 4 at the preset threshold.
  • the second The time period is 10:00:00 to 10:00. Time period between 0 minutes and 20 seconds.
  • S102 Determine whether the user runs the program in the second time period, and if yes, obtain the boot time according to the first time period, the second time period, and a preset error factor.
  • the determining whether the user runs the program in the second time period comprises: determining between a time when the process corresponding to the power-on startup program is created and a time when the CPU usage rate is lower than a preset threshold Is there a new process being created?
  • the determining the time when the process corresponding to the booting process is created and the
  • Whether a new process is created between the moments when the CPU usage is lower than the preset threshold includes: Traversing all processes within the second time period;
  • New processes created after the moment of being created include:
  • Determining whether the parent process identity of the new process PID is a resource manager process or an icon management software process.
  • whether a new process is created between determining a time when the process corresponding to the booting process is created and a time when the CPU usage is lower than a preset threshold includes:
  • the determining, by the second process snapshot, whether a new process other than the process in the first process snapshot exists :
  • the determining whether the user runs the program in the second time period comprises: acquiring a parent PID of all processes in the second time period;
  • the determining whether the user runs the program in the second time period comprises: acquiring a time when the user clicks the mouse;
  • Determining whether the time when the user clicks the mouse is between a time when the process corresponding to the booting process is created and a time when the CPU usage is lower than a preset threshold.
  • the method before the obtaining the boot time according to the first time period, the second time period, and the preset error factor, the method further includes:
  • the obtaining the booting time according to the first time period, the second time period, and the preset error factor is specifically: If the difference between the second time period and the first time period is greater than the preset value, obtaining a boot time according to the first time period, the second time period, and a preset error factor, including:
  • the first time period and the estimated error time are added to generate a boot time.
  • the method further includes:
  • the second time period is taken as the power-on time.
  • the second time period is taken as the power-on time.
  • the first time period and the second time period are obtained.
  • the boot time is obtained according to the first time period, the second time period, and a preset error factor.
  • the influence of the second time period and related operations of the user during the booting process on the accuracy of the booting time is comprehensively considered.
  • the implementation In the example, the accuracy of the boot time obtained according to the first time period, the second time period, and the preset error factor is improved.
  • FIG. 2 is a flowchart of a method for acquiring a boot time according to Embodiment 2 of the present invention
  • the terminal in this embodiment may be a computer, but is not limited thereto;
  • the method for obtaining the boot time includes:
  • S201 The terminal acquires the first time period and the second time period.
  • the first time period is the time when the terminal is started from the time when the terminal is started and the process corresponding to the booting program is created. time interval.
  • the program monitors the CPU (Centra Process ing Unit) usage rate by polling, and if the CPU usage is lower than the preset threshold within the preset time.
  • the terminal acquires the time when the CPU usage rate is lower than the preset threshold by acquiring the API function of the system running time, thereby acquiring the second time period; wherein the second time period is started from the booting time. a time interval to a time when the CPU usage rate is lower than a preset threshold, and the CPU usage in the preset time before the time when the CPU usage rate is lower than a preset threshold The rate is lower than the preset threshold; the second time period is greater than the first time period.
  • the preset time and the preset threshold may be set by a program developer, and is not specifically limited herein.
  • the preset time is 5 seconds
  • the preset threshold is 5%, but Limited to this.
  • the first time period may also be replaced by a third time, where the third time is the time from the start of the boot to the time when the Explorer.exe startup is completed (ie, the desktop display is completed) is detected.
  • the interval may be replaced by a fourth time, where the fourth time is a time interval from a time when the power is turned on to a time when the start of the service process is detected to be completed.
  • S202 The terminal determines whether the user runs the program in the second time period. If no, execute S203. If yes, execute S204.
  • the terminal determines whether the user runs the program in the second time period, and includes: determining, by the terminal, a time when the process corresponding to the power-on startup program is created, and a time when the CPU usage rate is lower than a preset threshold. Is there a new process being created?
  • the terminal may determine, according to the process creation time, whether a new process is created between the time when the process corresponding to the booting process is created and the time when the CPU usage rate is lower than a preset threshold, specifically, when After the terminal is powered on, the terminal records the timestamp corresponding to the time when the process corresponding to the booting process is created, ⁇ ' ⁇ n, and then the CPU usage is lower than the preset in the preset time. 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.
  • the new process created after the time stamp comprises: obtaining the 1 ⁇ " ⁇ 77 " ⁇ ——» in all the processes. a new process created after the timestamp; determining whether the parent PID of the new process (Proces s Ident i fy, process identity) is a resource manager process Explorer.exe or an icon management software process, and if so, indicating the new process
  • the process is a process initiated manually by the user after the booting.
  • the icon management software process is a third-party program, such as a program such as Q+, QQ desktop, etc.; the icon management software process can be stored in a white list.
  • the terminal can determine whether there is a new process between the time when the process corresponding to the booting process is created and the time when the CPU usage is lower than the preset threshold. Creating, specifically, when the terminal is powered on, the terminal creates a snapshot of the first process at a time when the process corresponding to the booting process is created; and the terminal creates the time when the CPU usage is lower than a preset threshold. The second process snapshot; the terminal determines whether there is a new process other than the process in the first process snapshot in the second process snapshot, and the new process is considered to be a process manually started by the user after the booting.
  • the determining, by the second process snapshot, that a new process other than the process in the first process snapshot includes: acquiring, in the second process snapshot, a new process other than the process in the first process snapshot
  • the process determines whether the parent PID of the new process is a resource manager process or an icon management software process. If yes, it indicates that the new process is a process manually started by the user after the booting.
  • the icon management software process is a third-party program, such as a program such as Q+, QQ desktop.
  • the determining, by the terminal, whether the user runs the program in the second time period may further include:
  • a ready-to-use detection code is injected into the system via API HOOK technology.
  • any detection process of the injection system is executed before any process is created, and the parent PID of the current process is recorded in the detection code; then the terminal determines whether the parent PID is a resource manager process.
  • Explorer, exe or icon management software process if it is, it is considered that the user has manually run the relevant program during the booting phase.
  • obtaining a time when the user clicks the mouse determining whether the time when the user clicks the mouse is between a time when the process corresponding to the booting process is created and a time when the CPU usage is lower than a preset threshold.
  • the terminal obtains the time when the user clicks the mouse by registering the global message hook with the operating system, and then determines whether the time when the user clicks the mouse is used at the time when the process corresponding to the booting program is created and the CPU is used. If the rate is lower than the preset threshold, if it is, it is considered that the user has manually run the relevant program during the startup phase.
  • S203 The terminal uses the second time period as the boot time.
  • the second time period at this time is the precise boot time of the terminal. After the terminal completes the booting, it officially enters the normal use of the computer state, that is, the computer's CPU, memory and other idle resources can be assigned to the user to manually start the process state.
  • the terminal may use the second time period as the power-on time.
  • the preset value is 5 seconds, and the difference between the second time period and the first time period is small, when it is 1 second, even if it is detected that the user runs in the second time period Program, then this program has little effect on booting, can be ignored, so you can still talk about the second time period as boot time.
  • the preset value may be manually set, or may be automatically calculated according to the corresponding algorithm, and is not specifically limited herein.
  • S204 The terminal determines whether the difference between the second time period and the first time period is greater than a preset value. If no, execute S203, and if yes, execute S205.
  • the second time period is not Accurate boot time, because the program run by the user will seize the resources of the computer, thus delaying the startup time of the startup program, so the precise boot time should be located in the first time period and the second time period. between.
  • the terminal After the user runs the program in the second time period, the terminal further needs to determine that the difference between the second time period and the first time period is greater than a preset value, and perform corresponding subsequent processing according to the determination result. Get accurate boot time.
  • S205 The terminal acquires a boot time according to the first time period, the second time period, and a preset error factor.
  • the terminal obtains an accurate power-on according to the following two formulas. time;
  • the first time period is shown, ⁇ 7 ⁇ 6 - represents the second time period, "terra / represents the difference between the second time period and the first time period, ⁇ ctor represents a preset error factor. For example, suppose the first time period is 35 seconds, the second time period is 40 seconds, and the f actor is 0. 2 , according to the above formulas (1) and (2) The calculation shows that the boot time StartupTime_Final is 3 6 seconds.
  • the f actor parameter can be determined based on the size of the Interval.
  • I represents the time from when the start-up program is started to when the system runs smoothly.
  • the value of ⁇ v ⁇ will be larger and larger, and the value of the f actor will be smaller.
  • the larger the value the higher the value due to user operation.
  • the introduction of the factor parameter can remove the interference of the program manually run by the user at the booting time to the boot time to a certain extent, so that the accuracy of the boot time is improved.
  • the corresponding threshold value is defined as 50 % of the StartupTime Aut StartPmcess timestamp as an example to describe the correspondence between Nerval and factor. For details, refer to Table 1.
  • Table 1 is only an example. In this embodiment, the correspondence between I and factor is not limited to Table 1.
  • the developer may also correspondingly determine the preset threshold and the corresponding relationship with the factor according to the actual situation. Adjustment, no longer here - enumeration.
  • the first time period and the second time period are obtained.
  • the boot time is obtained according to the first time period, the second time period, and a preset error factor.
  • the influence of the second time period and related operations of the user during the booting process on the accuracy of the booting time is comprehensively considered.
  • the implementation In the example, the accuracy of the boot time obtained according to the first time period, the second time period, and the preset error factor is improved.
  • Program for later use. The introduction of the cto/ "parameters also removes the interference of the program manually run by the user during the startup on the boot time to a certain extent, so that the accuracy of the boot time is improved.
  • FIG. 3 is a schematic diagram of a first structure of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention.
  • the apparatus for acquiring the boot time in the embodiment may be a terminal, specifically a computer, but Not limited to this.
  • the device for acquiring the boot time includes:
  • An ear 301 is configured to obtain a first time period and a second time period, wherein a process corresponding to the booting process in the first time period is created, and the second time period is in a preset time
  • the processor CPU usage is below the preset threshold.
  • the determining processing module 302 is configured to determine whether the user runs the program in the second time period, for example, obtaining the booting time according to the first time period, the second time period, and a preset error factor.
  • the determining processing module 302 includes: a first determining submodule 3021;
  • the first determining sub-module 3021 is configured to determine whether a new process is created between a time when the process corresponding to the booting process is created and a time when the CPU usage is lower than a preset threshold.
  • the first judging sub-module 3021 includes a traversing unit 30211 and a first judging unit 30212.
  • FIG. 4 is a second schematic structural diagram of an apparatus for acquiring a boot time according to Embodiment 3 of the present invention.
  • the traversing unit 30211 is configured to traverse all the processes in the second time period; the first determining unit 30212 is configured to determine whether the processes corresponding to the booting program are all created in the all processes. New process after the moment.
  • the first determining unit 30212 includes:
  • a first acquiring subunit configured to acquire a new process after the time when the processes corresponding to the booting process in the all processes are created
  • the first determining subunit is configured to determine whether the parent process identifier of the new process is a resource manager process or an icon management software process.
  • the first determining sub-module 3021 includes: a first creating unit 30213, a second creating unit 30214, and a second determining unit 30215, as shown in FIG. 5, FIG. 5 is an implementation of the present invention.
  • the third structure of the embodiment of the device for obtaining the boot time is provided in the third embodiment; the first creating unit 30213 is configured to create a snapshot of the first process at a time when the processes corresponding to the booting process are all created;
  • a second creating unit 30214 configured to create when the CPU usage rate is preset to a preset threshold Second process snapshot
  • the second determining unit 30215 is configured to determine whether a new process other than the process in the first process snapshot exists in the second process snapshot.
  • the second determining unit 30215 includes:
  • a second acquiring sub-unit configured to acquire a new process in the second process snapshot other than the process in the first process snapshot
  • the second determining subunit is configured to determine whether the parent P ID of the new process is a resource manager process or an icon management software process.
  • the determining processing module 302 may include: a first obtaining sub-module 3022 and a second determining sub-module 3023, as shown in FIG. 6, FIG. 6 is a first embodiment of the present invention.
  • the first obtaining sub-module 3022 is configured to acquire a parent PID of all processes in the second time period; the second determining sub-module 3023 is configured to determine whether the parent P ID is a resource manager process or Standard management software process.
  • the determining processing module 302 includes: a second obtaining sub-module 3024 and a third determining sub-module 3025, as shown in FIG. 7, FIG. 7 is a third embodiment of the present invention.
  • the second obtaining sub-module 3024 is configured to acquire a time when the user clicks the mouse;
  • the third determining sub-module 3025 is configured to determine whether the time when the user clicks the mouse is between a time when the process corresponding to the booting process is created and a time when the CPU usage rate is lower than a preset threshold. .
  • the device further includes:
  • a determining module configured to determine, after the obtaining the booting time according to the first time period, the second time period, and the preset error factor, whether the difference between the second time period and the first time period is greater than default value
  • the determining processing module 302 includes:
  • Obtaining a submodule configured to obtain, according to the first time period, the second time period, and a preset error factor, if the difference between the second time period and the first time period is greater than the preset value Time; where the acquisition submodule includes:
  • An error time generating unit configured to multiply a difference between the second time period and the first time period by a preset error factor to generate an estimated error time;
  • the boot time generating unit is configured to add the first time period and the estimated error time to generate a boot time.
  • the acquiring device of the booting time includes an acquiring module.
  • the 301 and the judging processing module 302 further includes: a first generating module or a second generating module; the first generating module, configured to: if the user does not run the program in the second time period, the second The time period is used as the boot time.
  • the second generating module is configured to: if the user runs the program in the second time period, and when the difference between the second time period and the first time period is less than the preset value, The second time period is used as the boot time.
  • the first time period and the second time period are obtained.
  • the boot time is obtained according to the first time period, the second time period, and a preset error factor.
  • the influence of the second time period and related operations of the user during the booting process on the accuracy of the booting time is comprehensively considered.
  • the implementation In the example, the accuracy of the boot time obtained according to the first time period, the second time period, and the preset error factor is improved.
  • Program for later use. The introduction of the ctor parameter also removes the interference of the program manually run by the user during the startup period to the boot time, so that the accuracy of the boot time is improved.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

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)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)
  • Electric Clocks (AREA)

Abstract

本发明公开了一种开机时间的获取方法及装置,属于计算机技术领域。所述开机时间的获取方法包括:获取第一时间段和第二时间段,其中所述第一时间段中开机启动程序对应的进程都被创建的时刻的时间间隔,所述第二时间段中预设时间内中央处理器CPU使用率均低于预设阀值;判断用户在所述第二时间段内是否运行程序,如果是,根据所述第一时间段、所述第二时间段和预设误差因子获取开机时间。本发明提高了开机时间的精确度。

Description

一种开机时间的获取方法及装置 本申请要求于 2012 年 2 月 22 日提交中国专利局、 申请号为 2012100409705、 发明名称为 "一种开机时间的获取方法及装置" 的中国专利 申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域
本发明涉及计算机技术领域, 特别涉及一种开机时间的获取方法及装置。 背景技术
在用户使用计算机的过程中,计算机开机时间的长短直接影响用户的体验 度, 因此用户需要根据获取到的开机时间及时地对系统进行优化处理; 其中计 算机的开机时间为计算机从开机启动时刻到启动程序全部加载完成时刻的时 间间隔。
现有技术中, 当计算机开机启动时, 程序通过检测注册表或文件中注册的 开机启动程序对应的进程是否被创建来判定开机启动是否完成, 当所有在注册 表或文件中注册的开机启动程序对应的进程都被创建后,计算机通过获取系统 运行时间的 API ( App l icat ion Programming Interface,应用程序编程接口 ) 函数来获取该时刻的时间, 从而获取计算机的开机时间。
但是, 开机启动服务对应的进程都被创建并不代表着启动程序已经全部加 载完成, 因此该方法获取的计算机的开机时间距离启动程序全部加载完成的时 间, 即用户可以正常使用计算机的时间还有一段时间, 降低了计算机的开机时 间的精确度。 发明内容
为了提高开机时间的精确度, 本发明实施例提供了一种开机时间的获取方 法及装置。 所述技术方案如下:
一种开机时间的获取方法, 包括:
获取第一时间段和第二时间段, 其中所述第一时间段中开机启动程序对应 的进程都被创建, 所述第二时间段中预设时间内中央处理器 CPU使用率均低于 预设阀值;
判断用户在所述第二时间段内是否运行程序, 如果是, 根据所述第一时间 段、 所述第二时间段和预设误差因子获取开机时间。
一种开机时间的获取装置, 包括:
获耳^莫块, 用于获取第一时间段和第二时间段, 其中所述第一时间段中开 机启动程序对应的进程都被创建, 所述第二时间段中预设时间内中央处理器
CPU使用率均低于预设阀值;
判断处理模块,用于判断用户在所述第二时间段内是否运行程序,如果是, 根据所述第一时间段、 所述第二时间段和预设误差因子获取开机时间。
本发明实施例提供的技术方案带来的有益效果是: 获取第一时间段和第二 时间段, 当用户在第二时间段内运行程序时, 根据所述第一时间段、 所述第二 时间段和预设误差因子获取开机时间,本实施例中综合考虑了第二时间段和用 户在开机过程中的相关操作等因素对开机时间精确度的影响,相比较现有技术 只把第一时间段作为开机时间而言, 本实施例中根据所述第一时间段、 第二时 间段和预设误差因子获取的开机时间的精确度提高了。 附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例 1提供的一种开机时间的获取方法实施例的流程图; 图 2是本发明实施例 2提供的一种开机时间的获取方法实施例的流程图; 图 3是本发明实施例 3提供的一种开机时间的获取装置实施例的第一结构 示意图;
图 4是本发明实施例 3提供的一种开机时间的获取装置实施例的第二结构 示意图;
图 5是本发明实施例 3提供的一种开机时间的获取装置实施例的第三结构 示意图;
图 6是本发明实施例 3提供的一种开机时间的获取装置实施例的第四结构 示意图; 图 7是本发明实施例 3提供的一种开机时间的获取装置实施例的第五结构 示意图。 具体实施方式
本实施例提供了一种开机时间的获取方法及装置。
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明 实施方式作进一步地详细描述。
实施例 1
参考图 1 , 图 1是本发明实施例 1提供的一种开机时间的获取方法实施例 的流程图; 所述开机时间的获取方法包括:
S 101 : 获取第一时间段和第二时间段, 其中所述第一时间段中开机启动程 序对应的进程都被创建, 所述第二时间段中预设时间内中央处理器 CPU使用率 均低于预设阀值。
此步骤中,所述第一时间段为从开机启动的时刻到开机启动程序对应的进 程都被创建的时刻的时间间隔; 所述第二时间段为从开机启动的时刻到 CPU使 用率低于所述预设阀值的时刻的时间间隔, 其中所述 CPU使用率低于所述预设 阀值的时刻之前的所述预设时间内的 CPU使用率均低于预设阀值, 也即是当 CPU使用率低于预设阈值的状态持续的时间达到了预设时间, 将此时的时刻作 为第二时间段的终点时刻, 将开机启动的时刻作为第二时间段的起点时刻, 才 得到了第二时间段, 例如, 在 10点 00分 00秒开机, 则开机启动的时刻为 10 点 00分 00秒, 如预设时间为 5秒, 则当确定在 10点 00分 15秒至 10点 00 分 20秒这段时间内 CPU使用率均低于预设阀值,则将 10点 00分 20秒作为 CPU 使用率 4氐于所述预设阀值的时刻, 此时, 第二时间段为 10点 00分 00秒至 10 点 00分 20秒之间的时间段。
S 102: 判断用户在所述第二时间段内是否运行程序, 如果是, 根据所述第 一时间段、 所述第二时间段和预设误差因子获取开机时间。
优选地, 所述判断用户在所述第二时间段内是否运行程序包括: 判断所述开机启动程序对应的进程都被创建的时刻和所述 CPU使用率低于 预设阀值的时刻之间是否有新进程被创建。
优选地, 所述判断所述开机启动程序对应的进程都被创建的时刻和所述
CPU使用率低于预设阀值的时刻之间是否有新进程被创建包括: 遍历所述第二时间段内的所有进程;
判断所述所有进程中是否存在所述开机启动程序对应的进程都被创建的 时刻之后创建的新进程。 都被创建的时刻之后创建的新进程包括:
获取所述所有进程中所述开机启动程序对应的进程都被创建的时刻之后 创建的新进程;
判断所述新进程的父进程身份标识 PID是否是资源管理器进程或者图标管 理软件进程。
优选地, 所述判断所述开机启动程序对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间是否有新进程被创建包括:
在所述开机启动程序对应的进程都被创建的时刻, 创建第一进程快照; 在所述 CPU使用率低于预设阀值的时刻, 创建第二进程快照;
判断所述第二进程快照中是否存在除所述第一进程快照中进程之外的新 进程。
优选地, 所述判断所述第二进程快照中是否存在除所述第一进程快照中进 程之外的新进程包括:
获取所述第二进程快照中除所述第一进程快照中进程之外的新进程; 判断所述新进程的父 PID是否是资源管理器进程或者图标管理软件进程。 优选地, 所述判断用户在所述第二时间段内是否运行程序包括: 获取所述第二时间段内所有进程的父 PID;
判断所述父 PID是否是资源管理器进程或者图标管理软件进程。
优选地, 所述判断用户在所述第二时间段内是否运行程序包括: 获取用户点击鼠标的时间;
判断所述用户点击鼠标的时间是否在所述开机启动程序对应的进程都被 创建的时刻和所述 CPU使用率低于预设阀值的时刻之间。
优选地, 所述根据所述第一时间段、 所述第二时间段和预设误差因子获取 开机时间之前, 进一步包括:
判断所述第二时间段和所述第一时间段的差是否大于预设值;
相应的, 所述根据所述第一时间段、 所述第二时间段和预设误差因子获取 开机时间具体为: 如果所述第二时间段和所述第一时间段的差大于所述預设值,根据所述第 一时间段、 所述第二时间段和预设误差因子获取开机时间, 包括:
将所述第二时间段和所述第一时间段的差与预设误差因子相乘,生成估算 误差时间;
将所述第一时间段和所述估算误差时间相加, 生成开机时间。
优选地, 所述方法还包括:
如果用户在所述第二时间段内没有运行程序,将所述第二时间段作为开机 时间。
或者, 如果用户在所述第二时间段内运行程序, 且当所述第二时间段和所 述第一时间段的差小于所述预设值, 将所述第二时间段作为开机时间。
本实施例中, 获取第一时间段和第二时间段, 当用户在第二时间段内运行 程序时,根据所述第一时间段、所述第二时间段和预设误差因子获取开机时间, 本实施例中综合考虑了第二时间段和用户在开机过程中的相关操作等因素对 开机时间精确度的影响, 相比较现有技术只把第一时间段作为开机时间而言, 本实施例中根据所述第一时间段、 第二时间段和预设误差因子获取的开机时间 的精确度提高了。 实施例 2
参考图 1 , 图 2是本发明实施例 2提供的一种开机时间的获取方法实施例 的流程图; 本实施例中的终端可以为计算机, 但是并不局限于此;
所述开机时间的获取方法包括:
S201 : 终端获取第一时间段和第二时间段。
此步骤中, 获取第一时间段的方法与现有技术类似, 在此不再赘述, 其中 所述第一时间段为终端从开机启动的时刻到开机启动程序对应的进程都被创 建的时刻的时间间隔。
在终端开机启动时, 程序通过轮询的方式监控终端的 CPU ( Centra l Process ing Uni t , 中央处理器)使用率, 若检测到预设时间内所述 CPU使用 率均低于预设阀值时,则认为开机启动结束,终端通过获取系统运行时间的 API 函数来获取 CPU使用率低于预设阀值的时刻,从而获取第二时间段; 其中所述 第二时间段为从开机启动的时刻到所述 CPU使用率低于预设阀值的时刻的时间 间隔, 所述 CPU使用率低于预设阀值的时刻之前的所述预设时间内的 CPU使用 率均低于所述预设阀值; 所述第二时间段大于所述第一时间段。
其中所述预设时间、 所述预设阀值可以由程序开发人员进行设置, 在此不 作具体限定, 例如所述预设时间为 5秒, 所述预设阀值为 5%, 但是并不局限于 此。
本实施例中, 所述第一时间段还可以用第三时间来代替, 其中所述第三时 间为从开机启动的时刻到检测到 Explorer. exe启动完成(即桌面显示完成) 的时刻的时间间隔, 或者, 所述第一时间段还可以用第四时间来代替, 其中所 述第四时间为从开机启动的时刻到检测到服务进程启动完成的时刻的时间间 隔。
S202 : 终端判断用户在所述第二时间段内是否运行程序, 如杲否, 执行 S203 , 如杲是, 执行 S204。
此步骤中, 终端判断用户在所述第二时间段内是否运行程序包括: 终端判断所述开机启动程序对应的进程都被创建的时刻和所述 CPU使用率 低于预设阀值的时刻之间是否有新进程被创建。
其中,如果所述开机启动程序对应的进程都被创建的时刻和所述 CPU使用 率低于预设阀值的时刻之间有新进程被创建, 则表示用户在所述第二时间段内 执行了程序。
其中, 终端可以根据进程创建时间来判断所述开机启动程序对应的进程都 被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间是否有新进程被创 建, 具体地, 当终端开机启动后, 终端记录所述开机启动程序对应的进程都被 创建的时刻对应的时间戳 ^^ ^'^^n ,然后当所述预设时间内 CPU使用 率均低于所述预设阀值后, 遍历所述第二时间段内的所有进程, 判断所述所有 进程中是否存在 StartupTiimAut 时间戮之后创建的新进程,这些新进程被认 为是开机启动后由用户手动启动的进程。
优选的,所述判断所述所有进程中是否存在 ^tort"P m^'。^ 时间戳之后 创建的新进程包括:获取所述所有进程中所述1 ^^"Ρ77"^——»时间戳之后创 建的新进程; 判断所述新进程的父 PID ( Proces s Ident i fy, 进程身份标识) 是否是资源管理器进程 Explorer. exe或者图标管理软件进程, 如果是, 则表 示所述新进程为开机启动后用户手动启动的进程。所述图标管理软件进程为第 三方程序, 例如 Q+、 QQ桌面等程序; 所述图标管理软件进程可以以白名单的 形式进行存储。 或者, 终端可以 #居前后两个时间点的进程快照来判断所述开机启动程序 对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间是否有 新进程被创建, 具体地, 当终端开机启动后, 终端在所述开机启动程序对应的 进程都被创建的时刻, 创建第一进程快照; 终端在所述 CPU使用率低于预设阀 值的时刻, 创建第二进程快照; 终端判断所述第二进程快照中是否存在除所述 第一进程快照中进程之外的新进程, 这些新进程被认为是是开机启动后由用户 手动启动的进程。
优选的, 所述判断第二进程快照中是否存在除所述第一进程快照中进程之 外的新进程包括: 获取所述第二进程快照中除所述第一进程快照中进程之外的 新进程; 判断所述新进程的父 PID是否是资源管理器进程或者图标管理软件进 程, 如果是, 则表示所述新进程为开机启动后用户手动启动的进程。 所述图标 管理软件进程为第三方程序, 例如 Q+、 QQ桌面等程序。
本实施例中, 所述终端判断用户在所述第二时间段内是否运行程序还可以 包括:
获取所述第二时间段内所有进程的父 PID; 判断所述父 PID是否是资源管 理器进程或者图标管理軟件进程。
具体地, 通过 API HOOK (钩子)技术向系统注入一段准备好的检测代码。 终端在开机启动时,任何一个进程被创建之前都会先执行注入系统的所述检测 代码, 并在检测代码中记录下当前该进程的父 PID; 然后终端判断所述父 PID 是否为资源管理器进程 Explorer, exe或者图标管理软件进程, 如果是, 则认 为开机启动阶段有用户手动运行了相关程序。
或者, 获取用户点击鼠标的时间; 判断所述用户点击鼠标的时间是否在所 述开机启动程序对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的 时刻之间。
具体地, 终端通过向操作系统注册全局的消息钩子来获取用户点击鼠标的 时间,再判断所述用户点击鼠标的时间是否在所述开机启动程序对应的进程都 被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间, 如果是, 则认为开 机启动阶段有用户手动运行了相关程序。
S203: 终端将所述第二时间段作为开机时间。
如果用户在所述第二时间段内没有运行程序,也就是说终端从开机启动到 启动程序全部加载完成的过程中用户都没有运行程序或者进行相关操作, 那么 此时的所述第二时间段就是终端精确的开机时间。 终端完成开机后, 正式进入 正常使用计算机状态, 即计算机的 CPU、 内存等空闲资源可以分配给用户进行 手动启动进程的状态。
如果用户在所述第二时间段内运行了程序,且所述第二时间段和所述第一 时间段的差小于所述预设值,终端可以将所述第二时间段作为开机时间。例如, 所述预设值为 5秒, 所述第二时间段和所述第一时间段的差很小, 为 1秒时, 此时即使检测到用户在所述第二时间段内运行了程序, 那么这个程序对开机的 影响很小, 可以忽略不计, 所以还是可以讲所述第二时间段作为开机时间。 其 中所述预设值可以手动设置, 也可以根据相应算法自动进行计算, 在此不做具 体限定。
S204: 终端判断所述第二时间段和所述第一时间段的差是否大于预设值, 如果否, 执行 S203 , 如果是, 执行 S205。
如果用户在所述第二时间段内运行了程序,也就是说终端在开机启动到启 动程序全部加载完成的过程中用户运行了程序或进行了相关操作, 那么此时的 第二时间段就不是精确的开机时间了, 因为用户运行的程序会抢占计算机的资 源, 从而延后了启动程序启动完成的时间, 因此精确的开机时间应该是位于所 述第一时间段和所述第二时间段之间。
当用户在所述第二时间段内运行了程序后, 终端还需要判断所述第二时间 段和所述第一时间段的差是都大于预设值,根据判断结果执行相应的后续处理 来获取精确的开机时间。
S205: 终端根据所述第一时间段、 第二时间段和预设误差因子获取开机时 间。
此步骤中, 当用户在所述第二时间段内运行了程序, 且所述第二时间段和 所述第一时间段的差大于预设值时, 终端按照如下两个公式获取精确的开机时 间;
Figure imgf000010_0001
示所述第一时间段, ^^7^6- 表示所述第二时间段, "terra/表示所述第 二时间段和所述第一时间段的差, ^ctor表示预设误差因子。 例如, 假设第一 时间段为 35秒, 第二时间段为 40秒, factor为 0. 2 , 根据上述公式( 1 )和( 2 ) 计算可知, 开机时间 StartupTime _ Final为 36秒。
factor参数可以根据 Interval的大小来确定。 在正常情况下, I代表了 从所有自启动程序启动的那一刻到系统运行平稳的时间。客户运行的启动程序 越多, 那么系统平稳状态所用的时间就越久, ^v^的值总体会越来越大, 则 factor的值越小; 因为 的值越大表示由于用户操作而导致开机启动完成 推迟的时间越大, 也就是说 1的值受用户影响越大, 那么 fi^° 的值应该 越小。 反之, 若 ^erw^的值越小, 则 的值越大, 因为 toerraZ越小表示由 于用户操作而导致开机启动完成推迟的时间越小,也就是 erra/的值受用户影 响越小, 那么 factor的值应该越大。
factor参数的引入可以在一定程度上去除了开机启动时用户手动运行的程 序对开机时间的干扰, 使得开机时间的精确度提高。
例如, 本实施例中以所述预设阀值定义为 StartupTime Aut StartPmcess时间戳的 50% 为例来描述 Nerval与 factor的对应关系, 具体可参见表 1。
表 1
Figure imgf000011_0001
表 1 只是列举了一个例子而已, 本实施例中 I l与 factor的对应关系并 不局限于表 1 ,开发者还可以根据实际情况对所述预设阔值以及 与 factor 的对应关系进行相应的调整, 在此不再——枚举。
本实施例中, 获取第一时间段和第二时间段, 当用户在第二时间段内运行 程序时,根据所述第一时间段、所述第二时间段和预设误差因子获取开机时间, 本实施例中综合考虑了第二时间段和用户在开机过程中的相关操作等因素对 开机时间精确度的影响, 相比较现有技术只把第一时间段作为开机时间而言, 本实施例中根据所述第一时间段、 第二时间段和预设误差因子获取的开机时间 的精确度提高了。 程序, 以备后续使用。 cto/"参数的引入也在一定程度上去除了开机启动期间 用户手动运行的程序对开机时间的干扰, 使得开机时间的精确度提高。 实施例 3
参考图 3, 图 3是本发明实施例 3提供的一种开机时间的获取装置实施例 的第一结构示意图; 本实施例中所述开机时间的获取装置可以是终端, 具体可 以是计算机, 但是并不局限于此。
所述开机时间的获取装置包括:
获耳 4莫块 301, 用于获取第一时间段和第二时间段, 其中所述第一时间段 中开机启动程序对应的进程都被创建,所述第二时间段中预设时间内中央处理 器 CPU使用率均低于预设阀值。
判断处理模块 302, 用于判断用户在所述第二时间段内是否运行程序, 如 杲是, 根据所述第一时间段、 所述第二时间段和预设误差因子获取开机时间。
其中, 所述判断处理模块 302包括: 第一判断子模块 3021 ;
所述第一判断子模块 3021 ,用于判断所述开机启动程序对应的进程都被创 建的时刻和所述 CPU使用率低于预设阀值的时刻之间是否有新进程被创建。
所述第一判断子模块 3021包括遍历单元 30211和第一判断单元 30212 ,如 图 4所示, 图 4是本发明实施例 3提供的一种开机时间的获取装置实施例的第 二结构示意图;
所述遍历单元 30211, 用于遍历所述第二时间段内的所有进程; 所述第一判断单元 30212 , 用于判断所述所有进程中是否存在所述开机启 动程序对应的进程都被创建的时刻之后的新进程。
其中所述第一判断单元 30212包括:
第一获取子单元, 用于获取所述所有进程中所述开机启动程序对应的进程 都被创建的时刻之后的新进程;
第一判断子单元, 用于判断所述新进程的父进程身份标识 PID是否是资源 管理器进程或者图标管理软件进程。
本实施例的另一实施方式中, 所述第一判断子模块 3021 包括: 第一创建 单元 30213、 第二创建单元 30214和第二判断单元 30215 , 如图 5所示, 图 5 是本发明实施例 3提供的一种开机时间的获取装置实施例的第三结构示意图; 第一创建单元 30213, 用于在所述开机启动程序对应的进程都被创建的时 刻, 创建第一进程快照;
第二创建单元 30214 , 用于在所述 CPU使用率 ^氐于预设阀值的时刻, 创建 第二进程快照;
第二判断单元 30215, 用于判断所述第二进程快照中是否存在除所述第一 进程快照中进程之外的新进程。
其中, 所述第二判断单元 30215包括:
第二获取子单元, 用于获取所述第二进程快照中除所述第一进程快照中进 程之外的新进程;
第二判断子单元, 用于判断所述新进程的父 P ID是否是资源管理器进程或 者图标管理软件进程。
本实施例的另一实施方式中, 所述判断处理模块 302可以包括: 第一获取 子模块 3022和第二判断子模块 3023 , 如图 6所示, 图 6是本发明实施例 3提 供的一种开机时间的获取装置实施例的第四结构示意图;
所述第一获取子模块 3022,用于获取所述第二时间段内所有进程的父 P I D; 所述第二判断子模块 3023 ,用于判断所述父 P ID是否是资源管理器进程或 者囹标管理软件进程。
本实施例的另一实施方式中, 所述判断处理模块 302包括: 第二获取子模 块 3024和第三判断子模块 3025 , 如图 7所示, 图 7是本发明实施例 3提供的 一种开机时间的获取装置实施例的第五结构示意图;
所述第二获取子模块 3024, 用于获取用户点击鼠标的时间;
所述第三判断子模块 3025,用于判断所述用户点击鼠标的时间是否在所述 开机启动程序对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的时 刻之间。
在上述所有实施方式的基础上, 所述装置进一步包括:
判断模块, 用于在所述根据所述第一时间段、 所述第二时间段和预设误差 因子获取开机时间之前,判断所述第二时间段和所述第一时间段的差是否大于 预设值;
相应的, 所述判断处理模块 302包括:
获取子模块, 用于如果所述第二时间段和所述第一时间段的差大于所述预 设值, 根据所述第一时间段、 所述第二时间段和预设误差因子获取开机时间; 其中获取子模块包括:
误差时间生成单元, 用于将所述第二时间段和所述第一时间段的差与预设 误差因子相乘, 生成估算误差时间; 开机时间生成单元, 用于将所述第一时间段和所述估算误差时间相加, 生 成开机时间。
在本实施例的另一实施方式中, 所述开机时间的获取装置在包括获取模块
301和判断处理模块 302的基础上还包括: 第一生成模块或第二生成模块; 所述第一生成模块, 用于如果用户在所述第二时间段内没有运行程序, 将 所述第二时间段作为开机时间。
或者,
所述第二生成模块, 用于如果用户在所述第二时间段内运行程序, 且当所 述第二时间段和所述第一时间段的差小于所述预设值, 将所述第二时间段作为 开机时间。
本实施例中, 获取第一时间段和第二时间段, 当用户在第二时间段内运行 程序时,根据所述第一时间段、所述第二时间段和预设误差因子获取开机时间, 本实施例中综合考虑了第二时间段和用户在开机过程中的相关操作等因素对 开机时间精确度的影响, 相比较现有技术只把第一时间段作为开机时间而言, 本实施例中根据所述第一时间段、 第二时间段和预设误差因子获取的开机时间 的精确度提高了。 程序, 以备后续使用。 ctor参数的引入也在一定程度上去除了开机启动期间 用户手动运行的程序对开机时间的干扰, 使得开机时间的精确度提高。 要说明的是, 本说明书中的各个实施例均采用递进的方式描述, 每个实施 例重点说明的都是与其他实施例的不同之处, 各个实施例之间相同相似的部分 互相参见即可。 对于装置类实施例而言, 由于其与方法实施例基本相似, 所以 描述的比较简单, 相关之处参见方法实施例的部分说明即可。
需要说明的是, 在本文中, 诸如第一和第二等之类的关系术语仅仅用来将 一个实体或者操作与另一个实体或操作区分开来, 而不一定要求或者暗示这些 实体或操作之间存在任何这种实际的关系或者顺序。而且,术语 "包括" 、 "包 含"或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素 的过程、 方法、 物品或者设备不仅包括那些要素, 而且还包括没有明确列出的 其他要素, 或者是还包括为这种过程、 方法、 物品或者设备所固有的要素。 在 没有更多限制的情况下, 由语句 "包括一个…… " 限定的要素, 并不排除在包 括所述要素的过程、 方法、 物品或者设备中还存在另外的相同要素。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通 过硬件来完成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存储 于一种计算机可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘 或光盘等。
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的 精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的 保护范围之内。

Claims

权 利 要 求 书
1、 一种开机时间的获取方法, 其特征在于, 包括:
获取第一时间段和第二时间段, 其中所述第一时间段中开机启动程序对应 的进程都被创建, 所述第二时间段中预设时间内中央处理器 CPU使用率均低于 预设阀值;
判断用户在所述第二时间段内是否运行程序, 如果是, 根据所述第一时间 段、 所述第二时间段和预设误差因子获取开机时间。
2、 根据权利要求 1所述的方法, 其特征在于, 所述判断用户在所述第二时 间段内是否运行程序包括:
判断所述开机启动程序对应的进程都被创建的时刻和所述 CPU使用率低于 预设阀值的时刻之间是否有新进程被创建。
3、 根据权利要求 2所述的方法, 其特征在于, 所述判断所述开机启动程序 对应的进程都被创建的时刻和所述 CPU使用率低于预设阔值的时刻之间是否有 新进程被创建包括:
遍历所述第二时间段内的所有进程;
判断所述所有进程中是否存在所述开机启动程序对应的进程都被创建的时 刻之后创建的新进程。
4、 根据权利要求 3所述的方法, 其特征在于, 所述判断所述所有进程中是 否存在所述开机启动程序对应的进程都被创建的时刻之后创建的新进程包括: 获取所述所有进程中所述开机启动程序对应的进程都被创建的时刻之后创 建的新进程;
判断所述新进程的父进程身份标识 PID是否是资源管理器进程或者图标管 理软件进程。
5、 根据权利要求 2所述的方法, 其特征在于, 所述判断所述开机启动程序 对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间是否有 新进程被创建包括: 在所述开机启动程序对应的进程都被创建的时刻, 创建第一进程快照; 在所述 CPU使用率低于预设阀值的时刻, 创建第二进程快照;
判断所述第二进程快照中是否存在除所述第一进程快照中进程之外的新进
6、 根据权利要求 5所述的方法, 其特征在于, 所述判断所述第二进程快照 中是否存在除所述第一进程快照中进程之外的新进程包括:
获取所述第二进程快照中除所述第一进程快照中进程之外的新进程; 判断所述新进程的父 PID是否是资源管理器进程或者图标管理软件进程。
7、 根据权利要求 1所述的方法, 其特征在于, 所述判断用户在所述第二时 间段内是否运行程序包括:
获取所述第二时间段内所有进程的父 PID;
判断所述父 P I D是否是资源管理器进程或者图标管理软件进程。
8、 根据权利要求 1所述的方法, 其特征在于, 所述判断用户在所述第二时 间段内是否运行程序包括:
获取用户点击鼠标的时间;
判断所述用户点击鼠标的时间是否在所述开机启动程序对应的进程都被创 建的时刻和所述 CPU使用率低于预设阀值的时刻之间。
9、 根据权利要求 1-8任一项所述的方法, 其特征在于, 所述根据所述第一 时间段、 所述第二时间段和预设误差因子获取开机时间之前, 进一步包括: 判断所述第二时间段和所述第一时间段的差是否大于预设值;
相应的, 所述根据所述第一时间段、 所述第二时间段和预设误差因子获取 开机时间具体为:
如果所述第二时间段和所述第一时间段的差大于所述预设值, 根据所述第 一时间段、 所述第二时间段和预设误差因子获取开机时间, 包括:
将所述第二时间段和所述第一时间段的差与预设误差因子相乘, 生成估算 误差时间;
将所述第一时间段和所述估算误差时间相加, 生成开机时间。
10、 根据权利要求 9所述的方法, 其特征在于, 所述方法还包括: 如果用户在所述第二时间段内没有运行程序, 将所述第二时间段作为开机 时间;
或者, 如果用户在所述第二时间段内运行程序, 且当所述第二时间段和所 述第一时间段的差小于所述预设值, 将所述第二时间段作为开机时间。
11、 一种开机时间的获取装置, 其特征在于, 包括:
获取模块, 用于获取第一时间段和第二时间段, 其中所述第一时间段中开 机启动程序对应的进程都被创建,所述第二时间段中预设时间内中央处理器 CPU 使用率均低于预设阀值;
判断处理模块, 用于判断用户在所述第二时间段内是否运行程序, 如果是, 根据所述第一时间段、 所述第二时间段和预设误差因子获取开机时间。
12、 根据权利要求 11所述的装置, 其特征在于, 所述判断处理模块包括: 第一判断子模块, 用于判断所述开机启动程序对应的进程都被创建的时刻 和所述 CPU使用率低于预设阀值的时刻之间是否有新进程被创建。
13、根据权利要求 12所述的装置, 其特征在于, 所述第一判断子模块包括: 遍历单元, 用于遍历所述第二时间段内的所有进程;
第一判断单元, 用于判断所述所有进程中是否存在所述开机启动程序对应 的进程都被创建的时刻之后的新进程。
14、 根据权利要求 13所述的装置, 其特征在于, 所述第一判断单元包括: 第一获取子单元, 用于获取所述所有进程中所述开机启动程序对应的进程 都被创建的时刻之后的新进程;
第一判断子单元, 用于判断所述新进程的父进程身份标识 P ID是否是资源 管理器进程或者图标管理軟件进程。
15、根据权利要求 14所述的装置, 其特征在于, 所述第一判断子模块包括: 第一创建单元, 用于在所述开机启动程序对应的进程都被创建的时刻, 创 建第一进程快照;
第二创建单元, 用于在所述 CPU使用率低于预设阀值的时刻, 创建第二进 程快照;
第二判断单元, 用于判断所述第二进程快照中是否存在除所述第一进程快 照中进程之外的新进程。
16、 根据权利要求 15所述的装置, 其特征在于, 所述第二判断单元包括: 第二获取子单元, 用于获取所述第二进程快照中除所述第一进程快照中进 程之外的新进程;
第二判断子单元, 用于判断所述新进程的父 PID是否是资源管理器进程或 者图标管理软件进程。
17、 根据权利要求 11所述的装置, 其特征在于, 所述判断处理模块包括: 第一获取子模块, 用于获取所述第二时间段内所有进程的父 PID;
第二判断子模块, 用于判断所述父 PID是否是资源管理器进程或者图标管 理软件进程。
18、 根据权利要求 11所述的装置, 其特征在于, 所述判断处理模块包括: 第二获取子模块, 用于获取用户点击鼠标的时间;
第三判断子模块, 用于判断所述用户点击鼠标的时间是否在所述开机启动 程序对应的进程都被创建的时刻和所述 CPU使用率低于预设阀值的时刻之间。
19、 根据权利要求 11-18任一项所述的装置, 其特征在于, 进一步包括: 判断模块, 用于在所述根据所述第一时间段、 所述第二时间段和预设误差 因子获取开机时间之前, 判断所述第二时间段和所述第一时间段的差是否大于 预设值;
相应的, 所述判断处理模块包括:
获取子模块, 用于如果所述第二时间段和所述第一时间段的差大于所述预 设值 , 根据所述第一时间段、 所述第二时间段和预设误差因子获取开机时间; 其中, 所述获取子模块包括:
误差时间生成单元, 用于将所述第二时间段和所述第一时间段的差与预设 误差因子相乘, 生成估算误差时间;
开机时间生成单元, 用于将所述第一时间段和所述估算误差时间相加, 生 成开机时间。
20 . 根据权利要求 19所述的装置, 其特征在于, 所述装置还包括: 第一生成模块, 用于如果用户在所述第二时间段内没有运行程序, 将所述 第二时间段作为开机时间;
或者, 第二生成模块, 用于如果用户在所述第二时间段内运行程序, 且当 所述第二时间段和所述第一时间段的差小于所述预设值, 将所述第二时间段作 为开机时间。
PCT/CN2012/087636 2012-02-22 2012-12-27 一种开机时间的获取方法及装置 WO2013123815A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
BR112013033103A BR112013033103A2 (pt) 2012-02-22 2012-12-27 método e dispositivo para a obtenção de tempo de início

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210040970.5 2012-02-22
CN 201210040970 CN102646066B (zh) 2012-02-22 2012-02-22 一种开机时间的获取方法及装置

Publications (1)

Publication Number Publication Date
WO2013123815A1 true WO2013123815A1 (zh) 2013-08-29

Family

ID=46658894

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/087636 WO2013123815A1 (zh) 2012-02-22 2012-12-27 一种开机时间的获取方法及装置

Country Status (3)

Country Link
CN (1) CN102646066B (zh)
BR (1) BR112013033103A2 (zh)
WO (1) WO2013123815A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102646066B (zh) * 2012-02-22 2013-12-18 腾讯科技(深圳)有限公司 一种开机时间的获取方法及装置
CN105468480B (zh) * 2014-08-13 2020-08-14 腾讯科技(深圳)有限公司 一种开机启动管理方法和装置
CN104199692B (zh) * 2014-08-25 2017-08-04 北京金山安全软件有限公司 一种获取应用程序的启动时间的方法、装置及终端
CN104199693B (zh) * 2014-08-25 2017-12-19 北京金山安全软件有限公司 一种获取开机时间的方法、装置及终端
CN104298530B (zh) * 2014-10-13 2017-06-16 苏州佳世达电通有限公司 量测可携式电子装置开机时间长度的方法及资料处理系统
CN106569931B (zh) * 2016-11-17 2019-05-21 北京小米移动软件有限公司 预计启动时长提醒的方法及装置
CN107688533B (zh) * 2017-07-25 2020-12-29 深圳壹账通智能科技有限公司 应用程序测试方法、装置、计算机设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1932763A (zh) * 2005-09-13 2007-03-21 联想(北京)有限公司 计算机系统启动方法
CN101727382A (zh) * 2008-10-16 2010-06-09 纬创资通股份有限公司 存取开机时间的方法
CN102355531A (zh) * 2011-09-28 2012-02-15 捷开通讯科技(上海)有限公司 一种显示移动终端开机时间的装置及方法
CN102646066A (zh) * 2012-02-22 2012-08-22 腾讯科技(深圳)有限公司 一种开机时间的获取方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100549979C (zh) * 2007-11-29 2009-10-14 中兴通讯股份有限公司 系统任务的cpu占用率检测方法及系统
CN101873616B (zh) * 2010-06-21 2014-07-16 宇龙计算机通信科技(深圳)有限公司 一种移动终端自检的方法、系统及移动终端

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1932763A (zh) * 2005-09-13 2007-03-21 联想(北京)有限公司 计算机系统启动方法
CN101727382A (zh) * 2008-10-16 2010-06-09 纬创资通股份有限公司 存取开机时间的方法
CN102355531A (zh) * 2011-09-28 2012-02-15 捷开通讯科技(上海)有限公司 一种显示移动终端开机时间的装置及方法
CN102646066A (zh) * 2012-02-22 2012-08-22 腾讯科技(深圳)有限公司 一种开机时间的获取方法及装置

Also Published As

Publication number Publication date
CN102646066A (zh) 2012-08-22
CN102646066B (zh) 2013-12-18
BR112013033103A2 (pt) 2017-01-24

Similar Documents

Publication Publication Date Title
WO2013123815A1 (zh) 一种开机时间的获取方法及装置
US11467890B2 (en) Processing event messages for user requests to execute program code
US9760387B2 (en) Programmatic event detection and message generation for requests to execute program code
KR101692796B1 (ko) 싱글 사인온 서비스를 용이하게 하는 방법 및 장치
US9584438B2 (en) Idle worker-process page-out
US20150074660A1 (en) Method and apparatus of downloading and installing a client
WO2015180601A1 (zh) WebApp启动运行、生成镜像文件的方法和装置
GB2507779A (en) Terminating a virtual machine in response to user inactivity in a cloud computing environment
WO2015196982A1 (zh) 一种Android恶意程序检测和处理方法、装置及设备
RU2020129947A (ru) Очистка ресурса безоперационной системы до доверенного состояния, пригодная для использования в облачных вычислениях
WO2014015732A1 (zh) 一种终端能力描述信息的生成方法及系统
WO2016078323A1 (zh) 检测恶意软件的方法及装置
WO2017101332A1 (zh) 后台任务触发方法及装置
US8453013B1 (en) System-hang recovery mechanisms for distributed systems
JP6088531B2 (ja) ローカルサーバーを通じたローカルクライアントアプリケーションのためのイベントサービス
WO2015172283A1 (zh) 一种降低功耗的方法、装置及移动终端
CN113407383A (zh) 主备系统切换方法、装置、服务器及主备系统
WO2016061941A1 (zh) 一种异常处理方法及装置、存储介质
CN111124761B (zh) 一种设备重启方法、装置、设备及介质
WO2022105365A1 (zh) 设备控制的方法及系统、电子设备、及存储介质
WO2013102397A1 (zh) 搭建应用运行环境的方法、装置及存储介质
CN112671835B (zh) 一种请求处理的方法、装置、系统及存储介质
WO2012041239A1 (zh) 一种输入工具调用的系统、方法及一种代理设备
WO2014067368A1 (zh) 资源预览图的获取方法、装置以及设备
WO2016114799A1 (en) Communicating a data image for installing an operating system

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: 12869233

Country of ref document: EP

Kind code of ref document: A1

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112013033103

Country of ref document: BR

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 28/01/2015)

122 Ep: pct application non-entry in european phase

Ref document number: 12869233

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 112013033103

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20131220