CN107967178B - Resource allocation method, resource allocation device, mobile terminal and medium - Google Patents

Resource allocation method, resource allocation device, mobile terminal and medium Download PDF

Info

Publication number
CN107967178B
CN107967178B CN201711276869.9A CN201711276869A CN107967178B CN 107967178 B CN107967178 B CN 107967178B CN 201711276869 A CN201711276869 A CN 201711276869A CN 107967178 B CN107967178 B CN 107967178B
Authority
CN
China
Prior art keywords
operating system
time length
adjustment amount
resource
camera
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201711276869.9A
Other languages
Chinese (zh)
Other versions
CN107967178A (en
Inventor
陈岩
程杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201711276869.9A priority Critical patent/CN107967178B/en
Publication of CN107967178A publication Critical patent/CN107967178A/en
Application granted granted Critical
Publication of CN107967178B publication Critical patent/CN107967178B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources

Abstract

The embodiment of the application discloses a resource allocation method and a related product. The method comprises the following steps: the method comprises the steps that an operating system detects that a target Application Programming Interface (API) applies for camera hardware, and obtains reference duration corresponding to at least one operation in the camera previewing process; the operating system determines the adjustment amount of system resources in the camera preview process according to the actual processing time of at least one operation and the corresponding reference time length; and the operating system adjusts the configuration of the system resources according to the adjustment amount. The embodiment of the application is beneficial to improving the refinement degree of the system resource allocation of the mobile terminal and realizing the balance control between the performance and the power consumption.

Description

Resource allocation method, resource allocation device, mobile terminal and medium
Technical Field
The present application relates to the field of mobile terminal technologies, and in particular, to a resource allocation method, a resource allocation apparatus, a mobile terminal, and a medium.
Background
With the rapid development of related technologies of smart phones, more and more applications are installed in user mobile phones, such as reading applications, payment applications, game applications, music applications, and the like, and people's clothes and eating habits are inseparable from mobile phones.
Disclosure of Invention
The embodiment of the application provides a resource allocation method and a related product, which can improve the refinement degree of system resource allocation of a mobile terminal and realize balance control between performance and power consumption.
In a first aspect, an embodiment of the present application provides a resource allocation method, which is applied to a mobile terminal, where an operating system and one or more application programs are run on the mobile terminal, and the method includes:
the operating system detects that a target Application Programming Interface (API) applies for camera hardware, and acquires reference duration corresponding to at least one operation in the camera preview process;
the operating system determines the adjustment amount of the system resources in the camera previewing process according to the actual processing time length of the at least one operation and the corresponding reference time length;
and the operating system adjusts the configuration of the system resource according to the adjustment amount.
In a second aspect, an embodiment of the present application provides a resource allocation apparatus, which is applied to a mobile terminal, where the mobile terminal runs an operating system and one or more application programs, and the resource allocation apparatus includes an obtaining unit, a determining unit, and an adjusting unit, where,
the acquisition unit is used for detecting that a target Application Programming Interface (API) applies for camera hardware and acquiring reference time length corresponding to at least one operation in the camera preview process;
the determining unit is configured to determine an adjustment amount of the system resource in the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration;
and the adjusting unit is used for adjusting the configuration of the system resource according to the adjusting amount.
In a third aspect, an embodiment of the present application provides a mobile terminal, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing steps of any method in the first aspect of the embodiment of the present application.
In a fourth aspect, the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, where the computer program enables a computer to perform some or all of the steps described in any one of the methods of the first aspect of the present application, and the computer includes a mobile terminal.
In a fifth aspect, the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform some or all of the steps as described in any one of the methods of the first aspect of the embodiments of the present application. The computer program product may be a software installation package, the computer comprising a mobile terminal.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
Drawings
Reference will now be made in brief to the accompanying drawings, to which embodiments of the present application relate.
Fig. 1A is a schematic structural diagram of a smart phone provided in an embodiment of the present application;
FIG. 1B is a schematic diagram of a program operating space of a smart phone;
FIG. 1C is a system architecture diagram of an android system;
fig. 2 is a schematic flowchart of a resource allocation method according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a resource allocation method according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating a resource allocation method according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a mobile terminal disclosed in an embodiment of the present application;
fig. 6 is a block diagram of functional units of a resource allocation apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
Fig. 1A is a schematic structural diagram of a smart phone 100 according to an embodiment of the present application, where the smart phone 100 includes: casing 110, touch-sensitive display screen 120, mainboard 130, battery 140 and subplate 150, be provided with leading camera 131 on mainboard 130, Chip level System (SoC) 132 (including application processor and baseband processor), memory 133, power management Chip 134, radio frequency System 135 etc. on the mainboard, be provided with oscillator 151, integrative sound chamber 152, VOOC dodges and fills interface 153 and fingerprint identification module 154 on the subplate.
The SoC132 is a control center of the smartphone, connects various parts of the entire smartphone by using various interfaces and lines, and executes various functions and processes data of the smartphone by running or executing software programs and/or modules stored in the memory 133 and calling data stored in the memory 133, thereby integrally monitoring the smartphone. The SoC132 may include one or more processing units, such as an application processor AP, a baseband processor (also referred to as a baseband chip, baseband), and the like, which mainly handles operating systems, user interfaces, application programs, and the like, and the baseband processor mainly handles wireless communications. It will be appreciated that the baseband processor described above may not be integrated into SoC 132. The SoC132 may be, for example, a Central Processing Unit (CPU), a general purpose Processor, a Digital Signal Processor (DSP), an Application-Specific integrated circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor described above may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs and microprocessors, and the like.
The memory 133 may be used to store software programs and modules, and the SoC132 executes various functional applications and data processing of the smart phone by running the software programs and modules stored in the memory 133. The memory 133 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the smartphone, and the like. Further, the memory 133 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. The Memory 133 may be, for example, a Random Access Memory (RAM), a flash Memory, a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a register, a hard disk, a removable hard disk, a compact disc Read Only Memory (CD-ROM), or any other form of storage medium known in the art.
The Mobile terminal according to the embodiment of the present application may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem, and various forms of User Equipment (UE), Mobile Stations (MS), terminal devices (terminal device), and the like. For convenience of description, the above-mentioned devices are collectively referred to as a mobile terminal. The operating system related to the embodiment of the invention is a software system which performs unified management on hardware resources and provides a service interface for a user.
Fig. 1B is a schematic diagram of a program running space of a smart phone according to an embodiment of the present application, where a mobile terminal such as a smart phone is generally provided with a program running space, and the program running space includes a user space and an operating system space, where the user space runs one or more application programs, the one or more application programs are third-party application programs installed on the mobile terminal, and the operating system space runs an operating system of the mobile terminal. The mobile terminal can specifically run an Android system, a mobile operating system iOS developed by apple Inc., and the like, and the mobile terminal is not limited herein. As shown in fig. 1C, for example that the mobile terminal runs the Android system, the corresponding user space includes Application layers (Applications) in the Android system, and the operating system space may include an Application Framework layer (Application Framework) in the Android system, a system Runtime library layer (including system Runtime Libraries and Android Runtime runtimes), and a Linux Kernel layer (Linux Kernel). The application layer comprises various application programs which are directly interacted with the user or service programs which are written by Java language and run in the background. For example, programs that implement common basic functions on smartphones, such as Short Messaging Service (SMS) SMS, phone dialing, picture viewer, calendar, games, maps, World Wide Web (Web) browser, and other applications developed by developers. The application framework layer provides a series of class libraries required by Android application development, can be used for reusing components, and can also realize personalized extension through inheritance. And the system operation library layer is a support of an application program framework and provides services for each component in the Android system. The system operation library layer is composed of a system class library and Android operation. The Android runtime comprises two parts, namely a core library and a Dalvik virtual machine. The Linux kernel layer is used for realizing core functions such as hardware device driving, process and memory management, a network protocol stack, power management, wireless communication and the like.
The process created by the third-party application program is initially run in the user space, and when it is to perform the actions of sending data through the network, reading disk resources and the like, it must be completed by calling the standard interface functions provided by the operating system, such as write, send and the like, that is, the CPU calls the code of the operating system space to complete the requested operation of the user. It can be seen that the third party application program wants to call the function provided by the operating system, and can only call the standard interface function provided by the third party application program. Meanwhile, the operating system does not know which functions the third-party application specifically executes, and the target application cannot command the operating system to execute special operations, which are independent from each other, so that the operating system cannot distinguish the internal operating scene of the target application, can only use one set of standard parameters for adaptation, and cannot perform targeted performance optimization for the internal operating scene of the target application.
In view of the above situation, an embodiment of the present application provides a resource configuration method for a target application of a mobile terminal, in which an operating system of the mobile terminal first detects that an API of the target application applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
Embodiments of the present application will be described below with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a flowchart illustrating a resource allocation method according to an embodiment of the present application, where an operating system and one or more application programs run on the mobile terminal, as shown in the figure, the resource allocation method includes:
s201, the operating system detects that a target Application Programming Interface (API) applies for camera hardware, and obtains reference time length corresponding to at least one operation in the camera previewing process.
The target application program refers to a third-party application program installed in a user space of the mobile terminal, the third-party application program may be, for example, a camera application program, an instant messaging application, a game application, or the like, and the third-party application program may be installed by a user or may be pre-installed by a developer before the mobile terminal leaves a factory, which is not limited herein. The camera hardware comprises a front camera or a rear camera and other peripherals. The camera preview process refers to a process that the mobile terminal collects image information in a shooting range through camera hardware and displays the image information on a camera preview interface, the process is involved in various scenes such as shooting, chatting and video, and specific scenes related to the camera hardware are not limited.
Wherein the at least one operation comprises at least one of: interface content acquisition operation, interface rendering operation and interface display operation.
S202, the operating system determines the adjustment amount of the system resources in the camera previewing process according to the actual processing time length of the at least one operation and the corresponding reference time length.
The reference processing duration refers to the longest processing duration that guarantees the lowest frame rate of the camera preview interface, that is, the longest processing duration that guarantees the camera preview interface not to be stuck at the lowest, and the processing duration may be an empirical value, and is also preset by a manufacturer or a user, and is not limited uniquely here.
Wherein the system resources include at least one of: CPU resources, GPU resources, memory bandwidth resources and disk resources.
S203, the operating system adjusts the configuration of the system resource according to the adjustment amount.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
In one possible example, the determining, by the operating system, an adjustment amount of a system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration includes: when the operating system detects that the actual processing time length of the at least one operation is greater than the corresponding reference time length and a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an adjustment amount of the system resource in the camera previewing process;
the operating system adjusts the configuration of the system resource according to the adjustment amount, and the method comprises the following steps: and the operating system additionally applies for system resources corresponding to the adjustment quantity to run the camera preview process.
The first preset difference may be obtained by multiplying the reference processing time length by a preset coefficient, and if the reference processing time length is 30ms and the coefficient is 0.2, the first preset difference is 6 ms. The first preset difference value can ensure that the operating system stably runs the camera preview process when the first difference value is small, and can timely adjust resources for adaptation when the first difference value is large, so that the stability of resource configuration is improved.
In a specific implementation, before applying for an additional system resource, the mobile terminal may first detect a resource amount of a remaining system resource of the current system, if the resource amount of the remaining system resource is greater than the adjustment amount, the operating system may directly configure, and if the resource amount of the remaining system resource is less than the adjustment amount, the operating system needs to release more system resources, specifically, may clear a background application program to release the system resource.
As can be seen, in this example, for the situation that the actual processing time is long, the mobile terminal can determine the adjustment amount at an appropriate time in time, and additionally apply for the system resource corresponding to the adjustment amount to run the camera preview process, so that the camera preview process is not jammed, and the stability of resource configuration is improved.
In this possible example, the operating system determining an amount of up-adjustment of a system resource of the camera preview process includes: and the operating system determines the up-regulation adjustment quantity of the system resource of the camera preview process according to the first difference value.
The influence degree of the system resource on the operation performance can be obtained through testing or historical record analysis, so that the operating system can obtain the corresponding relationship between the resource amount of the system resource and the performance influence factor, the performance influence factor can include the processing time length, and the operating system can further query the mapping relationship to determine the resource amount of the system resource corresponding to the first difference, namely the corresponding upward adjustment amount of the system resource in the camera preview process.
As can be seen, in this example, the operating system can accurately determine the amount of adjustment of the system resource in the camera preview process by using the first difference, and the accuracy is high and the error is small.
In this possible example, after the operating system adjusts the configuration of the system resource according to the adjustment amount, the method further includes: the operating system acquires a frame loss record of the camera preview process; and the operating system adjusts the first preset difference value downwards according to the frame loss record.
The operating system may record a frame loss record of the camera preview process, where the frame loss record may specifically include information such as the frame number or frequency of frame loss. In a specific implementation, the operating system may determine the adjustment amount of the first preset difference according to the number of frame loss, and perform down-regulation.
It can be seen that in this example, after the operating system adjusts the system resources, the camera preview process still has frame loss, and by adjusting the first preset difference value downward, the operating system can perform optimal configuration on the process earlier, so that the frame loss probability is reduced as much as possible, and the resource configuration efficiency and accuracy are improved.
In one possible example, the determining, by the operating system, an adjustment amount of a system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration includes: when the operating system detects that the actual processing time length of the at least one operation is smaller than the corresponding reference time length and a second difference value between the actual processing time length of the at least one operation and the corresponding reference time length is larger than a second preset difference value, determining a downward adjustment amount of system resources in the camera previewing process;
the operating system adjusts the configuration of the system resource according to the adjustment amount, and the method comprises the following steps: and the operating system releases the system resource corresponding to the down-regulation adjustment amount from the system resource configured in the camera preview process.
The second preset difference may be obtained by multiplying the reference processing time length by a preset coefficient, and if the reference processing time length is 20ms and the coefficient is 0.5, the second preset difference is 10 ms. The second preset difference value can ensure that the operating system stably runs the camera preview process when the second difference value is smaller, and can release idle system resources in time to reduce power consumption when the second difference value is larger.
It can be seen that, in this example, the operating system releases the system resources by the second difference value, and power consumption is reduced in time.
In this possible example, the operating system determining a downshifting adjustment amount of a system resource of the camera preview process includes: and the operating system determines the downward adjustment amount of the system resource of the camera previewing process according to the difference value.
The influence degree of the system resource on the operation performance can be obtained through testing or historical record analysis, so that the operating system can obtain the corresponding relationship between the resource amount of the system resource and the performance influence factor, wherein the performance influence factor can include the processing duration, and further the operating system can query the mapping relationship to determine the resource amount of the system resource corresponding to the second difference, namely the corresponding down-regulation adjustment amount of the system resource in the camera preview process.
As can be seen, in this example, the operating system may specifically determine the down-regulation adjustment amount of the system resource in the camera preview process accurately through the second difference, and release the idle system resource in time to reduce power consumption, so as to better balance the performance requirement and the actual power consumption.
In this possible example, after the operating system adjusts the configuration of the system resource according to the adjustment amount, the method further includes: the operating system acquires a frame rate record of the camera preview process; and the operating system adjusts the second preset threshold value downwards according to the frame rate record.
The operating system may record a frame rate record of the camera preview process, and the frame rate information may be used to determine whether to drop a frame in combination with a lowest frame rate of the camera preview process. In a specific implementation, the operating system may determine that no frame loss occurs in the camera preview process according to the frame rate record and the lowest frame rate in the camera preview process, and then adjust the second preset threshold downward.
As can be seen, in this example, after the operating system adjusts the system resources, no frame loss occurs in the camera preview process, and by adjusting the second preset difference value downward, the operating system can release idle system resources earlier, thereby reducing power consumption as much as possible.
Referring to fig. 3, fig. 3 is a schematic flowchart of a resource allocation method according to an embodiment of the present application, and the method is applied to a mobile terminal, where the mobile terminal runs an operating system and one or more application programs. As shown in the figure, the resource allocation method includes:
s301, the operating system detects that a target Application Programming Interface (API) applies for camera hardware, and obtains a reference time length corresponding to at least one operation in the camera preview process.
S302, when the operating system detects that the actual processing time length of the at least one operation is greater than the corresponding reference time length and that a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an adjustment amount of the system resource in the camera previewing process.
And S303, the operating system determines the up-regulation adjustment amount of the system resource in the camera previewing process according to the first difference.
S304, the operating system additionally applies for system resources corresponding to the adjustment quantity to run the camera preview process.
S305, the operating system acquires the frame loss record of the camera preview process.
S306, the operating system adjusts the first preset difference value downwards according to the frame loss record.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
In addition, aiming at the situation that the actual processing time is long, the mobile terminal can timely determine the up-regulation adjustment amount at a proper time, and additionally applies for system resources corresponding to the up-regulation adjustment amount to operate the camera preview process, so that the camera preview process is not blocked, and the stability of resource configuration is improved.
In addition, the operating system can accurately determine the up-regulation adjustment quantity of the system resources in the camera preview process through the first difference, and the accuracy is high and the error is small.
In addition, after the operating system adjusts the system resources, the camera previewing process still has frame loss, and the operating system can perform optimized configuration on the process earlier by adjusting the first preset difference value, so that the frame loss possibility is reduced as much as possible, and the resource configuration efficiency and accuracy are improved.
Consistent with the embodiment shown in fig. 2, please refer to fig. 4, where fig. 4 is a flowchart illustrating a resource allocation method provided in an embodiment of the present application, and is applied to a mobile terminal, where the mobile terminal runs an operating system and one or more target application programs, the operating system includes a management module, multiple policy modules, and a data connection management module, each policy module is used to determine a performance improvement policy of an application program in at least one application program of the same application type, the target application program includes a data connection module, the scenario data packet includes a scenario identifier and a key performance parameter of the target application program, and the scenario data packet includes a data format identifier. As shown in the figure, the resource allocation method includes:
s401, the operating system detects that a target Application Programming Interface (API) applies for camera hardware, and obtains a reference duration corresponding to at least one operation in the camera preview process.
S402, when the operating system detects that the actual processing time length of the at least one operation is smaller than the corresponding reference time length and a second difference between the actual processing time length of the at least one operation and the corresponding reference time length is larger than a second preset difference, determining a downward adjustment amount of the system resources in the camera previewing process.
And S403, the operating system determines the downward adjustment amount of the system resource in the camera previewing process according to the difference.
S404, the operating system releases the system resource corresponding to the down-regulation adjustment amount from the system resource configured in the camera preview process.
S405, the operating system acquires a frame rate record of the camera preview process.
S406, the operating system adjusts the second preset threshold value downwards according to the frame rate record.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
In addition, the operating system releases the system resources by the second difference value, and reduces power consumption in time.
In addition, the operating system can accurately determine the down-regulation adjustment amount of the system resources in the camera preview process through the second difference value, and timely release the idle system resources to reduce power consumption, so that the performance requirement and the actual power consumption are well balanced.
In addition, after the operating system adjusts the system resources, frame loss does not occur in the camera preview process, and the operating system can release idle system resources earlier by adjusting the second preset difference value downwards, so that the power consumption is reduced as much as possible.
In accordance with the embodiments shown in fig. 2, fig. 3, and fig. 4, please refer to fig. 5, and fig. 5 is a schematic structural diagram of a mobile terminal provided in an embodiment of the present application, where the mobile terminal runs one or more application programs and an operating system, and as shown in the figure, the mobile terminal includes a processor, a memory, a communication interface, and one or more programs, where the one or more programs are different from the one or more application programs, and the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for performing the following steps;
detecting that a target Application Programming Interface (API) applies for camera hardware, and acquiring reference duration corresponding to at least one operation in the camera preview process;
determining the adjustment amount of the system resources of the camera preview process according to the actual processing time length of the at least one operation and the corresponding reference time length;
and adjusting the configuration of the system resource according to the adjustment amount.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
In one possible example, in terms of determining the adjustment amount of the system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration, the instructions in the program are specifically configured to perform the following operations: when detecting that the actual processing time length of the at least one operation is greater than the corresponding reference time length and a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an up-regulation adjustment amount of system resources in the camera preview process;
in terms of the adjusting the configuration of the system resources according to the adjustment amount, the instructions in the program are specifically configured to: and additionally applying for system resources corresponding to the up-regulation adjustment quantity to run the camera preview process.
In this possible example, in terms of the determining the amount of adjustment to the up-scaling of the system resources of the camera preview process, the instructions in the program are specifically configured to: and determining the up-regulation adjustment amount of the system resource in the camera preview process according to the first difference.
In this possible example, the program further includes instructions for: after the configuration of the system resources is adjusted according to the adjustment quantity, acquiring a frame loss record of the camera preview process; and adjusting the first preset difference value downwards according to the frame loss record.
In one possible example, in terms of determining the adjustment amount of the system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration, the instructions in the program are specifically configured to perform the following operations: determining a downward adjustment amount of the system resource in the camera preview process when detecting that the actual processing time length of the at least one operation is smaller than the corresponding reference time length and a second difference between the actual processing time length of the at least one operation and the corresponding reference time length is larger than a second preset difference;
in terms of the adjusting the configuration of the system resources according to the adjustment amount, the instructions in the program are specifically configured to: and releasing the system resource corresponding to the down regulation adjustment amount from the system resource configured in the camera preview process.
In this possible example, in terms of the determining a downshifting adjustment amount of a system resource of the camera preview process, the instructions in the program are specifically configured to: and determining the downward adjustment amount of the system resources in the camera previewing process according to the difference.
In this possible example, the program further includes instructions for: after the configuration of the system resource is adjusted according to the adjustment amount, acquiring a frame rate record of the camera preview process; and adjusting the frame rate record downwards according to the second preset threshold value.
In one possible example, the target application is a camera application;
the at least one operation includes at least one of: interface content acquisition operation, interface rendering operation and interface display operation;
the system resources include at least one of: CPU resources, GPU resources, memory bandwidth resources and disk resources.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the mobile terminal includes hardware structures and/or software modules for performing the respective functions in order to implement the above-described functions. Those of skill in the art would readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the mobile terminal may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
In case of integrated units, fig. 6 shows a block diagram of a possible functional unit composition of the resource configuration device involved in the above-described embodiment. The resource allocation apparatus 600 is applied to a mobile terminal, and includes: an acquisition unit 601, a determination unit 602, and an adjustment unit 603, wherein,
the acquiring unit 601 is configured to detect that a target application programming interface API applies for camera hardware, and acquire a reference duration corresponding to at least one operation in a camera preview process;
the determining unit 602 is configured to determine an adjustment amount of the system resource in the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration;
the adjusting unit 603 is configured to adjust the configuration of the system resource according to the adjustment amount.
It can be seen that, in the embodiment of the present application, an operating system of a mobile terminal first detects that a target application programming interface API applies for camera hardware, obtains a reference duration corresponding to at least one operation in a camera preview process, then determines an adjustment amount of system resources in the camera preview process according to an actual processing duration of the at least one operation and the corresponding reference duration, and finally adjusts configuration of the system resources according to the adjustment amount. Therefore, the operating system can adjust the configuration of the system resources more finely through time length comparison in a refined operation level included in the camera preview process, the refinement degree of the system resource configuration performed by the mobile terminal is improved, and the adjustment amount can be used for applying for more system resources and releasing the system resources, so that balance control between performance and power consumption is realized.
In a possible example, in terms of the determining, according to the actual processing duration of the at least one operation and the corresponding reference duration, an adjustment amount of the system resource of the camera preview process, the determining unit 602 is specifically configured to: when detecting that the actual processing time length of the at least one operation is greater than the corresponding reference time length and a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an up-regulation adjustment amount of system resources in the camera preview process;
in terms of the adjusting the configuration of the system resource according to the adjustment amount, the adjusting unit 603 is specifically configured to: and additionally applying for system resources corresponding to the up-regulation adjustment quantity to run the camera preview process.
In this possible example, in terms of the determining the amount of adjustment of the system resource of the camera preview process, the determining unit 602 is specifically configured to: and determining the up-regulation adjustment amount of the system resource in the camera preview process according to the first difference.
In this possible example, the obtaining unit 601 is further configured to obtain a frame loss record of the camera preview process after the adjusting unit 603 adjusts the configuration of the system resource according to the adjustment amount;
the adjusting unit 603 is further configured to adjust the first preset difference downward according to the frame loss record.
In a possible example, in terms of the determining, according to the actual processing duration of the at least one operation and the corresponding reference duration, an adjustment amount of the system resource of the camera preview process, the determining unit 602 is specifically configured to: determining a downward adjustment amount of the system resource in the camera preview process when detecting that the actual processing time length of the at least one operation is smaller than the corresponding reference time length and a second difference between the actual processing time length of the at least one operation and the corresponding reference time length is larger than a second preset difference;
the adjusting unit 603 is specifically configured to: and releasing the system resource corresponding to the down regulation adjustment amount from the system resource configured in the camera preview process.
In this possible example, in terms of the determining the adjustment amount of the system resource of the camera preview process, the determining unit 602 is specifically configured to: and determining the downward adjustment amount of the system resources in the camera previewing process according to the difference.
In this possible example, the obtaining unit 601, after the adjusting unit 603 adjusts the configuration of the system resource according to the adjustment amount, is further configured to obtain a frame rate record of the camera preview process;
the adjusting unit 603 is further configured to adjust the frame rate according to the second preset threshold.
In one possible example, the target application is a camera application;
the at least one operation includes at least one of: interface content acquisition operation, interface rendering operation and interface display operation;
the system resources include at least one of: CPU resources, GPU resources, memory bandwidth resources and disk resources.
The acquiring unit 601 and the adjusting unit 603 may be processors, and the determining unit 602 may be an application processor and a memory.
Embodiments of the present application also provide a computer storage medium, where the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes a mobile terminal.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising a mobile terminal.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (9)

1. A resource allocation method is applied to a mobile terminal, wherein the mobile terminal runs an operating system and one or more application programs, and the method comprises the following steps:
the operating system detects that a target Application Programming Interface (API) applies for camera hardware, and acquires reference duration corresponding to at least one operation in the camera preview process;
the operating system determines the adjustment amount of the system resources in the camera previewing process according to the actual processing time length of the at least one operation and the corresponding reference time length;
the operating system adjusts the configuration of the system resource according to the adjustment amount;
wherein, the operating system determines the adjustment amount of the system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration, and the method comprises the following steps:
when the operating system detects that the actual processing time length of the at least one operation is greater than the corresponding reference time length and a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an adjustment amount of the system resource in the camera previewing process;
alternatively, the first and second electrodes may be,
and when the operating system detects that the actual processing time length of the at least one operation is smaller than the corresponding reference time length and a second difference between the actual processing time length of the at least one operation and the corresponding reference time length is larger than a second preset difference, determining a downward adjustment amount of the system resource in the camera previewing process.
2. The method of claim 1,
the operating system adjusts the configuration of the system resource according to the adjustment amount, and the method comprises the following steps:
and the operating system additionally applies for system resources corresponding to the adjustment quantity to run the camera preview process.
3. The method of claim 2, wherein after the operating system adjusts the configuration of the system resources according to the adjustment amount, the method further comprises:
the operating system acquires a frame loss record of the camera preview process;
and the operating system adjusts the first preset difference value downwards according to the frame loss record.
4. The method of claim 1,
the operating system adjusts the configuration of the system resource according to the adjustment amount, and the method comprises the following steps:
and the operating system releases the system resource corresponding to the down-regulation adjustment amount from the system resource configured in the camera preview process.
5. The method of claim 4, wherein after the operating system adjusts the configuration of the system resources according to the adjustment amount, the method further comprises:
the operating system acquires a frame rate record of the camera preview process;
and the operating system adjusts the second preset threshold value downwards according to the frame rate record.
6. The method of any of claims 1-5, wherein the target application is a camera application;
the at least one operation includes at least one of: interface content acquisition operation, interface rendering operation and interface display operation;
the system resources include at least one of: CPU resource of CPU, GPU resource of GPU, bandwidth resource of memory, and disk resource.
7. A resource allocation device is applied to a mobile terminal, the mobile terminal runs an operating system and one or more application programs, the resource allocation device comprises an acquisition unit, a determination unit and an adjustment unit, wherein,
the acquisition unit is used for detecting that a target Application Programming Interface (API) applies for camera hardware and acquiring reference time length corresponding to at least one operation in the camera preview process;
the determining unit is configured to determine an adjustment amount of the system resource in the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration;
the adjusting unit is used for adjusting the configuration of the system resource according to the adjusting amount;
wherein, the determining the adjustment amount of the system resource of the camera preview process according to the actual processing duration of the at least one operation and the corresponding reference duration comprises:
when detecting that the actual processing time length of the at least one operation is greater than the corresponding reference time length and a first difference between the actual processing time length of the at least one operation and the corresponding reference time length is greater than a first preset difference, determining an up-regulation adjustment amount of system resources in the camera preview process;
alternatively, the first and second electrodes may be,
and determining a downward adjustment amount of the system resource in the camera previewing process when the actual processing time length of the at least one operation is detected to be smaller than the corresponding reference time length and a second difference value between the actual processing time length of the at least one operation and the corresponding reference time length is detected to be larger than a second preset difference value.
8. A mobile terminal comprising a processor, memory, a communications interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, the programs comprising instructions for performing the steps of the method of any of claims 1-6.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program causes a computer to perform the method according to any one of claims 1-6, the computer comprising a mobile terminal.
CN201711276869.9A 2017-12-06 2017-12-06 Resource allocation method, resource allocation device, mobile terminal and medium Active CN107967178B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711276869.9A CN107967178B (en) 2017-12-06 2017-12-06 Resource allocation method, resource allocation device, mobile terminal and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711276869.9A CN107967178B (en) 2017-12-06 2017-12-06 Resource allocation method, resource allocation device, mobile terminal and medium

Publications (2)

Publication Number Publication Date
CN107967178A CN107967178A (en) 2018-04-27
CN107967178B true CN107967178B (en) 2020-03-17

Family

ID=61998833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711276869.9A Active CN107967178B (en) 2017-12-06 2017-12-06 Resource allocation method, resource allocation device, mobile terminal and medium

Country Status (1)

Country Link
CN (1) CN107967178B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144728B (en) 2018-08-22 2020-11-06 Oppo广东移动通信有限公司 Occupancy control method and device for camera application

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014200655A1 (en) * 2013-06-09 2014-12-18 Apple Inc. Initiating background updates based on user activity
WO2016195877A1 (en) * 2015-06-04 2016-12-08 Intel Corporation Graphics processor power management contexts & sequential control loops

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7784054B2 (en) * 2004-04-14 2010-08-24 Wm Software Inc. Systems and methods for CPU throttling utilizing processes
JP2017041191A (en) * 2015-08-21 2017-02-23 富士通株式会社 Resource management apparatus, resource management program, and resource management method
CN106549880A (en) * 2016-11-25 2017-03-29 珠海市魅族科技有限公司 A kind of resource allocation methods and terminal unit of terminal
CN106874168A (en) * 2017-01-12 2017-06-20 北京奇虎科技有限公司 Determine method, device and the mobile terminal of application program runnability
CN107368400B (en) * 2017-08-01 2020-02-04 Oppo广东移动通信有限公司 CPU monitoring method and device, computer readable storage medium and mobile terminal

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014200655A1 (en) * 2013-06-09 2014-12-18 Apple Inc. Initiating background updates based on user activity
WO2016195877A1 (en) * 2015-06-04 2016-12-08 Intel Corporation Graphics processor power management contexts & sequential control loops

Also Published As

Publication number Publication date
CN107967178A (en) 2018-04-27

Similar Documents

Publication Publication Date Title
CN107861816B (en) Resource allocation method and device
CN107547746B (en) Resource allocation method and related product
CN107577533B (en) Resource allocation method and related product
CN107861814B (en) Resource allocation method and equipment
US11698815B2 (en) Method for resource allocation and related products
CN107635078B (en) Game control method and device
CN107450988B (en) Resource allocation method and related product
CN107786748B (en) Image display method and apparatus
CN107797868B (en) Resource adjusting method and device
CN107479970B (en) Resource allocation method and related product
WO2019042171A1 (en) Resource allocation method and product related thereto
CN107807852B (en) Application program performance control method, device and computer readable storage medium
CN107528976B (en) Resource allocation method and related product
WO2019047709A1 (en) Resource configuration method and related product
US10936371B2 (en) Method for resource allocation and related products
CN107832142B (en) Resource allocation method and equipment for application program
WO2019042180A1 (en) Resource allocation method and related product
CN107547745B (en) Resource allocation method and related product
CN107589977B (en) Resource allocation method, resource allocation device, mobile terminal and medium
CN108536480B (en) Input method configuration method and related product
CN107517306B (en) Resource allocation method and related product
WO2019072208A1 (en) Application running control method and device
WO2019047708A1 (en) Resource configuration method and related product
CN108984339B (en) Data recovery method and related product
WO2019076213A1 (en) Network control method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant