Module wake-up method, device, storage medium, camera, and program product
By reusing the hardware timer in the camera device to determine and wake up the functional module with the shortest remaining call time, the problem of high energy consumption of the camera device in harsh environments is solved, and the stability of the device and the reduction of energy consumption are achieved.
Patent Information
- Application Number
- CN202411487353.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-10-23
AI Technical Summary
In harsh environments, the energy consumption reduction method of the camera device needs to determine the greatest common divisor of the execution cycles of multiple functional modules, which causes the timer to wake up frequently, resulting in poor energy consumption reduction effect.
By registering multiple functional modules in the target module and reusing the same hardware timer, the remaining call time of each functional module is determined. The functional module with the shortest call time is used as the target functional module. The target wake-up time is determined based on the next time it is called, and the target module is woken up at this time and enters the sleep state.
It effectively reduces device energy consumption, improves device stability, reduces unnecessary wake-up times, and reduces energy consumption.
Smart Images

Figure CN119383458B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of electronic photography, and more particularly, to a module awakening method, device, storage medium, camera, and program product. Background Art
[0002] In harsh environments, the deployment of video cameras is crucial for regional monitoring. Since solar panels are required as a power source for these cameras, and solar power supply is unstable due to weather conditions, a reasonable strategy is needed to reduce the energy consumption of these cameras.
[0003] The energy consumption reduction method in the related art needs to determine the greatest common divisor of the execution cycles of multiple functional modules and instruct the timer to wake up the module every time the greatest common divisor is reached. Therefore, when the greatest common divisor is small, the timer will frequently wake up the module, resulting in poor energy consumption reduction effect. Summary of the Invention
[0004] An embodiment of the present invention provides a module wake-up method, device, storage medium, camera and program product to at least solve the problem that the energy consumption reduction method in the related art needs to determine the greatest common divisor of the execution cycles of multiple functional modules and instruct the timer to wake up the module every time the greatest common divisor is reached. Therefore, when the greatest common divisor is small, the timer frequently wakes up the module, resulting in poor energy consumption reduction effect.
[0005] According to one embodiment of the present invention, a module wake-up method is provided, which is applied to a target module, wherein multiple functional modules are registered in the target module, and the multiple functional modules reuse the same hardware timer, and the hardware timer is used to wake up the target module to call the functional modules to perform corresponding operations. The method includes: when a wake-up time delivery condition is met, determining the remaining call time of each functional module, wherein the remaining call time is used to indicate the remaining time between the time when the functional module is next called and the current time; based on the remaining call time of each functional module, determining the functional module with the shortest remaining call time among the multiple functional modules as the target functional module; determining a target wake-up time based on the time when the target functional module is next called, and delivering the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein after the target module delivers the target wake-up time to the hardware timer, the target module enters a sleep state.
[0006] In an exemplary embodiment, after determining the target wake-up time based on the moment when the target functional module is called next, the method further includes: determining the length of time between the target wake-up time and the current moment; determining the priority of the target functional module when the length of time between the target wake-up time and the current moment meets a predetermined condition; and executing the operation of calling the target functional module based on the priority of the target functional module.
[0007] In an exemplary embodiment, when the duration from the target wake-up time to the current moment satisfies a predetermined condition, determining the priority of the target functional module includes: when it is determined that the duration from the target wake-up time to the current moment is less than a first preset duration, determining the priority of the target functional module; executing the operation of calling the target functional module based on the priority of the target functional module includes: when the priority of the target functional module is a first priority, directly calling the target functional module to execute the target operation, wherein the functional module with the first priority is a module that allows adjustment of the function execution cycle.
[0008] In an exemplary embodiment, sending the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives includes: when the priority of the target functional module is the second priority, sending the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein the functional module with the second priority is a module that is not allowed to adjust the function execution cycle.
[0009] In an exemplary embodiment, the method further includes: obtaining attribute information of multiple functional modules; judging whether to allow adjustment of the function execution cycle of each functional module based on the attribute information of each functional module, and obtaining a judgment result; and setting the priority of each functional module based on the judgment result.
[0010] In an exemplary embodiment, determining the remaining call time of each of the functional modules includes: determining the remaining call time of each of the functional modules based on the execution cycle of each of the registered functional modules recorded in the target module, and the historical timestamp of each of the functional modules, wherein, if the functional module has been called before, the historical timestamp indicates the moment when the functional module was last called, and if the functional module has not been called before, the historical timestamp indicates the registration moment of the functional module.
[0011] In an exemplary embodiment, the wake-up time delivery condition includes at least one of the following: the target module completes calling any one of the multiple functional modules; any one of the multiple functional modules successfully registers with the target module.
[0012] In an exemplary embodiment, the method further includes: when a timestamp synchronization condition is met, calling a plurality of the functional modules to update the historical timestamp of each functional module to the current moment.
[0013] In an exemplary embodiment, the timestamp synchronization condition includes at least one of the following: the time between the current moment and the moment when any functional module included in the plurality of functional modules is first called reaches a second preset time; a timestamp synchronization instruction is received.
[0014] According to another embodiment of the present invention, a module awakening device is provided, which is applied to a target module, wherein multiple functional modules are registered in the target module, and the multiple functional modules reuse the same hardware timer, and the hardware timer is used to awaken the target module to call the functional modules to perform corresponding operations. The device includes: a first determination module, which is used to determine the remaining call time of each functional module when the wake-up time issuance condition is met, wherein the remaining call time is used to indicate the remaining time between the time when the functional module is next called and the current time; a second determination module, which is used to determine the functional module with the shortest remaining call time among the multiple functional modules based on the remaining call time of each functional module, as the target functional module; and a sending module, which is used to determine a target wake-up time based on the time when the target functional module is next called, and send the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time is reached, wherein the target module enters a dormant state after sending the target wake-up time to the hardware timer.
[0015] According to yet another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when run.
[0016] According to another embodiment of the present invention, a camera is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0017] According to yet another embodiment of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0018] Through the present invention, when the wake-up time sending conditions are met, the target functional module with the shortest remaining calling time is determined, and the time for instructing the hardware timer to wake up the target module is determined based on the time when the target functional module is called next time, so that the target module can be awakened only when there is a function that needs to be executed. This solves the problem of energy consumption reduction methods in related technologies that require determining the greatest common divisor of the execution cycles of multiple functional modules and instructing the timer to wake up the module every greatest common divisor. Therefore, when the greatest common divisor is small, the timer frequently wakes up the module, resulting in poor energy consumption reduction effect. This effectively reduces the energy consumption of the device and improves the stability of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 1 is a hardware structure block diagram of a mobile terminal according to a module wake-up method according to an embodiment of the present invention;
[0020] Figure 2 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 1 ;
[0021] Figure 3 2 is a schematic diagram of module distribution of a module wake-up method according to an embodiment of the present invention;
[0022] Figure 4 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 2 ;
[0023] Figure 5 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 3 ;
[0024] Figure 6 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 4 ;
[0025] Figure 7 4 is a structural block diagram of a module awakening device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings and in combination with embodiments.
[0027] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0028] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG is a hardware structure diagram of a mobile terminal according to a module wake-up method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown) a processor 102 (the processor 102 may include but is not limited to a microprocessor MCU or a programmable logic device FPGA and other processing devices) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input and output device 108 for communication functions. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.
[0029] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the module wake-up method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0030] The transmission device 106 is used to receive or send data via a network. A specific example of the aforementioned network may include a wireless network provided by the mobile terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0031] In this embodiment, a module wake-up method running on the above mobile terminal or network architecture is provided. Figure 2 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 1 ,like Figure 2 As shown, the process includes the following steps:
[0032] Step S202: When the wake-up time delivery condition is met, determining the remaining call time of each functional module, wherein the remaining call time indicates the remaining time between the next call time of the functional module and the current time;
[0033] Step S204, based on the remaining call time of each of the functional modules, determining a functional module with the shortest remaining call time among the multiple functional modules as a target functional module;
[0034] Step S206: Determine a target wake-up time based on the next time the target functional module is called, and send the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives. After the target module sends the target wake-up time to the hardware timer, the target module enters a sleep state.
[0035] For example, Figure 3 FIG. 1 is a schematic diagram of module distribution according to a module wake-up method according to an embodiment of the present invention. Figure 3As shown, in an optional embodiment, the camera device includes one or more business modules, each of the business modules includes one or more sub-modules (i.e., the target module mentioned above), and each of the sub-modules includes one or more functional modules. Exemplarily, the multiple functional modules in the target module reuse the timer, and after being awakened, the target module calls the functional module that reaches the reporting time (for example, the target module calls the corresponding interface of the functional module through the callback function corresponding to the functional module), wherein one or more functional modules need to report information to the target platform regularly, the timer is integrated in the target module, and the registration information of one or more functional modules is recorded in the target module, and the registration information includes: the time of successful registration of the functional module, the reporting period of the functional module, and the timestamp of the most recent report of the functional module. Exemplarily, when the trigger condition is met, the functional module sends a registration request to the target platform for the first time through the corresponding interface in the target module. If the registration is successful, the target module records the time of successful registration. If the registration is unsuccessful, the target module instructs the timer to wake up the target module after the reporting period from the current time to request registration of the functional module to the target platform again.
[0036] Through the above steps, when the wake-up time sending conditions are met, the target functional module with the shortest remaining calling time is determined, and the time for instructing the hardware timer to wake up the target module is determined based on the time when the target functional module is called next time, so that the target module can be awakened only when there is a function that needs to be executed. This solves the problem that the energy consumption reduction method in the related art needs to determine the greatest common divisor of the execution cycles of multiple functional modules and instruct the timer to wake up the module every greatest common divisor. Therefore, when the greatest common divisor is small, the timer frequently wakes up the module, resulting in poor energy consumption reduction effect.
[0037] The execution subject of the above steps may be a camera device, other devices or systems that can carry modules and hard timers, etc., but is not limited thereto.
[0038] In an optional embodiment, after determining the target wake-up time based on the moment when the target functional module is called next time, the method further includes: determining the length of time between the target wake-up time and the current moment; determining the priority of the target functional module when the length of time between the target wake-up time and the current moment meets a predetermined condition; and executing the operation of calling the target functional module based on the priority of the target functional module.
[0039] In an optional embodiment, when the duration between the target wake-up time and the current moment meets a predetermined condition, determining the priority of the target functional module includes: when it is determined that the duration between the target wake-up time and the current moment is less than a first preset duration, determining the priority of the target functional module; executing the operation of calling the target functional module based on the priority of the target functional module includes: when the priority of the target functional module is the first priority, directly calling the target functional module to execute the target operation, wherein the functional module with the first priority is a module that allows adjustment of the function execution cycle.
[0040] In the above steps, the first preset duration includes but is not limited to: 5 minutes, 10 minutes, 20 minutes, etc. The first preset duration can be adjusted according to the different functions of the functional modules and the different application scenarios of the camera equipment where the functional modules are located.
[0041] Through the above steps, since the time length from the scheduled execution time to the current time is less than the first scheduled time length (i.e., the above-mentioned first preset time length) and the target functional module is a functional module that allows adjustment of the execution cycle, the functional module can be called first, thereby realizing the alignment operation of the calling time of multiple functional modules, reducing the number of times the target module is awakened, and reducing the energy consumption of the device.
[0042] For example, Figure 4 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 2 ,like Figure 4 As shown, the process includes the following steps:
[0043] In step S402, the target module calculates a first time for sending to the hard timer to instruct the hard timer to wake up the target module next time to call a target function (i.e., the target function module). The target function is the function whose next execution time is shortest from the current calculation time among all functions.
[0044] Step S404: the target module determines whether the first time is less than a first predetermined time. If the first time is less than the first predetermined time, step S404 is executed.
[0045] Step S406: The target module determines whether the priority of the target function is PL (i.e., the first priority mentioned above). If the priority of the target function is PL, step S408 is executed.
[0046] Step S408: The target module calls the target function.
[0047] In the above steps, optionally, when the priority of the target function is PH (i.e., the second priority mentioned above), determine whether there are other functions whose scheduled execution time is less than the first scheduled time from the current time and whose priority is PL length. If there are other functions that meet the above conditions, execute the other functions that meet the above conditions.
[0048] In an optional embodiment, the target wake-up time is sent to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, including: when the priority of the target functional module is the second priority, the target wake-up time is sent to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein the functional module with the second priority is a module that is not allowed to adjust the function execution cycle.
[0049] In an optional embodiment, the method further includes: obtaining attribute information of multiple functional modules; judging whether to allow adjustment of the function execution cycle of each functional module based on the attribute information of each functional module, and obtaining a judgment result; and setting the priority of each functional module based on the judgment result.
[0050] In the above steps, the attribute information includes but is not limited to: system modules, functional modules. For example, for system modules, it is set as a module whose execution cycle is not adjusted, and for functional modules, it is set as a module whose execution cycle can be adjusted. For example, modules with the first priority include but are not limited to: operating system modules, etc., and modules with the first priority include but are not limited to: sensor modules, lens modules, image processing modules, memory modules, display modules, interface modules, communication modules, power modules, auxiliary function modules, etc.
[0051] In an optional embodiment, determining the remaining call time of each of the functional modules includes: determining the remaining call time of each of the functional modules based on the execution cycle of each of the registered functional modules recorded in the target module, and the historical timestamp of each of the functional modules, wherein, if the functional module has been called before, the historical timestamp indicates the moment when the functional module was last called, and if the functional module has not been called before, the historical timestamp indicates the registration moment of the functional module.
[0052] In an optional embodiment, the wake-up time delivery condition includes at least one of the following: the target module completes calling any one of the multiple functional modules; any one of the multiple functional modules successfully registers with the target module.
[0053] In the above steps, the functional modules include but are not limited to: sensor module, lens module, image processing module, memory module, display module, operating system module, interface module, communication module, power module, auxiliary function module (for example, audio recording module, autofocus module, timer shooting module, scene mode module, etc.), etc. Exemplarily, when the image processing module completes video processing, the target module sends the time for waking up the target module next time to the hard timer. When the image processing module completes video processing, the target module sends the time for waking up the target module next time to the hard timer. When the target module successfully registers with the target module, the target module sends the time for waking up the target module next time to the hard timer.
[0054] In an optional embodiment, the method further includes: when a timestamp synchronization condition is met, calling a plurality of the functional modules to update the historical timestamp of each functional module to the current moment.
[0055] In an optional embodiment, the timestamp synchronization condition includes at least one of the following: the time between the current moment and the moment when any functional module included in the multiple functional modules is first called reaches a second preset time; a timestamp synchronization instruction is received.
[0056] In the above steps, the second preset time length includes but is not limited to: 5 minutes, 20 minutes, 1 hour, 5 hours, 10 hours, 20 hours, etc. The second preset time length can be adjusted according to the different functions of the functional modules and the different application scenarios of the camera equipment where the functional modules are located.
[0057] In an optional embodiment, illustratively, when the last execution time of all the functional modules (for functional modules that have not been executed, the registration time) is more than 1 hour from the current time, multiple functional modules are called to update the historical timestamp of each functional module to the current time. The target module receives the timestamp synchronization instruction in a manner including but not limited to: receiving via a wireless connection (e.g., Wi-Fi, Bluetooth, etc.), receiving via infrared, receiving via voice, receiving via a cloud platform installed on a camera device, etc.
[0058] For example, Figure 5 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 3 ,like Figure 5 As shown, the process includes the following steps:
[0059] Step S502 , the target module determines the shortest operating cycle among the operating cycles of multiple functions (i.e., the aforementioned functional modules);
[0060] Step S504: the target module records the most recent running time of each of the multiple functions;
[0061] Step S506: the target module records the time differences between adjacent running times among the multiple most recent running times corresponding to the multiple functions, and calculates the average of the time differences of a predetermined number of consecutive adjacent running times;
[0062] Step S508: The target module determines whether the ratio of the average value to the shortest operation period is less than a threshold. If yes, step S510 is executed.
[0063] In step S510 , the target module resets time 0, runs all functions, and re-determines the time for instructing the hard timer to wake up the target module next time.
[0064] Through the above steps, since the ratio of the average time difference between adjacent running moments to the shortest running cycle is less than the threshold, the running moments are aligned by running all functions, thereby avoiding the target module from being frequently woken up in a short period of time, reducing the number of times the target module is woken up, and reducing the energy consumption of the device.
[0065] The following describes the module wake-up method of the present invention in combination with a specific embodiment, taking the module including two functions, function A and function B, as an example. Figure 6 This is the process of the module wake-up method according to an embodiment of the present invention. Figure 4 ,like Figure 6 As shown, the process includes the following steps:
[0066] Step S602: Function A sends a registration request to the target platform, and registers the execution period T1 corresponding to Function A, the timestamp t1 when Function A sends the registration request, and the callback function corresponding to Function A with the module;
[0067] Step S604, determining whether function A is successfully registered on the target platform, if yes, executing step S608, if not, executing step S606;
[0068] In step S606, the module (i.e., the aforementioned target module) instructs the hard timer to wake up the module at a time T1 from the current time. The module calls function A to send a registration request to the target platform again. If the registration is successful, the registration success time is updated to t1.
[0069] Step S608: Function B sends a registration request to the target platform, and registers the execution period T2 corresponding to Function B, the timestamp t2 when Function B sends the registration request, and the callback function corresponding to Function B with the module;
[0070] Step S610, determining whether function B is successfully registered on the target platform, if yes, executing step S614, if not, executing step S612;
[0071] Step S612: The module instructs the hard timer to wake up the module at a time T2 from the current time, invokes function B to send a registration request to the target platform again, and updates the registration success time to t2 if the registration is successful.
[0072] In step S614, the module determines the execution time corresponding to function A based on T1 and t1, and determines the execution time corresponding to function B based on T2 and t2;
[0073] In step S616 , the module calculates the function execution time closest to the current time, and instructs the hard timer to wake up the module at the most recent execution time.
[0074] In the above steps, when the module includes multiple functions, if the previous function is successfully registered, the next function is registered. Exemplarily, when the multiple functions include function A, function B, function C, and function D, if function A is successfully registered, function B is registered. Exemplarily, when the module includes multiple functions, if the multiple functions are successfully registered in sequence, the module calculates the function execution time closest to the current time and instructs the hard timer to wake up the module at the most recent execution time. Exemplarily, the method of determining that the function registration is successful includes but is not limited to: determining that the function registration is successful when a response message returned by the target platform is received.
[0075] In step S616, the module includes but is not limited to calculating the function execution time closest to the current time by: after the function B is successfully registered, the hard timer is turned off, and the time interval t from the next timer wake-up module to the time when timing is started again is calculated by the following formula, where the value of T is the time when the function B is successfully registered.
[0076] t=Min(((t1+T1)-T),((t2+T2)-T));
[0077] After calculating t, t1 and t2 are updated to the time when timing starts again.
[0078] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0079] In this embodiment, a module wake-up device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. The details that have been described will not be repeated here. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
[0080] Figure 7 is a structural block diagram of a module wake-up device according to an embodiment of the present invention, such as Figure 7 As shown, the device is applied to a target module, in which multiple functional modules are registered. The multiple functional modules reuse the same hardware timer, and the hardware timer is used to wake up the target module to call the functional modules to perform corresponding operations. The device includes: a first determining module 72, which is used to determine the remaining call time of each functional module when the wake-up time sending condition is met, wherein the remaining call time is used to indicate the remaining time between the time when the functional module is next called and the current time; a second determining module 74, which is used to determine the functional module with the shortest remaining call time from the multiple functional modules based on the remaining call time of each functional module, as the target functional module; a sending module 76, which is used to determine the target wake-up time based on the time when the target functional module is next called, and send the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein the target module enters a dormant state after sending the target wake-up time to the hardware timer.
[0081] In an optional embodiment, the device also includes: a third determination module, used to determine the length of time from the target wake-up time to the current moment after determining the target wake-up time based on the moment when the target function module is called next time; a fourth determination module, used to determine the priority of the target function module when the length of time from the target wake-up time to the current moment meets a predetermined condition; and a first calling module, used to execute the operation of calling the target function module based on the priority of the target function module.
[0082] In an optional embodiment, the fourth determination module includes: a first determination unit, configured to determine the priority of the target functional module when the duration between the target wake-up time and the current moment meets a predetermined condition, including: determining the priority of the target functional module when it is determined that the duration between the target wake-up time and the current moment is less than a first preset duration;
[0083] The first calling module includes: a calling unit, which is used to directly call the target function module to perform the target operation when the priority of the target function module is the first priority, wherein the function module with the first priority is a module that allows adjustment of the function execution cycle.
[0084] In an optional embodiment, the sending module 76 includes: a sending unit, which is used to send the target wake-up time to the hardware timer when the priority of the target functional module is the second priority, so as to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein the functional module with the second priority is a module that is not allowed to adjust the function execution cycle.
[0085] In an optional embodiment, the device further includes: an acquisition module for acquiring attribute information of multiple functional modules; a judgment module for judging whether it is allowed to adjust the function execution cycle of each functional module based on the attribute information of each functional module, and obtaining a judgment result; and a setting module for setting the priority of each functional module based on the judgment result.
[0086] In an optional embodiment, the first determination module 72 includes: a second determination unit, used to determine the remaining call time of each functional module based on the execution cycle of each registered functional module recorded in the target module, and the historical timestamp of each functional module, wherein, if the functional module has been called before, the historical timestamp indicates the time when the functional module was last called; if the functional module has not been called before, the historical timestamp indicates the registration time of the functional module.
[0087] In an optional embodiment, the wake-up time delivery condition includes at least one of the following: the target module completes calling any one of the multiple functional modules; any one of the multiple functional modules successfully registers with the target module.
[0088] In an optional embodiment, the device method further includes: a calling module, configured to call the plurality of functional modules when a timestamp synchronization condition is met, so as to update the historical timestamp of each functional module to the current moment.
[0089] In an optional embodiment, the timestamp synchronization condition includes at least one of the following: the time between the current moment and the moment when any functional module included in the multiple functional modules is first called reaches a second preset time; a timestamp synchronization instruction is received.
[0090] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0091] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any one of the above method embodiments when running.
[0092] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0093] An embodiment of the present invention further provides a camera, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any one of the above method embodiments.
[0094] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above method embodiments are implemented.
[0095] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail here.
[0096] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, can be centralized on a single computing device, or can be distributed across a network of multiple computing devices. They can be implemented using program code executable by the computing device, and thus, can be stored in a storage device and executed by the computing device. In some cases, the steps shown or described herein can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0097] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A module wake-up method, characterized in that: Applied to a target module, wherein multiple functional modules are registered in the target module, and the multiple functional modules reuse the same hardware timer, and the hardware timer is used to wake up the target module to call the functional modules to perform corresponding operations. The method includes: When the wake-up time delivery condition is met, determining the remaining call time of each functional module, wherein the remaining call time is used to indicate the remaining time between the next call time of the functional module and the current time; Based on the remaining call time of each of the functional modules, determining a functional module with the shortest remaining call time among the multiple functional modules as a target functional module; A target wake-up time is determined based on the moment when the target functional module is called next time, and the target wake-up time is sent to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives. After the target module sends the target wake-up time to the hardware timer, the target module enters a sleep state.
2. The method according to claim 1, characterized in that After determining the target wake-up time based on the time when the target functional module is next called, the method further includes: Determine the distance between the target wake-up time and the current time; When the time between the target wake-up time and the current time satisfies a predetermined condition, determining the priority of the target functional module; An operation of calling the target functional module is performed based on the priority of the target functional module.
3. The method according to claim 2, characterized in that If the time length between the target wake-up time and the current moment satisfies a predetermined condition, determining the priority of the target functional module includes: if it is determined that the time length between the target wake-up time and the current moment is less than a first preset time length, determining the priority of the target functional module; The operation of calling the target function module based on the priority of the target function module includes: when the priority of the target function module is the first priority, directly calling the target function module to execute the target operation, wherein the function module with the first priority is a module that allows adjustment of the function execution cycle.
4. The method according to claim 3, characterized in that Sending the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives includes: When the priority of the target functional module is the second priority, the target wake-up time is sent to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein the functional module with the second priority is a module that is not allowed to adjust the function execution cycle.
5. The method according to claim 3, characterized in that The method further comprises: Acquiring attribute information of a plurality of said functional modules; determining whether to allow adjustment of the function execution period of each functional module based on the attribute information of each functional module, and obtaining a determination result; The priority of each of the functional modules is set based on the judgment result.
6. The method according to claim 1, characterized in that Determining the remaining call time of each of the functional modules includes: Based on the execution cycle of each registered functional module recorded in the target module and the historical timestamp of each functional module, the remaining calling time of each functional module is determined, wherein, if the functional module has been called before, the historical timestamp indicates the time when the functional module was last called; if the functional module has not been called before, the historical timestamp indicates the registration time of the functional module.
7. The method according to claim 1, characterized in that The conditions for issuing the wake-up time include at least one of the following: The target module completes calling any one of the plurality of functional modules; Any one of the plurality of functional modules is successfully registered with the target module.
8. The method according to claim 1, characterized in that The method further comprises: When the timestamp synchronization condition is met, the plurality of function modules are called to update the historical timestamp of each function module to the current time.
9. The method according to claim 8, characterized in that The timestamp synchronization condition includes at least one of the following: The time between the current moment and the moment when any functional module included in the plurality of functional modules is first called reaches a second preset time; Received a timestamp synchronization instruction.
10. A module wake-up device, characterized in that: Applied to a target module, wherein multiple functional modules are registered in the target module, and the multiple functional modules reuse the same hardware timer, and the hardware timer is used to wake up the target module to call the functional modules to perform corresponding operations, the device includes: A first determining module is configured to determine a remaining call time of each of the functional modules when a wake-up time delivery condition is met, wherein the remaining call time indicates a remaining time between the next call time of the functional module and the current time; a second determining module, configured to determine, based on the remaining call time of each of the functional modules, a functional module with the shortest remaining call time among the plurality of functional modules as a target functional module; A sending module is used to determine a target wake-up time based on the moment when the target functional module is next called, and send the target wake-up time to the hardware timer to instruct the hardware timer to wake up the target module when the target wake-up time arrives, wherein, after the target module sends the target wake-up time to the hardware timer, the target module will enter a sleep state.
11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.
12. A camera comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.
13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Monitoring module for computer operation system
CN104360913A
Timer calling method, device and equipment and computer readable storage medium
CN112817723A