WO2020073672A1 - 资源调度方法和终端设备 - Google Patents

资源调度方法和终端设备 Download PDF

Info

Publication number
WO2020073672A1
WO2020073672A1 PCT/CN2019/090573 CN2019090573W WO2020073672A1 WO 2020073672 A1 WO2020073672 A1 WO 2020073672A1 CN 2019090573 W CN2019090573 W CN 2019090573W WO 2020073672 A1 WO2020073672 A1 WO 2020073672A1
Authority
WO
WIPO (PCT)
Prior art keywords
frame
thread
load
drawing thread
frame drawing
Prior art date
Application number
PCT/CN2019/090573
Other languages
English (en)
French (fr)
Inventor
王飞
王振宁
陈海波
成坚
赵鸿江
陈善席
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to JP2020552909A priority Critical patent/JP7195334B2/ja
Priority to EP19870764.8A priority patent/EP3748470A4/en
Priority to KR1020207026994A priority patent/KR102490908B1/ko
Publication of WO2020073672A1 publication Critical patent/WO2020073672A1/zh
Priority to US17/018,551 priority patent/US11765754B2/en
Priority to US18/449,790 priority patent/US20230413304A1/en

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/50Allocation or scheduling criteria for wireless resources
    • H04W72/52Allocation or scheduling criteria for wireless resources based on load
    • 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/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • 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
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • 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/5094Allocation of resources, e.g. of the central processing unit [CPU] where the allocation takes into account power or heat criteria
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/04Wireless resource allocation
    • H04W72/044Wireless resource allocation based on the type of the allocated resource
    • H04W72/0446Resources in time domain, e.g. slots or frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/04Wireless resource allocation
    • H04W72/044Wireless resource allocation based on the type of the allocated resource
    • H04W72/0466Wireless resource allocation based on the type of the allocated resource the resource being a scrambling code
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/12Wireless traffic scheduling
    • H04W72/1263Mapping of traffic onto schedule, e.g. scheduled allocation or multiplexing of flows
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of terminal equipment, and more specifically, to a resource scheduling method and terminal equipment.
  • the traditional solution generally counts the load of the currently executed task of the terminal device in a historical period of time, and then performs resource scheduling for the currently executed task according to the obtained load. For example, when the load of the currently executed task is large, the working frequency of the central processing unit (CPU) can be increased, and when the load of the currently executed task is small, the working frequency of the CPU can be reduced.
  • the traditional scheme is to perform resource scheduling based on the load situation that has occurred for a period of time. The accuracy of resource scheduling is not high, and there is a certain lag.
  • the present application provides a resource scheduling method and terminal equipment for more accurate resource scheduling.
  • a resource scheduling method is provided.
  • the method is applied to a terminal device.
  • the method includes: determining a load characteristic of a frame drawing thread, the frame drawing thread is used to draw an image frame; and according to the load of the frame drawing thread The characteristic determines the target resource scheduling mode; the target resource scheduling mode is used to schedule resources for the frame drawing thread.
  • the above terminal device may be a mobile terminal (for example, a smart phone), a computer, a personal digital assistant, a wearable device, a vehicle-mounted device, an Internet of Things device, and so on.
  • the above terminal device may also be other devices capable of displaying a screen.
  • the above terminal device may be a device running various operating systems.
  • the above terminal device may be a device running an Android system, a device running an IOS system, or a device running a windows system.
  • computing resources can be scheduled for the frame drawing thread (for example, scheduling a core of the CPU to execute the frame drawing thread), or storage resources can be scheduled for the frame drawing thread (for example, Some storage units are scheduled to store data during the running of the frame drawing thread), and computing resources and storage resources can also be scheduled for the frame drawing thread at the same time.
  • the above-mentioned frame drawing thread may be all threads or part of threads for drawing image frames.
  • the frame drawing thread may be determined first.
  • determining the frame drawing thread includes: determining a thread that calls a key function of the frame drawing in the process of drawing the image frame as the frame drawing thread.
  • the above described key functions for drawing frames may refer to some key functions in the process of drawing image frames, and the key functions for drawing frames may be preset.
  • the key function of the frame drawing may be determined according to the type of operating system adopted by the terminal device, and the key function of the frame drawing corresponding to different types of operating systems may be different.
  • the key function of the frame corresponding to the IOS system and Android The key functions of the frame corresponding to the system are different.
  • the target resource scheduling method is determined by the load characteristics of the frame drawing thread, and then the resource scheduling of the frame drawing thread is directly implemented in the target resource scheduling mode, which can be achieved
  • the finer-grained resource scheduling makes resource scheduling more targeted and the effect of resource scheduling is better.
  • the load characteristic of the frame drawing thread is used to indicate the resource requirement characteristic of the frame drawing thread.
  • the resource requirement characteristic of the frame drawing thread may indicate whether the load of the frame drawing thread is computationally intensive or resource intensive, so as to facilitate subsequent determination of the corresponding target resource scheduling mode.
  • the load of the frame drawing thread is a computationally intensive load
  • the computing resources can be mainly scheduled
  • the load of the frame drawing thread is a resource intensive load
  • scheduling When resources are available, storage resources can be mainly scheduled.
  • the load characteristic of the frame drawing thread includes at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread .
  • the load characteristics of the frame drawing thread can be directly obtained, which can be simplified Get the complexity of the load characteristics of the frame drawing thread.
  • one or more of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread can be directly used to represent the load characteristics of the frame drawing thread, or the frame drawing thread can also be used
  • One or more of the parameters such as the average number of cycles per instruction, the number of branch instructions, and the rate of cache misses among the parameters represent the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is based on the average cost of the frame drawing thread in a first time interval (or referred to as a first time period) At least one of the number of instruction cycles, the number of branch instructions, and the cache miss rate is determined, and the first time interval is a period of time from the start of execution of the frame drawing thread to the end of execution of the drawing thread.
  • the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval can be referred to as the performance indicator data of the frame drawing thread in the first time interval, in determining the load characteristics of the frame drawing thread .
  • the determining the load characteristics of the frame drawing thread includes: recording performance indicator data of the frame drawing thread within a first time interval, wherein the first time interval is from the frame drawing thread A period of time between the start of execution and the end of execution of the drawing thread, the performance indicator data of the drawing frame thread in the first time interval includes the average of each drawing frame thread in the first time interval At least one of the number of instruction cycles, the number of branch instructions, the cache miss rate, and the program counter; determining the load characteristics of the frame drawing thread according to the performance indicator data of the frame drawing thread within the first time interval.
  • the length of the first time interval is determined according to performance index data that can be collected.
  • the first time interval can be set to a time required to collect enough performance indicator data.
  • a percentage threshold can also be set for the first time. The proportion of the frame time of the image frame cannot exceed the threshold of the ratio.
  • the determining the target resource scheduling mode according to the load characteristics of the drawing frame thread includes: determining the drawing frame thread according to the load characteristics of the drawing frame thread The load prediction value of; determining the target resource scheduling mode according to the load characteristic of the frame drawing thread, the load prediction value of the frame drawing thread, and a preset target frame rate.
  • the target resource is determined according to the load characteristic of the frame drawing thread, the load prediction value of the frame drawing thread, and a preset target frame rate
  • the scheduling method includes: determining at least one resource scheduling method for performing resource scheduling on the drawing frame thread according to the load characteristics of the drawing frame thread, the load prediction value of the drawing frame thread, and a preset target frame rate; The resource scheduling mode with the lowest power consumption among the at least one resource scheduling mode is determined as the target resource scheduling mode.
  • the power consumption can be reduced as much as possible while satisfying the resource scheduling requirements of the frame drawing thread. Thereby achieving a balance between performance and power consumption.
  • the determining the target resource scheduling mode according to the load characteristics of the drawing frame thread includes: determining the drawing frame thread according to the load characteristics of the drawing frame thread The load prediction value of the target; according to the load characteristics of the frame drawing thread, the load prediction value of the frame drawing thread and the first mapping relationship information, the target resource scheduling mode is determined, wherein the first mapping relationship information includes multiple Load information and a resource scheduling method corresponding to each load information in the multiple load information, each load information in the multiple load information includes a load characteristic and a load value.
  • the first mapping relationship information is determined according to historical information recorded by the terminal device, and the historical information includes load characteristics, load values, and corresponding resource scheduling modes of the image frames before the image frames drawn by the frame drawing thread.
  • the first mapping relationship information may be in the form of a table, or may be any other form of information that records load characteristics, load values, and corresponding resource scheduling methods.
  • the target resource scheduling method can be simplified Complexity.
  • the method further includes: recording the load characteristics of the frame drawing thread, the load prediction value of the frame drawing thread, and the target resource scheduling mode, so as to update the first mapping relationship information.
  • the type of load information included in the first mapping relationship information can be increased, which facilitates subsequent determination of the resource scheduling mode according to the first mapping relationship information.
  • the determining the load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread includes: according to the load characteristics of the drawing frame thread and The second mapping relationship information determines the load prediction value of the frame drawing thread, wherein the second mapping relationship information includes multiple load characteristics and load values corresponding to each of the multiple load characteristics.
  • the determining the load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the second mapping relationship information includes: In the case where multiple load features in the second mapping relationship information have reference load features, the load value corresponding to the reference load feature is determined as the load prediction value of the frame drawing thread, where the reference load feature is The similarity of the load characteristics of the frame drawing thread is greater than or equal to the similarity threshold.
  • the determining the load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the second mapping relationship information includes: When the reference load feature does not exist among the multiple load features in the second mapping relationship information, the load value of the previous frame of the image frame drawn by the drawing frame thread is determined as the load prediction value of the drawing frame thread , Wherein the similarity between the reference load feature and the load feature of the frame thread is greater than or equal to the similarity threshold.
  • the second mapping relationship information is determined according to historical information recorded by the terminal device, and the historical information may include load characteristics and corresponding load values of image frames drawn by the frame drawing thread.
  • the second mapping relationship information may be in the form of a table, or may be any other form of information that records the load characteristics and corresponding load values.
  • the load prediction value of the drawing frame thread and the second mapping relationship can be used to more easily determine the load prediction value of the drawing frame thread, and to directly analyze or calculate the load value of the drawing frame thread based on the load characteristics of the drawing frame thread Compared with the method, it is more convenient to determine the load prediction value of the frame thread.
  • the method further includes: recording a load characteristic of the frame drawing thread and a load prediction value of the frame drawing thread to update the second mapping relationship information.
  • the types of load characteristics included in the second mapping relationship information can be increased, which is convenient for subsequently determining the load prediction value of the frame drawing thread according to the second mapping relationship information.
  • the determining the target resource scheduling mode according to the load characteristic of the frame drawing thread includes: according to the load characteristic of the frame drawing thread and third mapping relationship information To determine the target resource scheduling mode, wherein the third mapping relationship information includes multiple load characteristics and a resource scheduling mode corresponding to each of the multiple load characteristics.
  • the determining the target resource scheduling manner according to the load characteristics of the frame drawing thread and the third mapping relationship information includes: in the third mapping When there is a reference load feature for multiple load features in the relationship information, the resource scheduling mode corresponding to the reference load feature is determined as the target resource scheduling mode, where the reference load feature and the frame thread The similarity of the load characteristics is greater than or equal to the similarity threshold.
  • the determining the target resource scheduling manner according to the load characteristics of the frame drawing thread and the third mapping relationship information includes: in the third mapping When the multiple load features in the relationship information do not have the reference load feature, the target resource scheduling mode of the frame drawing thread of the previous frame of the image frame drawn by the frame drawing thread is determined as the target resource scheduling mode , Wherein the similarity between the reference load feature and the load feature of the frame thread is greater than or equal to the similarity threshold.
  • the third mapping relationship information is determined according to historical information recorded by the terminal device, and the historical information includes load characteristics of the image frame before the image frame drawn by the drawing frame thread and the corresponding resource scheduling mode.
  • the third mapping relationship information may be in the form of a table, or any other form of information that records load characteristics and corresponding resource scheduling methods.
  • the target resource scheduling mode is directly determined by the load characteristics of the frame drawing thread and the mapping relationship between the load characteristics and the resource scheduling mode, the process of determining the load prediction value of the frame drawing thread can be omitted, and the target resource scheduling can be further simplified The complexity of the way.
  • the method further includes: recording load characteristics of the drawing frame thread and the drawing target resource scheduling manner to update the third mapping relationship information.
  • the types of load characteristics included in the third mapping relationship information can be increased, which is convenient for subsequently determining the resource scheduling mode corresponding to the frame drawing thread according to the third mapping relationship information.
  • the method further includes: determining an associated thread of the painting frame thread, where the associated thread is a thread that can cause the painting frame thread to sleep; Scheduling resources for the associated thread to speed up the execution of the associated thread.
  • the above causes the frame thread to sleep may refer to causing the frame thread to sleep intermittently or stop working.
  • the method further includes: scheduling additional resources for the drawing frame thread to speed up the process The execution of the frame drawing thread, wherein the predetermined time is the time required to complete the frame drawing thread when the target resource scheduling mode is used to schedule resources for the frame drawing thread.
  • the drawing frame thread when the execution of the drawing frame thread is completed, the drawing of the image frame corresponding to the drawing frame thread is also completed. If the execution of the drawing frame thread is not completed within a predetermined time, then the description according to the target resource scheduling method is The resources scheduled by the frame thread may be too few. In this case, additional resources need to be scheduled for the frame thread to speed up the execution of the frame thread, thereby improving the user experience.
  • the size of the additional resource is positively related to the first difference value, where the first difference value is a time point when the additional resource is scheduled The difference from the time point when the preset time ends.
  • a resource scheduling method is provided.
  • the method is applied to a terminal device.
  • the method includes: determining a load characteristic of a frame drawing thread, the frame drawing thread is used to draw an image frame; and according to the load of the frame drawing thread Characteristics and application scenarios corresponding to the drawing frame thread, determining the target load prediction value of the drawing frame thread; according to the load characteristics of the drawing frame thread, the target load prediction value of the drawing frame thread and the preset target frame Rate, determine the target resource scheduling mode; use the target resource scheduling mode to schedule resources for the frame drawing thread.
  • the above terminal device may be a mobile terminal (for example, a smart phone), a computer, a personal digital assistant, a wearable device, a vehicle-mounted device, an Internet of Things device, and so on.
  • the above terminal device may also be other devices capable of displaying a screen.
  • the above terminal device may be a device running various operating systems.
  • the above terminal device may be a device running an Android system, a device running an IOS system, or a device running a windows system.
  • the application scene corresponding to the frame drawing thread may refer to the type of application where the frame drawing thread is located, for example, the application scene corresponding to the frame drawing thread may be a video application, a game, and other applications that need to interact with the user (for example, WeChat) , Taobao, Weibo) etc.
  • the application scene corresponding to the frame drawing thread can also refer to the stage where the application where the frame drawing thread is located, for example, the application scene corresponding to the frame drawing thread can refer to the startup stage and end stage of the application where the frame drawing thread is located Wait.
  • the application scene corresponding to the frame drawing thread may also refer to a certain stage of the application program where the frame drawing thread is running.
  • the application scene corresponding to the frame drawing thread may be an interface of WeChat (chat interface or click to open) Small video interface).
  • the frame drawing thread may be determined first.
  • determining the frame drawing thread includes: determining a thread that calls a key function of the frame drawing in the process of drawing the image frame as the frame drawing thread.
  • the above key functions for drawing frames may refer to some key functions in the process of drawing an image frame, and the key functions for drawing frames may be preset.
  • the key function of the frame drawing may be determined according to the type of operating system adopted by the terminal device. Different types of operating systems may correspond to different key functions of the frame drawing.
  • the key functions of the frame drawing may be different. For the IOS system and the Android system, the corresponding key functions for drawing frames are different.
  • the load prediction value of the frame drawing thread can be determined more reasonably, and then the target resource scheduling method can be determined more reasonably, which can achieve a more fine-grained resource Scheduling makes resource scheduling more targeted, and resource scheduling has a better effect.
  • the target load prediction value of the drawing frame thread is determined according to the load characteristics of the drawing frame thread and the application scenario corresponding to the drawing frame thread
  • the method includes: determining the first load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread; determining the second of the drawing frame thread according to the application scene corresponding to the drawing frame thread and fourth mapping relationship information Load prediction value, wherein the fourth mapping relationship information includes multiple application scenarios and load values corresponding to each of the multiple application scenarios; according to the first load prediction value and the second load The predicted value determines the target load predicted value.
  • a load prediction value is first determined through the load characteristics of the frame thread and the application scenario, and then the final target load prediction value is determined according to the obtained two load prediction values, which can better determine the target load value. Furthermore, the target resource scheduling method can be better determined.
  • determining the target load predicted value according to the first load predicted value and the second load predicted value includes: the maximum load among the first load predicted value and the second load predicted value The value is determined as the target load prediction value.
  • determining the target load predicted value according to the first load predicted value and the second load predicted value includes: the minimum load among the first load predicted value and the second load predicted value The value is determined as the target load prediction value.
  • C1 is the first load prediction value
  • C2 is the second load prediction value
  • C is the target load prediction value
  • A is the first weighting coefficient
  • B is the second weighting coefficient
  • determining the target load predicted value according to the first load predicted value and the second load predicted value includes: determining an average value of the first load predicted value and the second load predicted value The predicted value of the target load.
  • determining the target load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the application scene corresponding to the drawing frame thread includes: when the application scene corresponding to the drawing frame thread is a startup scene , Determining the target load prediction value of the frame drawing thread according to the application scene corresponding to the frame drawing thread and fourth mapping relationship information, where the fourth mapping relationship information includes multiple application scenarios and the multiple applications The load value corresponding to each application scenario in the scenario.
  • the target load prediction value of the frame drawing thread can be directly determined according to the application scene of the frame drawing thread.
  • determining the target load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the application scene corresponding to the drawing frame thread includes: when the application scene corresponding to the drawing frame thread is a startup scene In other scenes, the target load prediction value is determined according to the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is used to indicate the resource demand characteristic of the frame drawing thread.
  • the resource requirement characteristic of the frame drawing thread may indicate whether the load of the frame drawing thread is computationally intensive or resource intensive, so as to facilitate subsequent determination of the corresponding target resource scheduling mode.
  • the load of the frame drawing thread is a computationally intensive load
  • the computing resources can be mainly scheduled
  • the load of the frame drawing thread is a resource intensive load
  • scheduling is for the frame drawing thread
  • resources are available, storage resources can be mainly scheduled.
  • the load characteristic of the frame drawing thread includes at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread .
  • the load characteristics of the drawing frame thread can be directly obtained. Simplify the complexity of obtaining the load characteristics of the frame drawing thread.
  • one or more of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread can be directly used to represent the load characteristics of the frame drawing thread. After the parameters, it is equivalent to obtain the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is based on the average number of cycles per instruction, the number of branch instructions, and the cache in the first time interval of the frame drawing thread At least one of the missing rates is determined, and the first time interval is a period of time from the start of execution of the drawing thread to the end of execution of the drawing thread.
  • the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval can be referred to as the performance indicator data of the frame drawing thread in the first time interval, in determining the load characteristics of the frame drawing thread .
  • the execution of the drawing frame thread is not completed within a predetermined time
  • the method further includes: scheduling additional resources for the drawing frame thread to speed up the process The execution of the frame drawing thread, wherein the predetermined time is the time required to complete the frame drawing thread when the target resource scheduling mode is used to schedule resources for the frame drawing thread.
  • the frame drawing thread has not completed drawing within a predetermined time, it means that the resources scheduled for the frame drawing thread according to the target resource scheduling method may be too small. At this time, additional resources need to be scheduled for the frame drawing thread to speed up The execution of the frame thread, thereby improving the user experience.
  • the size of the additional resource is positively related to the first difference value, where the first difference value is a time point when the additional resource is scheduled The difference from the time point when the preset time ends.
  • a terminal device in a third aspect, includes a module for executing the method in the first aspect and any one of the implementation manners of the first aspect.
  • a terminal device includes a module for executing the method in the second aspect and any one of the implementation manners in the second aspect.
  • a terminal device including a memory and a processor, the memory is used to store a program, the processor is used to execute a program, and when the program is executed, the processor is used to execute the first Aspect and the method in any one of the implementation manners of the first aspect.
  • a terminal device including a memory and a processor, where the memory is used to store a program, the processor is used to execute a program, and when the program is executed, the processor is used to execute the second The method in any one of the aspects and the second aspect.
  • a computer-readable storage medium is provided.
  • the computer-readable storage medium is used to store program code.
  • the program code is executed by a computer, the computer is used to perform the first aspect and the first Any one of the methods in one aspect.
  • a computer-readable storage medium is provided.
  • the computer-readable storage medium is used to store program code.
  • the program code is executed by a computer, the computer is used to perform the second aspect and the first The method in any one of the two aspects.
  • the computer-readable storage medium may be located inside the terminal device, and the program code stored in the computer-readable medium may be executed by the terminal device, and when the program code is executed by the terminal device, The terminal device can execute the method in the first aspect and any implementation manner of the first aspect or the method in the second aspect and any implementation manner of the second aspect.
  • a chip includes a processor, and the processor is configured to execute the method in the first aspect and any one of the implementation manners of the first aspect.
  • a chip is provided.
  • the chip includes a processor, and the processor is configured to execute the method in the second aspect and any one of the implementation manners of the second aspect.
  • a computer program for causing a computer or a terminal device to execute the method in the first aspect and any implementation manner of the first aspect.
  • a computer program for causing a computer or a terminal device to execute the method in any of the second aspect and any implementation manner of the second aspect.
  • FIG. 1 is a schematic flowchart of a resource scheduling method according to an embodiment of this application
  • FIG. 2 is a schematic diagram of the process of determining the frame drawing thread
  • FIG. 3 is a schematic flowchart of acquiring load characteristics of a frame drawing thread according to performance index data of the frame drawing thread;
  • FIG. 4 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of determining the load prediction value of the frame thread according to the load characteristics of the frame thread
  • 6 to 6 are schematic flow charts of resource scheduling for the frame drawing thread according to the load characteristics of the frame drawing thread
  • FIG. 7 is a schematic flowchart of determining associated threads and scheduling resources for the associated threads
  • FIG. 8 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application.
  • FIG. 9 is a schematic block diagram of a terminal device according to an embodiment of the present application.
  • FIG. 10 is a schematic block diagram of a terminal device according to an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
  • the terminal device mainly determines the corresponding resource scheduling mode according to the load situation of the current task, and then schedules resources in this resource scheduling mode.
  • This method mainly determines how to schedule based on the load of the current task.
  • This scheduling method does not perceive the user experience. Although the execution of the corresponding tasks can be completed during the scheduling process, it does not necessarily bring a better user experience.
  • the display speed of the image frame has an obvious corresponding relationship with the execution of the drawing frame thread.
  • the image frame displays faster, and when the drawing frame thread executes slower, the image frame displays Is also slower. Therefore, for fine resource scheduling, resources can be directly scheduled for the frame drawing thread to schedule resources more reasonably.
  • the resource scheduling method according to an embodiment of the present application will be described in detail below with reference to FIG. 1. It should be understood that the scheduled resources in the present application may be either computing resources (eg, CPU) or storage resources (eg, storage space).
  • computing resources eg, CPU
  • storage resources eg, storage space
  • FIG. 1 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application.
  • the method shown in FIG. 1 may be executed by a terminal device.
  • the terminal device here may be a mobile terminal (for example, a smart phone), a computer, a personal digital assistant, a wearable device, a vehicle-mounted device, an Internet of Things device, and so on.
  • the method shown in FIG. 1 includes steps 101 to 103, and these steps are described in detail below.
  • image frames may also be referred to as image frames.
  • this document is collectively referred to as image frames.
  • the execution speed of the frame drawing thread may affect the user's experience. For example, when the execution speed of the drawing frame thread is slow, the drawing of the image frame takes a long time, and the user will feel that the picture is stuck; while when the execution speed of the drawing frame thread is fast, the drawing of the image frame is relatively fast It can be completed in a short time, and the user will feel that the picture is relatively smooth.
  • the load characteristics of the framer thread can reflect some of the load characteristics of the framer thread.
  • the load characteristics of the framer thread can reflect whether the framer thread is computationally intensive (larger demand for computing resources) or memory intensive (yes The demand for storage resources is greater), the load characteristics of the frame drawing thread can also reflect the delay characteristics of the frame drawing thread (low latency or high latency).
  • a frame drawing thread may be determined.
  • the thread that calls the key function of drawing the frame during the process of drawing the image frame may be determined as the drawing thread.
  • the thread calling the key function of the frame is determined in the key function of the frame, and the thread calling the key function of the frame is the frame thread.
  • the above described key functions for drawing frames may refer to some key functions in the process of drawing image frames, and the key functions for drawing frames may be preset.
  • the key function of the frame drawing may be determined according to the type of operating system adopted by the terminal device, and the key function of the frame drawing corresponding to different types of operating systems may be different.
  • the key function of the frame corresponding to the IOS system and Android The key functions of the frame corresponding to the system are different.
  • Figure 2 shows the process of drawing a frame of images including: creating a canvas-measuring layout-creating a view-rendering-compositing-swapping buffer-sending a display.
  • the above process from creating the canvas to sending the display can be regarded as a series of steps to call the key function of drawing the frame and then drawing the image frame.
  • steps or processes there will be corresponding threads in each process to call the key function of the drawing frame (where different steps or processes It can be executed by the same thread or by different threads). Therefore, the thread running in these processes can be determined as the frame drawing thread.
  • the thread that calls the key function of drawing frame in the process of creating the canvas to the exchange buffer in FIG. 2 can also be determined as the drawing frame Thread.
  • step 101 the load characteristics of the frame thread can be determined by recording the performance indicator data of the frame thread.
  • the load characteristic of the frame drawing thread is used to indicate the resource requirement characteristic of the frame drawing thread.
  • the resource requirement characteristic of the frame drawing thread may indicate whether the load of the frame drawing thread is computationally intensive or resource intensive, so as to facilitate subsequent determination of the corresponding target resource scheduling mode.
  • the load characteristic of the frame drawing thread may be at least one of the resource requirement characteristic of the frame drawing thread, the delay characteristic of the frame drawing thread, and the running characteristic of the frame drawing thread.
  • the load characteristics of the frame drawing thread can reflect the overall characteristics of the load of the frame drawing thread, which is convenient for subsequent resource scheduling according to the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is based on at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval It is determined that the first time interval is a period of time from the start of execution of the drawing thread to the end of execution of the drawing thread.
  • the average number of cycles per instruction represents the clock cycle required for the execution of each computer instruction (may also be referred to as the average number of cycles of instructions).
  • the number of branch instructions is used to indicate the number of branches (branch is a program), and it can also be considered as the number of jump instructions.
  • a jump instruction represents a branch.
  • the performance index data of the frame drawing thread within a period of time may be collected first, and then the load characteristics of the frame drawing thread may be determined according to the performance index data of the frame drawing thread during the period of time.
  • determining the load characteristics of the frame drawing thread includes: recording at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval, Wherein, the first time interval is a period of time from the start of execution of the drawing frame thread to the end of execution of the drawing thread; according to the average number of cycles per instruction and the number of branch instructions in the first time interval of the drawing frame thread And at least one of the cache miss rate determines the load characteristics of the frame drawing thread.
  • the setting of the first time interval can be determined according to the performance index data that can be collected.
  • the first time interval can be set to a time required to collect enough performance index data.
  • the program counter may record the address of the instruction being executed by the image frame, and the program counter of the frame drawing thread within the first time interval may be the address of the instruction executed by the image frame within the first time interval.
  • the performance index data of the frame drawing thread within the first time interval may be directly determined as the load characteristic of the frame drawing thread, or the frame drawing thread may be first determined at the first time Perform some analysis or processing on the performance index data within the interval, and use the data or parameters obtained from the analysis or processing (the processed data or parameters may be data or parameters that reflect the overall load characteristics of the image frame) as the load characteristics of the frame drawing thread.
  • the two performance indicator data can be divided (specifically, the average of each instruction of the drawing frame thread in the first time interval can be The number of cycles and the number of branch instructions of the frame drawing thread in the first time interval are divided), and the obtained value is used to represent the load characteristics of the frame drawing thread.
  • these performance index data can also be hashed (for example, the address of the instruction executed by the image frame collected by the program counter can be hashed ), And then use the information or parameters obtained by the operation to represent the load characteristics of the frame drawing thread.
  • the performance index data of the frame thread can be collected multiple times within the first time interval described above, and then the load characteristics of the frame thread can be comprehensively determined according to the various performance index data collected multiple times, so that the drawing can be more accurately determined.
  • the load characteristics of the frame thread In general, the more times the performance index data of the frame drawing thread is collected, the denser the collection, and the higher the accuracy of the determined load characteristics of the frame drawing thread, but at the same time the overhead is relatively large. Therefore, in practical applications, the length of the first time interval and the frequency of collecting performance index data can be determined according to experience or simulation results.
  • Table 1 shows the average number of cycles per instruction, the number of branch instructions, and the cache collected by the frame drawing thread 0 and the frame drawing thread 1. Missing rate and specific value of program counter.
  • the specific value of the average instruction cycle number of the drawing frame thread 0 collected in a period of time is 0.7, 0.72, 0.6, 0.8, etc.
  • the drawing frames collected in a period of time The number of branch instructions of thread 0 is 98k, 87k, 102k, etc.
  • the cache miss rate of frame 0 collected during a period of time is 0.008, 0.002, 0.01, etc., collected during a period of time
  • the program counters of the frame thread 0 are 0xe8dab47a, 0xe8dac79b, etc.
  • Table 1 is only a specific representation of the load characteristics of the frame drawing thread (the values of various parameters in Table 1 are also a specific example).
  • the load characteristics of the frame drawing thread may also include a table At least one of the parameters in 1, or may also include other parameters that can reflect the performance of the frame drawing thread.
  • the target resource scheduling mode when determining the target resource scheduling mode, it may be considered to schedule more computing resources.
  • the storage-intensive frame drawing thread when determining the target resource scheduling mode, it may be considered to schedule more storage resources. For the frame drawing thread with low latency requirements, more resources can be scheduled to speed up the execution of the frame drawing thread when determining the target resource scheduling mode, while for the frame latency with high latency requirements, when determining the target resource scheduling mode, scheduling Appropriate resources are enough (because it is a high-latency service, there is no need to schedule too many resources to execute the thread).
  • the frame drawing thread is a thread for drawing an image frame
  • the execution speed of the frame drawing thread is directly related to the user experience. Therefore, the target resource scheduling method determined by the load characteristics of the frame drawing thread can schedule the frame drawing thread to Achieving more fine-grained resource scheduling makes resource scheduling more targeted, and the effect of resource scheduling is better.
  • the load characteristics of the frame drawing thread may be obtained according to the performance index data of the frame drawing thread. If the historical record information does not include the load characteristics, then, Continue to obtain the load value of the drawing frame thread, and record the load characteristics and load value of the drawing frame thread; if the load characteristics have been included in the historical record information, it may indicate that the load value of the drawing frame thread may have been recorded, At this time, it is only necessary to record the load characteristics of the frame drawing thread (the load characteristics of the frame drawing thread may be recorded for subsequent determination of the target resource scheduling mode).
  • FIG. 3 is a schematic flowchart of acquiring load characteristics of a frame drawing thread according to performance index data of the frame drawing thread.
  • the process shown in FIG. 3 includes steps 201 to 207, and steps 201 to 207 will be described in detail below.
  • Step 201 indicates that the performance index data of the frame drawing thread is started to be collected.
  • the time when step 201 starts may be the time when the frame drawing thread starts to execute.
  • the performance indicator data may be at least one of the average number of cycles per instruction, the number of branch instructions, the cache miss rate, and the program counter of the frame drawing thread over a period of time (specifically, the first time interval).
  • the aforementioned frame feature boundary may be a period of time, during which the performance index data of the frame drawing thread is collected, and when the period of time is exceeded, the collection of the performance index data of the frame drawing thread is stopped.
  • the above frame feature boundary may be the first time interval above.
  • the recorded load characteristic may be the load characteristic of the frame before the image frame recorded by the terminal device, and the recorded load characteristic may include only different load characteristics.
  • the recording of the load characteristics of the frame drawing thread in step 206 is mainly to facilitate subsequent determination of the target resource scheduling mode.
  • the load prediction value of the frame drawing thread can be determined according to the load characteristics of the frame drawing thread (for details, please refer to the related content of determining the load prediction value of the frame drawing thread according to the load characteristics of the frame drawing thread in this article)
  • the load prediction value of the frame thread is used as the load value of the frame thread, and then the load characteristics and the load value of the frame thread are recorded, so that the load value can be determined directly according to the corresponding relationship between the recorded load characteristics and the load value.
  • the resource scheduling mode when determining the target resource scheduling mode according to the load characteristics of the frame drawing thread, can be determined according to the specific characteristics of the load of the frame drawing thread, for example, more resources can be scheduled for the frame drawing thread, thereby Speed up the execution speed of the frame drawing thread and improve the user experience.
  • the load prediction value of the frame thread can be determined according to the load characteristics of the frame thread first, and then the target resource can be calculated and determined according to the load characteristic of the frame thread and the load prediction value of the frame thread and the preset target frame rate Scheduling method; the target can also be determined according to the load characteristics of the frame drawing thread, the load prediction value of the frame drawing thread, and the preset correspondence (the correspondence here includes the correspondence between the load characteristics, the load value, and the resource scheduling method)
  • the resource scheduling mode can also directly determine the target resource scheduling mode directly according to the load characteristics of the frame drawing thread and the preset correspondence (the correspondence here includes the correspondence between the load characteristics and the resource scheduling mode).
  • determining the target resource scheduling mode according to the load characteristics of the drawing frame thread includes: determining the load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread; according to the load characteristics of the drawing frame thread, the drawing frame The thread load prediction value and the preset target frame rate determine the target resource scheduling method.
  • the load characteristics of the frame drawing thread and the load prediction value of the frame drawing thread can be first rooted And a preset target frame rate determines multiple optional resource scheduling methods, and then determines the resource scheduling method with the smallest power consumption among the multiple optional resource scheduling methods as the target resource scheduling method.
  • FIG. 4 is a schematic flowchart of a resource scheduling method according to an embodiment of the present application. It should be understood that the method shown in FIG. 4 mainly shows the process of determining the target resource scheduling mode according to the load characteristics of the frame drawing thread. The method shown in FIG. 4 includes steps 301 to 304, and the following steps 301 to 304 Give a detailed introduction.
  • Step 301 and step 302 are not in order. Step 301 and step 302 may be performed simultaneously or sequentially (step 301 is performed first and then step 302, or step 302 and then step 301 are performed) .
  • the required resource scheduling method is also different.
  • the type of the resource scheduling method that matches the load characteristic of the drawing frame thread is determined according to the load characteristic of the drawing frame thread.
  • the type of resource scheduling method that matches the framer thread is mainly scheduling computing resources, and when the load of the framer thread is storage-intensive, it is related to the framer thread
  • the type of matching resource scheduling method is mainly to schedule storage resources.
  • step 303 when the above target type is scheduling computing resources, in step 303, at least one resource scheduling mode needs to be determined among the types of scheduling computing resources.
  • step 304 according to the energy efficiency table or the energy efficiency curve, at least one resource scheduling mode corresponding to the lowest power consumption scheduling mode can be determined, and then the resource scheduling mode with the lowest power consumption can be determined as the target resource scheduling mode.
  • the specific expression form of the above energy efficiency table can be shown in Table 2.
  • the performance value can be used to indicate the processing capacity of the processor. The larger the performance value, the better the processor performance and the faster the processing speed.
  • the highest-frequency performance value of this largest core can be defined as 1024. If the smallest core in the CPU is used to execute the same program at the same frequency and at the same time with 100% load, and the smallest core has only executed 10M instructions during this period of time, then the smallest core in the CPU can be considered as The performance value corresponding to the lowest frequency operation is 102.4, that is to say, when the smallest core in the CPU is running at the lowest frequency, its performance value is 1/10 of the performance value when the largest core in the CPU is running at the highest frequency.
  • the performance of the first resource scheduling method is 107
  • the frequency is 533
  • the power consumption corresponding to this resource scheduling method is 32.
  • a total of three resource scheduling methods are determined in step 203, namely resource scheduling method 1, resource scheduling method 2 and resource scheduling method 3.
  • the specific information of the three resource scheduling methods is as follows:
  • Resource scheduling method 1 Corresponding to the small core, the performance is 306, the frequency is 1042, and the power consumption is 119;
  • Resource scheduling method 2 Corresponding to the small core, the performance is 388, the frequency is 1804, and the power consumption is 242;
  • Resource scheduling method 3 Corresponding to the large core, the performance is 373, the frequency is 903, and the power consumption is 191.
  • resource scheduling mode 1 has the lowest power consumption, and resource scheduling mode 1 can be determined as the target resource scheduling mode.
  • the load information of the frame drawing thread of the image frame may also be directly used (the load information may include Load characteristics and load values) and the mapping relationship information between the load information and the resource scheduling mode to directly determine the target resource scheduling mode.
  • determining the target resource scheduling mode according to the load characteristics of the drawing frame thread includes: determining the load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread; according to the load characteristics of the drawing frame thread, the drawing frame
  • the load prediction value of the thread and the first mapping relationship information determine the target resource scheduling mode, where the first mapping relationship information includes multiple types of load information and a resource scheduling mode corresponding to each of the multiple types of load information.
  • Each type of load information in the load information includes a load characteristic and a load value.
  • the target resource scheduling method is determined according to the load characteristics of the frame drawing thread, the load prediction value of the frame drawing thread, and the first mapping relationship information, including: placing the load characteristic of the frame drawing thread and the load prediction value of the frame drawing thread in the first
  • the corresponding resource scheduling mode in the mapping relationship information is determined as the target resource scheduling mode.
  • the first load characteristic that matches the load characteristic of the frame drawing thread and the first load value that matches the load prediction value of the frame drawing thread can be determined from the first mapping relationship information, Then, according to the first mapping relationship information, the resource scheduling mode corresponding to the first load characteristic and the first load value is determined as the target resource scheduling mode.
  • the similarity threshold of the multiple load features included in the first mapping relationship and the load feature of the frame thread may be greater than or equal to the similarity threshold
  • the load characteristic of is determined as the first load characteristic.
  • the similarity between the multiple load values included in the first mapping relationship and the load prediction value of the frame drawing thread may be greater than or equal to the similarity
  • the load value of the threshold value is determined as the first load value.
  • the first mapping relationship may be determined according to historical information recorded by the terminal device, where the historical information includes load characteristics, load values, and corresponding resource scheduling modes of the image frame before the image frame.
  • the first mapping relationship information may be in the form of a table, or may be any other form of information that records load characteristics, load values, and corresponding resource scheduling methods.
  • the specific representation form of the first mapping relationship information may be as shown in Table 3.
  • Load characteristics Load value
  • Load characteristics 3 900
  • the specific parameters included in the load characteristics may be at least one of the average number of cycles per instruction, the number of branch instructions, the cache miss rate, and the program counter in Table 1, and the specific parameters included in the resource scheduling method may be processing
  • the load value can be determined according to the frequency and time the thread runs.
  • the size of the load value can indicate the size of the task that the frame thread needs to perform. The larger the load value, the higher the load value. The more program instructions the frame thread needs to execute.
  • the load Resource scheduling mode 1 corresponding to feature 1 and load value 1 is determined as the target resource scheduling mode.
  • the target resource scheduling method can be simplified Complexity.
  • the load prediction value of the frame drawing thread when determining the load prediction value of the frame drawing thread, may be determined according to the load characteristic of the frame drawing thread and the mapping relationship between the load characteristic and the load value.
  • determining the load prediction value of the frame thread according to the load characteristics of the frame thread includes: according to the load characteristics of the frame thread and the second mapping relationship information, the corresponding load characteristics of the frame thread The load value is determined to be the load prediction value of the frame drawing thread, where the second mapping relationship information includes multiple load characteristics and load values corresponding to each of the multiple load characteristics.
  • the above-mentioned second mapping relationship information may be determined according to historical information recorded by the terminal device, and the historical information may include load characteristics and corresponding load values of image frames before the image frame.
  • the second mapping relationship information may be in the form of a table, or may be any other form of information that records the load characteristics and corresponding load values.
  • the load prediction value of the frame drawing thread can be determined more conveniently, compared with the method of directly analyzing or calculating the load value of the frame drawing thread based on the load characteristics of the frame drawing thread It is easier to determine the load prediction value of the frame thread.
  • Table 4 may record the frame characteristics and load corresponding to the frame before the image frame. Therefore, the terminal device may record at least part of historical information (including frames and frame characteristics and load corresponding to the frame) to generate Table 4.
  • the frame characteristics in Table 4 are only described by taking the number of branch instructions and the cache miss rate as an example. In fact, the frame characteristics may also be expressed by other parameters that can reflect the characteristics of the frame.
  • the determination of the load prediction value of the frame drawing thread may specifically include the following two cases:
  • the load value corresponding to the reference load feature is determined as the frame load thread Load forecast value
  • the load value of the previous frame of the image frame is determined as the load prediction value of the frame drawing thread.
  • the above-mentioned similarity with the load feature of the frame drawing thread reaches the preset similarity may refer to that the similarity with the load feature of the frame drawing thread is greater than or equal to the similarity threshold.
  • the above reference load feature can be either a load feature (only one load feature in the second mapping relationship information has a similarity to the load feature of the frame thread greater than or equal to the similarity threshold), or multiple Load characteristics (the second mapping relationship information has multiple load characteristics similar to the load characteristics of the frame thread greater than or equal to the similarity threshold), when the reference load characteristic is a load characteristic, you can directly use the reference The load value corresponding to the load characteristic is determined as the load prediction value of the frame thread.
  • the load value corresponding to any one of the load characteristics may be determined as the load prediction value of the frame drawing thread, or the load characteristic in which the similarity with the frame drawing thread is the largest
  • the corresponding load value is determined as the target resource scheduling mode.
  • previous frame of the image frame may be an image frame displayed before the image frame. Further, the previous frame of the image frame may be an image frame displayed before the image frame and adjacent to the image frame.
  • the image can be directly
  • the load value of the previous frame of the frame is determined as the load prediction value of the drawing frame thread of the image frame.
  • the target scheduling mode can also be directly determined according to the load characteristics of the drawing thread of the image frame and the mapping relationship between the load characteristics and the resource scheduling mode.
  • FIG. 5 is a schematic flowchart of determining the load prediction value of the frame thread according to the load characteristics of the frame thread. The process shown in FIG. 5 includes steps 401 to 406, and these steps are described in detail below.
  • the load characteristic of the previous frame of the image frame may be obtained from the recorded load characteristics.
  • step 403 when the load characteristic of the frame drawing thread changes with respect to the load characteristic of the previous frame of the image frame by more than a preset limit, the difference between the load characteristic of the previous frame of the image frame and the frame drawing thread If the value is large, it is necessary to find the reference load characteristic that matches the load characteristic of the frame drawing thread from the previously recorded historical data, that is, perform step 404.
  • the load characteristic of the frame drawing thread changes with respect to the load characteristic of the previous frame of the image frame does not exceed the preset limit, it means that the load characteristic of the previous frame of the image frame is similar to the frame drawing thread.
  • the load feature of the previous frame of the image frame can be directly determined as the reference load feature matching the load feature of the frame drawing thread, that is, step 406 is executed.
  • the reference load feature may be a load feature whose similarity to the load feature of the frame thread is greater than or equal to the similarity threshold.
  • determining the target resource scheduling mode according to the load characteristics of the frame drawing thread includes: according to the load characteristics of the frame drawing thread and the third mapping relationship information, the resource scheduling mode corresponding to the load characteristics of the frame drawing thread Determined as the target resource scheduling mode, where the third mapping relationship information includes multiple load characteristics and a resource scheduling mode corresponding to each load characteristic of the multiple load characteristics.
  • the third mapping relationship information may be determined according to historical information recorded by the terminal device (the historical information includes load characteristics of frames displayed before the image frame and corresponding resource scheduling methods).
  • the third mapping relationship information may be in the form of a table, or may be any other form of information that records load characteristics and corresponding resource scheduling methods.
  • the target resource scheduling mode is directly determined by the load characteristics of the frame drawing thread and the mapping relationship between the load characteristics and the resource scheduling mode.
  • the process of determining the load prediction value of the image frame according to the frame drawing thread of the image frame can be omitted. Further simplify the complexity of determining the target resource scheduling method.
  • the target resource scheduling method When determining the target resource scheduling method according to the load characteristics of the frame drawing thread and the third mapping relationship information, you can select the load characteristics that are similar to the load characteristics of the frame drawing thread from the third mapping relationship information, and then compare the similar load characteristics The corresponding resource scheduling method is determined as the target resource scheduling method.
  • the target resource scheduling mode is determined according to the load characteristics of the frame drawing thread and the third mapping relationship information, including: in the case where multiple load characteristics in the third mapping relationship information have reference load characteristics, matching the reference load characteristics
  • the resource scheduling mode of is determined as the target resource scheduling mode, where the similarity between the reference load feature and the load feature of the frame thread is greater than or equal to the similarity threshold; there is no reference to multiple load features in the third mapping relationship information
  • the target resource scheduling method of the frame drawing thread of the previous frame of the image frame is determined as the target resource scheduling method.
  • the above reference load feature can be either a load feature (only one load feature in the third mapping relationship information has a similarity to the load feature of the frame thread greater than or equal to the similarity threshold), or multiple Load characteristics (the third mapping relationship information has multiple load characteristics and the load characteristics of the frame thread have a similarity greater than or equal to the similarity threshold), when the reference load characteristic is a load characteristic, you can directly use the reference
  • the resource scheduling mode corresponding to the load characteristic is determined as the target resource scheduling mode.
  • the resource scheduling mode corresponding to any one of the load characteristics can be determined as the target resource scheduling mode, or the load characteristics that have the greatest similarity to the frame drawing thread can be determined.
  • the resource scheduling method is determined as the target resource scheduling method.
  • the foregoing third mapping relationship may be as shown in Table 5, which records different load characteristics and resource scheduling manners recorded by these different load characteristics.
  • the resource scheduling mode 1 corresponding to the load feature 1 may be determined as the target resource scheduling mode.
  • FIG. 6 is a schematic flowchart of resource scheduling for a frame drawing thread according to load characteristics of the frame drawing thread. The process shown in FIG. 6 includes steps 501 to 508, and steps 501 to 508 will be described in detail below.
  • step 503 is executed, and if the load of the frame drawing thread is a memory-intensive load, step 504 is executed.
  • the distribution strategy may refer to allocating the current task to multiple different CPUs for execution, and performing inter-core balancing may refer to allocating the current task to multiple cores in the CPU for execution.
  • the aggregation strategy may refer to assigning the current task to a CPU for execution, and not performing inter-core balancing may refer to assigning the current task to a certain core in the CPU for execution.
  • FIG. 6 mainly shows a process of selecting a corresponding resource scheduling method to schedule the drawing frame thread according to the load characteristics of the drawing frame thread.
  • Steps 501 to 507 are equivalent to determining the target resource scheduling mode according to the drawing frame thread, and Step 508 is equivalent to scheduling resources for the frame drawing thread according to the target resource scheduling manner above.
  • the method shown in FIG. 1 further includes: determining an associated thread of the drawing frame thread, where the associated thread is a thread that can cause the drawing frame thread to sleep; scheduling resources for the associated thread to speed up The execution of the associated thread.
  • causing the picture frame thread to sleep may specifically refer to causing the picture frame thread to sleep intermittently, and sleep here may also refer to stopping work.
  • the associated thread is a thread that can cause the frame drawing thread to sleep, thereby slowing down the execution speed of the frame drawing thread. By speeding up the execution of the frame drawing thread, the execution speed of the frame drawing thread can be indirectly increased.
  • the associated thread can be executed as soon as possible, reducing the blocking time of the associated thread, thereby speeding up the execution speed of the frame drawing thread.
  • the thread related to the frame drawing thread is determined from the candidate threads according to the logical relationship and / or resource related relationship between the candidate thread and the frame drawing thread.
  • FIG. 7 is a schematic flowchart of determining an associated thread and scheduling resources for the associated thread. The process shown in FIG. 7 includes steps 601 to 607, and these steps are described in detail below.
  • a thread with a larger load value may be selected as a candidate thread from threads other than the frame drawing thread currently running on the terminal device according to the size of the load value. For example, in step 601, 10 threads with the largest load value among other threads may be selected as candidate threads.
  • the logical correlation between the frame drawing thread and the frame drawing thread can be inferred, and a logical correlation coefficient can be obtained.
  • the greater the logical correlation coefficient the greater the correlation between the candidate thread and the frame drawing thread.
  • the logical correlation coefficient between the candidate thread and the frame drawing thread can be determined by formula (1).
  • X is the running time of the frame thread
  • Y is the running time of the candidate thread
  • Cov (X, Y) represents the covariance of X and Y
  • Var [X] represents the variance of X
  • Var [ Y] represents the variance of Y
  • r (X, Y) is the logical correlation coefficient of the candidate thread and the frame drawing thread.
  • 603 Determine resource correlation coefficients of the candidate thread and the frame drawing thread according to global resource requirements.
  • the drawing frame thread sleeps it can be determined whether the drawing frame thread sleeps due to lack of global resources. If the drawing frame thread sleeps due to lack of global resources, then it is further determined that the global resource currently belongs to the candidate thread. Which thread (or which thread is assigned), assuming that the global resource belongs to the first thread, then the resource correlation coefficient of the first thread and the frame drawing thread is 1, while the resource correlation coefficient of the other threads and the frame drawing thread is 0 Too.
  • the resource correlation coefficients are 1 and 0 for example. In fact, according to the closeness of dependence between other threads and the frame drawing thread, the resource correlation coefficient may also be any value between 0 and 1.
  • the candidate thread When the logical correlation coefficient of the candidate thread and the frame drawing thread exceeds a preset threshold and exceeds a preset threshold (for example, the preset threshold may be 0.8 or 0.9), the candidate thread may be considered to be closely related to the frame drawing thread, and may be considered The candidate thread is an associated thread of the frame drawing thread.
  • step 606 and step 607 need to be performed.
  • the candidate thread When the correlation coefficient between the candidate thread and the frame drawing thread resource exceeds a preset threshold, the candidate thread may be considered as an associated thread of the frame drawing thread. Next, step 606 and step 607 need to be performed.
  • the preset thresholds in step 605 and step 603 may be different thresholds, which may be specifically set according to experience or simulation experiments.
  • steps 606 and 607 may also be executed when the logical correlation coefficient exceeds a preset threshold and the resource correlation coefficient exceeds a preset threshold.
  • Schedule resources for the associated thread group to speed up the execution of threads in the associated thread group.
  • the information of the candidate thread may be recorded, so that the candidate thread is excluded when the associated thread is determined later, thereby speeding up the determination of the associated thread.
  • the information of the candidate thread may also be recorded, so that the candidate thread is excluded when the associated thread is determined later.
  • the target resource scheduling method is an estimated scheduling method based on the load characteristics and load prediction values of the image frame drawing thread.
  • the resource scheduling speed may be slow due to inaccurate prediction of the load prediction value, and the scheduled time cannot be reached Occurs when the image frame is completed.
  • the terminal device may schedule additional resources for the frame drawing thread to speed up the execution speed of the frame drawing thread.
  • the method shown in FIG. 1 further includes: the execution of the drawing frame thread is not completed within a predetermined time, and the method further includes: scheduling additional resources for the drawing frame thread until completion In the drawing of the image frame, the predetermined time is the time required to complete the drawing frame thread when the target resource scheduling mode is used to schedule resources for the drawing frame thread.
  • the drawing of the image frame is completed. If the drawing of the image frame is not completed within a predetermined time, then the resources scheduled for the drawing frame thread according to the target resource scheduling mode may be biased. Less, at this time, additional resources need to be scheduled for the frame drawing thread to speed up the execution of the frame drawing thread, thereby improving the user experience.
  • the size of the additional resource is positively related to the first difference value, where the first difference value is between the time point when the additional resource is scheduled and the time point when the preset time ends Difference.
  • the method shown in FIG. 1 further includes: determining whether the load characteristic of the frame drawing thread is a typical load characteristic; in the case where the load characteristic of the frame drawing thread is a typical load characteristic, The load characteristic of the frame drawing thread and the load prediction value of the frame drawing thread are saved.
  • the load prediction value of the frame drawing thread is the load value corresponding to the typical load characteristic.
  • determining whether the load characteristic of the frame drawing thread is a typical load characteristic includes: determining whether the similarity with the load characteristic of the frame drawing thread among the recorded load characteristics is greater than or equal to a similarity threshold Load characteristic; if there is no load characteristic that has a similarity to the load characteristic of the frame drawing thread that is greater than or equal to the similarity threshold, the load characteristic of the frame drawing thread is determined to be a typical load characteristic.
  • the terminal device here may be a mobile terminal (for example, a smart phone), a computer, a personal digital assistant, a wearable device, a vehicle-mounted device, an Internet of Things device, and so on.
  • the method shown in FIG. 8 includes steps 701 to 704, and these steps are described in detail below.
  • the frame drawing thread of the image frame may be determined.
  • the image frame may be a frame to be displayed by the terminal device, and the image frame may specifically be an image frame and so on.
  • the frame drawing thread is the thread that draws the image frame.
  • the execution speed of the frame drawing thread directly affects the display speed of the image frame, which in turn affects the user experience. Specifically, when the execution speed of the drawing frame thread is slow, the display of the image frame takes a long time, and the user may feel that the picture is stuck; and when the execution speed of the drawing frame thread is fast, the display of the image frame It doesn't take a long time, the user may feel that the screen display is smooth.
  • the application scene corresponding to the frame drawing thread may refer to the type of application where the frame drawing thread is located, for example, the application scene corresponding to the frame drawing thread may be a video application, a game, and other applications that need to interact with the user (for example, WeChat) , Taobao, Weibo) etc.
  • the application scene corresponding to the frame drawing thread can also refer to the stage where the application where the frame drawing thread is located, for example, the application scene corresponding to the frame drawing thread can refer to the startup stage and end stage of the application where the frame drawing thread is located Wait.
  • the application scene corresponding to the frame drawing thread may also refer to a certain stage of the application program where the frame drawing thread is running.
  • the application scene corresponding to the frame drawing thread may be an interface of WeChat (chat interface or click to open) Small video interface).
  • the load prediction value of the frame drawing thread can be determined more reasonably, and then the target resource scheduling method can be determined more reasonably, enabling a more fine-grained Resource scheduling makes resource scheduling more targeted and better.
  • the determining the target load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the application scenario corresponding to the drawing frame thread includes: according to the drawing frame The load characteristic of the thread determines the first load prediction value of the drawing frame thread; the second load prediction value of the drawing frame thread is determined according to the application scene corresponding to the drawing frame thread and the fourth mapping relationship information, wherein The fourth mapping relationship information includes multiple application scenarios and load values corresponding to each of the multiple application scenarios; the target load is determined according to the first load prediction value and the second load prediction value Predictive value.
  • the terminal device when it starts an application, it can recognize that the application is an application startup scenario, and then according to a pre-assigned supply guide (GL) table (the pre-allocated GL table may contain the above-mentioned fourth mapping relationship information) Determine the corresponding load value in the application startup scenario, so as to obtain the second load prediction value.
  • the GL table is similar to a configuration file.
  • the GL table contains the corresponding load value in different scenarios and the corresponding resource scheduling method in different scenarios (choose a large core or a small core, what is the frequency, etc.), according to the GL table can Determine the load value or resource scheduling method corresponding to different application scenarios.
  • Second way Determine the minimum load value among the first load predicted value and the second load predicted value as the target load predicted value.
  • the average value of the first load prediction value and the second load prediction value is determined as the target load prediction value.
  • first load prediction value and the second load prediction value can also be weighted and summed, and the sum of the product of the first load prediction value and the first weighting coefficient and the product of the second load prediction value and the second weighting coefficient can be determined Is a target load prediction value, where the first weighting coefficient and the second weighting coefficient may be preset values.
  • a larger first weighting factor may be set, and when the influence of the application scenario on the load value is relatively small, a smaller first weighting factor may be set.
  • determining the target load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the application scene corresponding to the drawing frame thread includes: when the application scene corresponding to the drawing frame thread is a startup scene , Determining the target load prediction value of the frame drawing thread according to the application scene corresponding to the frame drawing thread and fourth mapping relationship information, where the fourth mapping relationship information includes multiple application scenarios and the multiple applications The load value corresponding to each application scenario in the scenario.
  • the target load prediction value of the frame drawing thread can be directly determined according to the application scene of the frame drawing thread.
  • determining the target load prediction value of the drawing frame thread according to the load characteristics of the drawing frame thread and the application scene corresponding to the drawing frame thread includes: when the application scene corresponding to the drawing frame thread is a startup scene In other scenes, the target load prediction value is determined according to the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is used to indicate the resource requirement characteristic of the frame drawing thread.
  • the load feature of the frame drawing thread may indicate whether the load of the frame drawing thread is computationally intensive or resource intensive, so as to facilitate subsequent determination of the corresponding target resource scheduling mode.
  • the computing resources are mainly scheduled for the frame drawing thread
  • the storage resources are mainly scheduled for the drawing frame thread.
  • the load characteristic of the frame drawing thread may also indicate that the load of the frame drawing thread is computationally intensive and resource intensive. In this case, it is necessary to schedule both computing resources and storage resources for the frame drawing thread.
  • the load characteristic of the frame drawing thread includes at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread.
  • the load characteristics of the drawing frame thread can be directly obtained. Simplify the complexity of obtaining the load characteristics of the frame drawing thread.
  • one or more of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread can be directly used to represent the load characteristics of the frame drawing thread. After the parameters, it is equivalent to obtain the load characteristics of the frame drawing thread.
  • the load characteristic of the frame drawing thread is determined according to at least one of the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval, the The first time interval is a period of time from the start of execution of the drawing thread to the end of execution of the drawing thread.
  • the average number of cycles per instruction, the number of branch instructions, and the cache miss rate of the frame drawing thread in the first time interval can be referred to as the performance indicator data of the frame drawing thread in the first time interval, in determining the load characteristics of the frame drawing thread .
  • the execution of the drawing frame thread is not completed within a predetermined time
  • the method shown in FIG. 7 further includes: scheduling additional resources for the drawing frame thread until the drawing of the image frame is completed, wherein, the The predetermined time is the time required to complete the frame drawing thread when the target resource scheduling method is used to schedule resources for the frame drawing thread.
  • the drawing of the image frame is completed. If the drawing of the image frame is not completed within a predetermined time, then the resources scheduled for the drawing frame thread according to the target resource scheduling mode may be biased. Less, at this time, additional resources need to be scheduled for the frame drawing thread to speed up the execution of the frame drawing thread, thereby improving the user experience.
  • the size of the additional resource is positively related to the first difference value, where the first difference value is between the time point when the additional resource is scheduled and the time point when the preset time ends Difference.
  • mapping relationship information A total of the first mapping relationship information, the second mapping relationship information, the third mapping relationship information, and the fourth mapping relationship information have appeared above. In order to better understand the meaning of each mapping relationship information, the following table 6 is used for each mapping relationship information Is introduced.
  • the above-mentioned various mapping relationship information may be pre-stored, and the above-mentioned various mapping information may be based on historical information recorded by the terminal device (the historical information may include load information, load characteristics, application scenarios, load values, and resource scheduling methods Correspondence between certain information in the) to determine.
  • the above various mapping relationship information can be updated according to the information of the image frame load information, load characteristics, load prediction value, and corresponding resource scheduling method, which is convenient for subsequent The mapping relationship information determines the load prediction value corresponding to the frame drawing thread or the target resource scheduling mode.
  • the resource scheduling method of the embodiment of the present application is described in detail above with reference to FIGS. 1 to 8, and the terminal device of the embodiment of the present application is described below with reference to FIGS. 9 to 11. It should be understood that the terminals in FIGS. 9 to 11 The device can execute each step in the resource scheduling method in the embodiments of the present application. In order to avoid repetition, the following description is appropriately omitted when introducing the terminal devices in FIG. 9 to FIG. 11.
  • FIG. 9 is a schematic block diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 1000 in FIG. 9 includes a processing module 1001 and a scheduling module 1002, where the processing module 1001 and the scheduling module 1002 can perform various steps in the resource scheduling method of the embodiments of the present application referred to in FIGS. 1 to 8 above. .
  • the specific functions of the processing module 1001 and the scheduling module 1002 are as follows:
  • the processing module 1001 is configured to: determine a load characteristic of a frame drawing thread, and the frame drawing thread is used to draw an image frame; and determine a target resource scheduling mode according to the load characteristic of the frame drawing thread;
  • the scheduling module 1002 is used to schedule resources for the frame drawing thread in a target resource scheduling manner.
  • the frame drawing thread is a thread for drawing an image frame
  • the execution speed of the frame drawing thread is directly related to the user experience. Therefore, the target resource scheduling method determined by the load characteristics of the frame drawing thread can schedule the frame drawing thread to Achieving more fine-grained resource scheduling makes resource scheduling more targeted, and the effect of resource scheduling is better.
  • the specific functions of the processing module 1001 and the scheduling module 1002 are as follows:
  • the processing module 1001 is used to: determine the load characteristics of the frame drawing thread, and the frame drawing thread is used to draw an image frame; and determine the frame according to the load characteristics of the frame drawing thread and the application scene corresponding to the frame drawing thread The target load prediction value of the thread; according to the load characteristics of the frame drawing thread, the target load prediction value of the frame drawing thread and the preset target frame rate, determine the target resource scheduling mode;
  • the scheduling module 1002 is used to schedule resources for the frame drawing thread in a target resource scheduling manner.
  • the load prediction value of the frame drawing thread can be determined more reasonably, and then the target resource scheduling method can be determined more reasonably, enabling a more fine-grained Resource scheduling makes resource scheduling more targeted and better.
  • FIG. 10 is a schematic block diagram of a terminal device according to an embodiment of the present application.
  • the terminal device 2000 in FIG. 10 can be divided into a hardware layer 2100, a system layer 2200, and an application layer 2300.
  • the hardware layer 2100 is mainly composed of some physical modules or units.
  • the hardware layer 2100 may include a CPU, double-rate synchronous dynamic random access memory (double data synchronous dynamic random access memory, DDR), and a graphics processor (graphics processing unit (GPU), where the CPU may also include a performance monitoring unit (performance monitoring unit, PMU).
  • DDR double data synchronous dynamic random access memory
  • PMU performance monitoring unit
  • the system layer 2200 may include a scene recognition module, a user experience quantization module, a QoS scheduling controller, a load prediction module, a scheduling module, an energy efficiency collection module, a performance monitoring module, a unified frequency modulation module, and a rendering frame subsystem Media subsystem, grid subsystem and memory management subsystem.
  • each module in the system layer 2200 is as follows:
  • the scene recognition module is used to identify the scene currently used by the user (for example, whether the user is watching a video or an open webpage);
  • the user experience quantization module is used to capture the system frame window information in real time and send it to the kernel.
  • the frame window information mainly refers to the start and end time points of computing devices such as CPU and GPU participating in the frame drawing process during the frame drawing process.
  • the frame window information is used to quantify the user experience, and transform the user-perceived “stuck and pause” experience into specific data that the kernel can perceive;
  • the quality of service (QoS) controller is used to deliver the performance constraints and target frame rate of the current scenario according to the identified current scenario;
  • the load prediction module is used to predict the load of the frame drawing thread to obtain the load prediction value of the frame drawing thread.
  • the load prediction value may be the workload required to complete the frame drawing thread.
  • the workload includes but is not limited to CPU, GPU, DDR and other hard devices need to complete the specific workload;
  • the scheduling module is used to determine the resource supply and related resources for the frame drawing thread (and associated threads) based on the load predicted by the load prediction module and the deadline (the frame thread needs to be completed within the deadline) issued by the upper QoS module. Thread scheduling
  • the energy efficiency collection module is used to collect the current system power consumption in real time to determine the different resource scheduling modes of the optimal energy consumption ratio
  • the performance monitoring module is used to collect the performance working state of the computing device and characterize the frame characteristics according to the state;
  • the frequency modulation module is used to adjust the working frequency of the CPU
  • the rendering frame subsystem is used to render the frame to be displayed.
  • the application layer 2300 may contain application 1, application 2, ... application x, and so on.
  • Application 1, Application 2 ... Application x represents different reference program entities.
  • Application 1 may be WeChat and Application 2 may be Weibo.
  • image frame in the present application may be an image frame currently to be displayed in an application in the application layer 2300 shown in FIG. 10.
  • the terminal devices shown in FIG. 9 and FIG. 10 may specifically be mobile terminals (for example, smart phones), computers, personal digital assistants, wearable devices, vehicle-mounted devices, Internet of Things devices, artificial intelligence devices, and so on.
  • FIG. 11 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
  • the terminal device in FIG. 11 includes a communication module 3010, a sensor 3020, a user input module 3030, an output module 3040, a processor 3050, an audio and video input module 3060, a memory 3070, and a power supply 3080.
  • a communication module 3010 a communication module 3010, a sensor 3020, a user input module 3030, an output module 3040, a processor 3050, an audio and video input module 3060, a memory 3070, and a power supply 3080.
  • the communication module 3010 may include at least one module that enables communication between the terminal device and other terminal devices.
  • the communication module 3010 may include one or more of a wired network interface, a broadcast receiving module, a mobile communication module, a wireless Internet module, a local area communication module, and a location (or positioning) information module.
  • the sensor 3020 can sense some operations of the user, and the sensor 3020 can include a distance sensor, a touch sensor, and the like.
  • the sensor 3020 can sense the user's operation such as touching the screen or approaching the screen.
  • the user input module 3030 is used to receive input digital information, character information, or contact touch operation / contactless gestures, and receive signal input related to user settings and function control of the system.
  • the user input module 3030 includes a touch panel and / or other input devices.
  • the output module 3040 includes a display panel for displaying information input by the user, information provided to the user, various menu interfaces of the system, and the like.
  • the display panel may be configured in the form of a liquid crystal display (liquid crystal) (LCD) or an organic light-emitting diode (OLED).
  • the touch panel may cover the display panel to form a touch display screen.
  • the output module 3040 may also include an audio output module, an alarm, and a haptic module.
  • the audio and video input module 3060 is used to input audio signals or video signals.
  • the audio and video input module 3060 may include a camera and a microphone.
  • the power supply 3080 can receive external power and internal power under the control of the processor 3050, and provide power required for operation of each module of the entire terminal device.
  • the processor 3050 may indicate one or more processors, for example, the processor 3050 may include one or more central processors, or include a central processor and a graphics processor, or include an application processor and a coprocessor (Eg micro control unit or neural network processor). When the processor 3050 includes multiple processors, the multiple processors may be integrated on the same chip, or may be independent chips.
  • a processor may include one or more physical cores, where the physical core is the smallest processing module.
  • the memory 3070 stores a computer program including an operating system program 3071, an application program 3072, and the like.
  • Typical operating systems such as Microsoft ’s Windows, Apple ’s MacOS, and other systems for desktops or notebooks, and Google ’s Android Systems such as systems for mobile terminals.
  • Microsoft ’s Windows, Apple ’s MacOS, and other systems for desktops or notebooks and Google ’s Android Systems such as systems for mobile terminals.
  • the memory 3070 may be one or more of the following types: flash memory, hard disk type memory, micro multimedia card type memory, card memory (such as SD or XD memory), random access memory (random access memory) , RAM), static random access memory (static RAM, SRAM), read-only memory (read only memory, ROM), electrically erasable programmable read-only memory (electrically erasable programmable-read-only memory (EEPROM), programmable Read only memory (programmable ROM, PROM), magnetic memory, magnetic disk or optical disk.
  • the memory 3070 may also be a network storage device on the Internet, and the system may perform operations such as updating or reading the memory 3070 on the Internet.
  • the processor 3050 is used to read the computer program in the memory 3070 and then execute the method defined by the computer program. For example, the processor 3050 reads the operating system program 3072 to run the operating system on the system and implement various functions of the operating system, or read Take one or more application programs 3071 to run applications on the system.
  • the above-mentioned memory 3070 may store a computer program (the computer program is a program corresponding to the resource scheduling method in the embodiment of the present application).
  • the processor 3050 executes the program and the program, the processor 3050 can execute Resource scheduling method.
  • the memory 3070 also stores other data 3073 in addition to the computer program.
  • the memory 3070 may store the load characteristics of the frame drawing thread involved in the resource scheduling method of the present application, the load prediction value of the frame drawing thread, and so on.
  • connection relationship of each module in FIG. 11 is only an example, and the method provided by any embodiment of the present application may also be applied to terminal devices of other connection methods, for example, all modules are connected through a bus.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the units is only a division of logical functions.
  • there may be other divisions for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment 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 function is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
  • the technical solution of the present application essentially or part of the contribution to the existing technology or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other media that can store program codes .

Abstract

本申请提供了一种应用于终端设备操作系统的资源调度方法,以及应用该方法的终端设备。该方法将资源调度细化到绘帧线程的粒度,在确定资源调度方式时考虑了绘帧线程的资源需求信息或运行信息等负载特征。绘帧线程执行的快慢直接与用户体验相关,因此,通过绘帧线程的负载特征确定出目标资源调度方式,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。

Description

资源调度方法和终端设备
本申请要求于2018年10月11日提交中国专利局、申请号为201811184979.7、申请名称为“资源调度方法和终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端设备领域,并且更具体地,涉及一种资源调度方法和终端设备。
背景技术
随着终端设备性能的提升,终端设备的功耗也越来越高,但是电池容量的提升却十分缓慢,无法跟上终端设备性能提升的速度。因此,为了保证终端设备的性能,进而满足用户体验,需要根据终端设备当前执行的任务的负载情况对当前任务进行资源调度。
传统方案一般是统计终端设备当前执行的任务在一段历史时间内的负载情况,然后根据统计得到的负载情况对为当前执行的任务进行资源调度。例如,当前执行的任务的负载较大时,可以增大中央处理器(central processing unit,CPU)的工作频率,而当前执行的任务的负载较小时,可以减小CPU的工作频率。但是传统方案是根据已经发生的一段时间的负载情况进行资源调度,资源调度的准确性不高,并有一定的滞后性。
发明内容
本申请提供一种资源调度方法和终端设备,以更精准地进行资源调度。
第一方面,提供了一种资源调度方法,该方法应用于终端设备,该方法包括:确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;根据所述绘帧线程的负载特征确定目标资源调度方式;以所述目标资源调度方式为所述绘帧线程调度资源。
上述终端设备可以是移动终端(例如,智能手机),电脑,个人数字助理,可穿戴设备,车载设备,物联网设备等等。上述终端设备还可以是其它能够显示画面的设备。
上述终端设备可以是运行各种操作系统的设备。例如,上述终端设备可以是运行安卓系统的设备,也可以是运行IOS系统的设备,也可以是运行windows系统的设备。
在以目标资源调度方式为绘帧线程调度资源时,可以为绘帧线程调度计算资源(例如,调度CPU的某个核来执行绘帧线程),也可以为绘帧线程调度存储资源(例如,调度某些存储单元来存储绘帧线程运行过程中的数据),还可以为绘帧线程同时调度计算资源和存储资源。
上述绘帧线程可以是绘制图像帧的全部线程或者部分线程。
应理解,在确定绘帧线程的负载特征之前,可以先确定绘帧线程。
可选地,确定所述绘帧线程,包括:将绘制图像帧的过程中调用绘帧关键函数的线程确定为绘帧线程。
上述绘帧关键函数可以是指绘制图像帧的过程中的一些关键函数,绘帧关键函数可以是预设的。具体地,上述绘帧关键函数可以是根据终端设备所采用的操作系统的类型来确定的,不同类型的操作系统对应的绘帧关键函数可以不同,例如,IOS系统对应的绘帧关键函数与安卓系统对应的绘帧关键函数不同。
本申请中,由于绘帧线程执行的快慢直接与用户体验相关,因此,通过绘帧线程的负载特征来确定目标资源调度方式,进而以目标资源调度方式直接对绘帧线程进行资源调度,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
结合第一方面,在第一方面的某些实现方式中,所述绘帧线程的负载特征用于指示绘帧线程的资源需求特性。
具体地,绘帧线程的资源需求特性可以指示绘帧线程的负载是计算密集型还是资源密集型,便于后续确定相应的目标资源调度方式。
例如,当绘帧线程的负载是计算密集型的负载,在为绘帧线程调度资源时,可以主要调度计算资源,而当绘帧线程的负载是资源密集型的负载,在为绘帧线程调度资源时,可以主要调度存储资源。
当绘帧线程的资源需求特性指示绘帧线程的负载是既是计算密集型又是资源密集型时,在为绘帧线程调度资源时,可以既调度计算资源又调度存储资源。
结合第一方面,在第一方面的某些实现方式中,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
本申请中,当采集到绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种时,就能够直接获取到绘帧线程的负载特征,可以简化获取绘帧线程的负载特征的复杂度。
应理解,绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种可以直接用于表示绘帧线程的负载特征,或者,也可以用绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种处理后得到的参数来表示绘帧线程的负载特征。
结合第一方面,在第一方面的某些实现方式中,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内(或者称为第一时间段内)的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间。
上述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率可以称为绘帧线程在第一时间间隔内的性能指标数据,在确定绘帧线程的负载特征时,可以直接将绘帧线程在第一时间间隔内的性能指标数据中的部分参数确定为绘帧线程的负载特征,也可以对绘帧线程在第一时间间隔内的性能指标数据进行处理或者运算(例如,对其中的两种参数做商运算,或者对某些参数进行哈希运算等等),将处理或运算得到的数据确定为绘帧线程的负载特征。
可选地,所述确定所述绘帧线程的负载特征,包括:记录所述绘帧线程在第一时间间隔内的性能指标数据,其中,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间,所述绘帧线程在所述第一时间间隔内的性能指标数据包括所述绘帧线程在所述第一时间间隔内的平均每条指令周期数、分支指令数、缓存缺失率以及 程序计数器中的至少一种;根据所述绘帧线程在第一时间间隔内的性能指标数据确定所述绘帧线程的负载特征。
可选地,上述第一时间间隔的长度是根据能够采集到的性能指标数据来确定的。
具体地,第一时间间隔可以设置成一个能够采集到足够多的性能指标数据所需要的时间,另外,在设置第一时间间隔时还可以为第一时间设置一个占比阈值,第一时间间隔占图像帧的绘帧时间的比例不能超过该占比阈值。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定所述目标资源调度方式。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定所述目标资源调度方式,包括:根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定对所述绘帧线程进行资源调度的至少一种资源调度方式;将所述至少一种资源调度方式中对应功耗最低的资源调度方式确定为所述目标资源调度方式。
本申请中,通过将多种可选的资源调度方式对应功耗最小的资源调度方式确定为目标资源调度方式,能够在满足绘帧线程的资源调度要求的情况下,尽可能的减少功耗,从而实现性能与功耗的平衡。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及第一映射关系信息,确定所述目标资源调度方式,其中,所述第一映射关系信息包括多种负载信息和所述多种负载信息中的每种负载信息对应的资源调度方式,所述多种负载信息中的每种负载信息包括一个负载特征和一个负载值。
可选地,上述第一映射关系信息是根据终端设备记录的历史信息确定的,该历史信息包括绘帧线程绘制的图像帧之前的图像帧的负载特征、负载值以及对应的资源的调度方式。
上述第一映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载特征、负载值以及对应的资源的调度方式的信息。
本申请中,通过根据绘帧线程的负载特征、负载预测值以及第一映射关系信息来确定目标资源调度方式,与通过直接计算的方式确定目标资源调度方式相比,能够简化确定目标资源调度方式的复杂度。
可选地,所述方法还包括:记录所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及所述目标资源调度方式,以更新所述第一映射关系信息。
通过更新第一映射关系信息,能够增加第一映射关系信息包含的负载信息的种类,便于后续依据第一映射关系信息确定资源调度方式。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值,包括:根据所述绘帧线程的负载特征和第二映射关系信息,确定所述绘帧线程的负载预测值,其中,所述第二映射关系信息包含多种负载特征以及所述多种负载特征中的每种负载特征对应的负载值。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征以及第二映射关系信息确定所述绘帧线程的负载预测值,包括:在所述第二映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征以及第二映射关系信息确定所述绘帧线程的负载预测值,包括:在所述第二映射关系信息中的多种负载特征中不存在所述参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
可选地,上述第二映射关系信息是根据终端设备记录的历史信息确定的,该历史信息可以包括绘帧线程绘制的图像帧的负载特征和对应的负载值。
上述第二映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载特征和对应的负载值的信息。
本申请中,通过绘帧线程的负载特征以及第二映射关系,能够较为方便地确定出绘帧线程的负载预测值,与直接根据绘帧线程的负载特征分析或计算绘帧线程的负载值的方式相比,确定绘帧线程的负载预测值的方式更为简便。
可选地,所述方法还包括:记录所述绘帧线程的负载特征和所述绘帧线程的负载预测值,以更新所述第二映射关系信息。
通过更新第二映射关系信息,能够增加第二映射关系信息包含的负载特征的种类,便于后续依据第二映射关系信息确定绘帧线程的负载预测值。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,其中,所述第三映射关系信息包括多种负载特征以及所述多种负载特征中的每种负载特征对应的资源调度方式。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,包括:在所述第三映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
结合第一方面,在第一方面的某些实现方式中,所述根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,包括:在所述第三映射关系信息中的多种负载特征不存在所述参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的绘帧线程的目标资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
可选地,上述第三映射关系信息是根据终端设备记录的历史信息确定的,该历史信息包括绘帧线程绘制的图像帧之前的图像帧的负载特征以及相应的资源调度方式。
上述第三映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载特征和对应的资源调度方式的信息。
本申请中,通过绘帧线程的负载特征以及负载特征与资源调度方式的映射关系信息来直接确定目标资源调度方式,能够省略确定绘帧线程的负载预测值的过程,可以进一步简化确定目标资源调度方式的复杂度。
可选地,所述方法还包括:记录所述绘帧线程的负载特征以及所述绘目标资源调度方式,以更新所述第三映射关系信息。
通过更新第三映射关系信息,能够增加第三映射关系信息包含的负载特征的种类,便于后续依据第三映射关系信息确定绘帧线程对应的资源调度方式。
结合第一方面,在第一方面的某些实现方式中,所述方法还包括:确定所述绘帧线程的关联线程,其中,所述关联线程是能够引起所述绘帧线程休眠的线程;为所述关联线程调度资源,以加快所述关联线程的执行。
上述引起绘帧线程休眠可以是指引起绘帧线程间歇性休眠或者停止工作。
本申请中,通过为关联线程调度资源,能够间接加快绘帧线程的执行速度,提高用户体验。
结合第一方面,在第一方面的某些实现方式中,在预定时间内未完成所述绘帧线程的执行,所述方法还包括:为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
应理解,当完成绘帧线程的执行时,也就完成了绘帧线程对应的图像帧的绘制,如果在预定时间内仍未完成绘帧线程的执行,那么,说明根据目标资源调度方式为绘帧线程调度的资源可能偏少,此时,需要为绘帧线程调度额外的资源,以加快绘帧线程的执行,从而提高用户体验。
结合第一方面,在第一方面的某些实现方式中,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
当第一差值越大时,超出预定时间越长,通过为绘帧线程调度更多的资源,以尽快完成绘帧线程的执行。
应理解,当绘帧线程完成时,停止为绘帧线程调度额外资源。
第二方面,提供了一种资源调度方法,该方法应用于终端设备,该方法包括:确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值;根据所述绘帧线程的负载特征、所述绘帧线程的目标负载预测值以及预设的目标帧率,确定目标资源调度方式;以所述目标资源调度方式为所述绘帧线程调度资源。
上述终端设备可以是移动终端(例如,智能手机),电脑,个人数字助理,可穿戴设备,车载设备,物联网设备等等。上述终端设备还可以是其它能够显示画面的设备。
上述终端设备可以是运行各种操作系统的设备。例如,上述终端设备可以是运行安卓系统的设备,也可以是运行IOS系统的设备,也可以是运行windows系统的设备。
绘帧线程对应的应用场景可以是指绘帧线程所在的应用程序的类型,例如,绘帧线程对应的应用场景可以是视频应用程序,游戏以及其它需要与用户进行交互的应用程序(例如,微信,淘宝,微博)等等。
另外,绘帧线程对应的应用场景还可以是指绘帧线程所在的应用程序所处的阶段,例如,绘帧线程对应的应用场景可以是指绘帧线程所在应用程序的启动阶段,结束阶段等等。
或者,绘帧线程对应的应用场景还可以是指绘帧线程所在的应用程序运行时的某个阶段,例如,绘帧线程对应的应用场景可以是微信的某个界面(聊天界面或者是点开小视频的界面)。
应理解,在确定绘帧线程的负载特征之前,可以先确定绘帧线程。
可选地,确定所述绘帧线程,包括:将绘制图像帧的过程中调用绘帧关键函数的线程确定为绘帧线程。
上述绘帧关键函数可以是指绘制图像帧的过程中的一些关键的函数,绘帧关键函数可以是预设的。具体地,上述绘帧关键函数可以是根据终端设备所采用的操作系统的类型来确定的,不同类型的操作系统可以对应不同的绘帧关键函数,绘帧关键函数可能有所不同,例如,对于IOS系统和安卓系统来说,两者对应的绘帧关键函数有所不同。
本申请中,综合绘帧线程的负载特征和绘帧线程对应的应用场景,能够更合理地确定绘帧线程的负载预测值,进而更合理的确定目标资源调度方式,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
结合第二方面,在第二方面的某些实现方式中,所述根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:根据所述绘帧线程的负载特征确定所述绘帧线程的第一负载预测值;根据所述绘帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的第二负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值;根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值。
本申请中,通过绘帧线程的负载特征和应用场景先各自确定出一个负载预测值,然后再根据得到的两个负载预测值确定最终的目标负载预测值,能够更好地确定目标负载值,进而能够更好地确定目标资源调度方式。
可选地,根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值,包括:将所述第一负载预测值和所述第二负载预测值中的最大负载值确定为所述目标负载预测值。
可选地,根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值,包括:将所述第一负载预测值和所述第二负载预测值中的最小负载值确定为所述目标负载预测值。
可选地,根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值,包括:根据公式C=A*C1+B*C2确定目标负载预测值。
其中,C1为第一负载预测值,C2为第二负载预测值,C为目标负载预测值,A为第一加权系数,B为第二加权系数。
当应用场景对负载值的影响比较大时,可以为A设置一个较大数值,当应用场景对负载值的影响比较小时,可以为A设置一个较小的数值。
可选地,根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值,包括:将所述第一负载预测值和所述第二负载预测值的平均值确定为所述目标负载预测值。
可选地,根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘 帧线程的目标负载预测值,包括:当绘帧线程对应的应用场景为启动场景时,根据所述绘帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的目标负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值。
当绘帧线程对应的场景为启动场景时,由于启动场景对应的负载值较大,因此,可以直接根据绘帧线程的应用场景来确定绘帧线程的目标负载预测值。
可选地,根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:当绘帧线程对应的应用场景为启动场景之外的其它场景时,根据所述绘帧线程的负载特征确定所述目标负载预测值。
结合第二方面,在第二方面的某些实现方式中,所述绘帧线程的负载特征用于指示绘帧线程的资源需求特性。
具体地,绘帧线程的资源需求特性可以指示绘帧线程的负载是计算密集型还是资源密集型,便于后续确定相应的目标资源调度方式。
例如,当绘帧线程的负载是计算密集型的负载,在为绘帧线程调度资源时,可以主要调度计算资源,而当绘帧线程的负载是资源密集型的负载,在为绘帧线程调度资源时,可以主要调度存储资源。
当绘帧线程的资源需求特性指示绘帧线程的负载是既是计算密集型又是资源密集型时,在为绘帧线程调度资源时,可以既调度计算资源又调度存储资源。
结合第二方面,在第二方面的某些实现方式中,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
本申请中,当采集到绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种时,就可以直接获取到绘帧线程的负载特征了,能够简化获取绘帧线程的负载特征的复杂度。
应理解,绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种可以直接用于表示绘帧线程的负载特征,当获取到了绘帧线程的这些参数后,就相当于获取到了绘帧线程的负载特征了。
结合第二方面,在第二方面的某些实现方式中,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间。
上述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率可以称为绘帧线程在第一时间间隔内的性能指标数据,在确定绘帧线程的负载特征时,可以直接将绘帧线程在第一时间间隔内的性能指标数据中的部分参数确定为绘帧线程的负载特征,也可以对绘帧线程在第一时间间隔内的性能指标数据进行处理或者运算(例如,对其中的两种参数做商运算,或者对某些参数进行哈希运算等等),将处理或运算得到的数据确定为绘帧线程的负载特征。
结合第二方面,在第二方面的某些实现方式中,在预定时间内未完成所述绘帧线程的执行,所述方法还包括:为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘 帧线程所需要的时间。
应理解,如果绘帧线程在预定时间内仍未完成绘制,那么,说明根据目标资源调度方式为绘帧线程调度的资源可能偏少,此时,需要为绘帧线程调度额外的资源,以加快绘帧线程的执行,从而提高用户体验。
结合第二方面,在第二方面的某些实现方式中,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
当第一差值越大时,超出预定时间越长,通过为绘帧线程调度更多的资源,以尽快完成绘帧线程的执行。
第三方面,提供了一种终端设备,所述终端设备包括用于执行上述第一方面及第一方面中的任意一种实现方式中的方法的模块。
第四方面,提供了一种终端设备,所述终端设备包括用于执行上述第二方面及第二方面中的任意一种实现方式中的方法的模块。
第五方面,提供了一种终端设备,包括存储器和处理器,所述存储器用于存储程序,所述处理器用于执行程序,当所述程序被执行时,所述处理器用于执行上述第一方面及第一方面中的任意一种实现方式中的方法。
第六方面,提供了一种终端设备,包括存储器和处理器,所述存储器用于存储程序,所述处理器用于执行程序,当所述程序被执行时,所述处理器用于执行上述第二方面及第二方面中的任意一种实现方式中的方法。
第七方面,提供了一种计算机可读存储介质,所述计算机可读介质存储介质用于存储程序代码,当所述程序代码被计算机执行时,所述计算机用于执行上述第一方面及第一方面中的任意一种实现方式中的方法。
第八方面,提供了一种计算机可读存储介质,所述计算机可读介质存储介质用于存储程序代码,当所述程序代码被计算机执行时,所述计算机用于执行上述第二方面及第二方面中的任意一种实现方式中的方法。
可选地,在上述第七方面和第八方面中,计算机可读存储介质可以位于终端设备内部,计算机可读介质存储的程序代码可以被终端设备执行,当该程序代码被终端设备执行时,终端设备能够执行上述第一方面及第一方面中的任意一种实现方式中的方法或者上述第二方面及第二方面中的任意一种实现方式中的方法。
第九方面,提供了一种芯片,所述芯片包括处理器,所述处理器用于执行上述第一方面及第一方面中的任意一种实现方式中的方法。
第十方面,提供了一种芯片,所述芯片包括处理器,所述处理器用于执行上述第二方面及第二方面中的任意一种实现方式中的方法。
第十一方面,提供了一种用于使得计算机或者终端设备执行上述第一方面及第一方面中的任意一种实现方式中的方法的计算机程序(或称计算机程序产品)。
第十二方面,提供了一种用于使得计算机或者终端设备执行上述第二方面及第二方面中的任意一种实现方式中的方法的计算机程序(或称计算机程序产品)。
附图说明
图1是本申请实施例的资源调度方法的示意性流程图;
图2是确定绘帧线程的过程的示意图;
图3是根据绘帧线程的性能指标数据获取绘帧线程的负载特征的示意性流程图;
图4是本申请实施例的资源调度方法的示意性流程图;
图5是根据绘帧线程的负载特征确定绘帧线程的负载预测值的示意性流程图;
图6图6是根据绘帧线程的负载特征对绘帧线程进行资源调度的示意性流程图;
图7是确定关联线程以及为关联线程调度资源的示意性流程图;
图8是本申请实施例的资源调度方法的示意性流程图;
图9是本申请实施例的终端设备的示意性框图;
图10是本申请实施例的终端设备的示意性框图;
图11是本申请实施例的终端设备的结构示意图。
具体实施方式
下面将结合附图,对本申请中的技术方案进行描述。
在传统方案中,终端设备主要是依据当前任务的负载情况来确定相应的资源调度方式,然后以该资源调度方式来调度资源。这种方式主要以当前任务的负载情况来确定如何调度。这种调度方式并不感知用户体验,在调度过程中虽然可以完成对相应任务的执行,但是并不一定带来较好的用户体验。
对于终端设备来说,用户体验的好坏与图像帧的显示的快慢有明显的相关性,当图像帧的显示速度较慢时用户会感觉到卡顿,用户体验不好,而当图像帧的速度显示的较快时,用户感觉比较流畅,用户体验较好。比如,用户正在玩游戏,如果图像帧的显示速度较快,用户会感觉很游戏很流畅,相反,用户会感觉到游戏卡顿。
通过分析发现,图像帧的显示的快慢与绘帧线程的执行有着明显的对应关系,当绘帧线程执行较快时,图像帧显示的较快,当绘帧线程执行较慢时,图像帧显示的也比较慢。因此,为了精细的资源调度,可以直接为绘帧线程调度资源,以更合理的调度资源。
下面结合图1对本申请实施例的资源调度方法进行详细的描述。应理解,本申请中的调度的资源既可以是计算资源(例如,CPU),也可以是存储资源(例如,存储空间)。
图1是本申请实施例的资源调度方法的示意性流程图。图1所示的方法可以由终端设备执行。这里的终端设备可以是移动终端(例如,智能手机),电脑,个人数字助理,可穿戴设备,车载设备,物联网设备等等。
图1所示的方法包括步骤101至步骤103,下面对这些步骤进行详细的介绍。
101、确定绘帧线程的负载特征,该绘帧线程用于绘帧图像帧。
上述图像帧还可以称为图像的帧,为了简洁,本文中统一称为图像帧。
绘帧线程执行的快慢可能会影响到用户的体验。例如,当绘帧线程执行的速度较慢时,图像帧的绘制需要较长的时间,用户会感觉到画面比较卡顿;而当绘帧线程执行的速度较快时,图像帧的绘制在较短时间内即可完成,用户会感觉到画面比较流畅。
绘帧线程的负载特征能够反映出绘帧线程的一些负载特性,例如,绘帧线程的负载特征能够反映绘帧线程是计算密集型(对计算资源的需求较大)还是访存密集型(对存储资源的需求较大),绘帧线程的负载特征还可以反映绘帧线程的时延特性(低时延或者高时 延)。
可选地,在步骤101之前,可以先确定绘帧线程。
具体地,可以将绘制图像帧的过程中调用绘帧关键函数的线程确定为绘帧线程。例如,当绘帧关键函数被调用时,在该绘帧关键函数中确定调用该绘帧关键函数的线程,该调用绘帧关键函数的线程就是绘帧线程。
上述绘帧关键函数可以是指绘制图像帧的过程中的一些关键函数,绘帧关键函数可以是预设的。具体地,上述绘帧关键函数可以是根据终端设备所采用的操作系统的类型来确定的,不同类型的操作系统对应的绘帧关键函数可以不同,例如,IOS系统对应的绘帧关键函数与安卓系统对应的绘帧关键函数不同。
下面结合图2对安卓系统中确定绘帧线程的过程进行详细的描述。
图2示出了绘制一帧图像的过程包括:创建画布-测量布局-创建视图-渲染-合成-交换缓冲-送显。
上述从创建画布到送显的过程可以看成是调用绘帧关键函数后来绘制图像帧的一系列步骤,其中,各个过程中会有相应的线程调用绘帧关键函数(其中,不同的步骤或者过程可以由相同的线程执行也可以由不同的线程执行),因此,可以将这些过程中运行的线程确定为绘帧线程。
应理解,由于送显过程主要与硬件性能有关,而与资源调度的关系不大,因此,还可以将图2中的创建画布到交换缓冲的过程中调用绘帧关键函数的线程确定为绘帧线程。
在步骤101中,可以通过记录绘帧线程的性能指标数据的方式来确定绘帧线程的负载特征。
可选地,上述绘帧线程的负载特征用于指示绘帧线程的资源需求特性。
具体地,上述绘帧线程的资源需求特性可以指示绘帧线程的负载是计算密集型还是资源密集型,便于后续确定相应的目标资源调度方式。
可选地,上述绘帧线程的负载特征可是用于指示绘帧线程的资源需求特性、绘帧线程的时延特性以及绘帧线程的运行特性中的至少一种。
绘帧线程的负载特征能够反映绘帧线程的负载的总体特征,便于后续根据绘帧线程的负载特征进行资源调度。
可选地,作为一个实施例,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束前的一段时间。
其中,平均每条指令周期数(cycles per instruction,CPI)表示每条计算机指令执行所需的时钟周期(也可以称为指令的平均周期数)。平均CPI可以通过公式X=Y/Z计算得到,其中,Y表示一段时间内的时钟周期数,Z表示一段时间内的指令数目,X为平均CPI。分支指令数用于指示分支(分支就是一段程序)的数量,也可以认为是跳转指令的数量,一个跳转指令就代表一条分支。
在确定绘帧线程的负载特征时,可以先采集绘帧线程在一段时间内的性能指标数据,然后根据绘帧线程在该段时间内的性能指标数据来确定绘帧线程的负载特征。
可选地,作为一个实施例,确定绘帧线程的负载特征,包括:记录绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种,其中,所述 第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束前的一段时间;根据绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定绘帧线程的负载特征。
上述第一时间间隔的设置可以根据能够采集到的性能指标数据来确定,第一时间间隔可以设置成一个能够采集到足够多的性能指标数据所需要的时间,另外,在设置第一时间间隔时还可以为第一时间间隔设置一个占比阈值,第一时间间隔占图像帧的绘制时间的比例不能超过该占比阈值(超过该占比阈值后,图像帧接近完成绘帧线程,此时再为图像帧调度资源已经失去意义了)。
上述程序计数器可以记录图像帧正在执行的指令的地址,上述绘帧线程在第一时间间隔内的程序计数器可以是图像帧在第一时间间隔内执行的指令所在的地址。
可选地,在确定绘帧线程的负载特征时,可以直接将绘帧线程在第一时间间隔内的性能指标数据确定为绘帧线程的负载特征,也可以先对绘帧线程在第一时间间隔内的性能指标数据做一些分析或者处理,将分析或者处理得到的数据或者参数(处理得到的数据或者参数可以是反映图像帧整体负载特性的数据或者参数)作为绘帧线程的负载特征。
例如,当在第一时间间隔内采集到绘帧线程的两种性能指标数据时,可以对这两种性能指标数据做除法(具体可以对绘帧线程在第一时间间隔内的平均每条指令周期数和绘帧线程在第一时间间隔内的分支指令数做除法处理),用得到的数值来表示绘帧线程的负载特征。
另外,当采集到第一时间间隔内的某些性能指标数据时,还可以对这些性能指标数据进行哈希运算(例如,可以对程序计数器采集到的图像帧执行的指令的地址进行哈希运算),然后用运算得到的信息或者参数来表示绘帧线程的负载特征。
应理解,在上述第一时间间隔内可以多次采集绘帧线程的性能指标数据,然后根据多次采集到的各种性能指标数据来综合确定绘帧线程的负载特征,能够更准确的确定绘帧线程的负载特征。一般来说,采集绘帧线程的性能指标数据的次数越多,采集的越密集,确定出来的绘帧线程的负载特征的准确率越高,但同时开销也比较大。因此,在实际应用中可以根据经验或者仿真结果来确定第一时间间隔的长度以及采集性能指标数据的频率。
下面结合表1对绘帧线程的性能指标数据的具体表现形式进行详细的说明,表1示出了绘帧线程0和绘帧线程1采集到的平均每条指令周期数、分支指令数、缓存缺失率以及程序计数器的具体数值。以绘帧线程0为例,在一段时间间隔内采集到的绘帧线程0的平均指令周期数的具体数值分别为0.7、0.72、0.6、0.8等等,在一段时间间隔内采集到的绘帧线程0的分支指令数分别为98k、87k、102k等等,在一段时间间隔内采集到的绘帧线程0的缓存缺失率分别为0.008、0.002、0.01等等,在一段时间间隔内采集到的绘帧线程0的程序计数器分别为0xe8dab47a、0xe8dac79b等等。应理解,表1只是绘帧线程的负载特征的一种具体表现形式(表1中的各种参数的取值也是一种具体的例子),实际上,绘帧线程的负载特征还可以包含表1中的参数中的至少一种,或者还可以包含其它能够反映绘帧线程性能的参数。
表1
Figure PCTCN2019090573-appb-000001
Figure PCTCN2019090573-appb-000002
102、根据绘帧线程的负载特征确定目标资源调度方式。
103、以目标资源调度方式为绘帧线程调度资源。
对于计算密集型的绘帧线程,在确定目标资源调度方式时,可以考虑调度更多的计算资源。而对于存储密集型的绘帧线程,在确定目标资源调度方式时,可以考虑调度更多的存储资源。对于低时延要求的绘帧线程,在确定目标资源调度方式时可以调度更多的资源以加快绘帧线程的执行,而对于高时延要求的绘帧线程,在确定目标资源调度方式,调度适当的资源即可(由于是高时延业务,不必调度过多的资源执行该线程)。
本申请中,由于绘帧线程是绘制图像帧的线程,绘帧线程执行的快慢直接与用户体验相关,因此,通过绘帧线程的负载特征确定的目标资源调度方式对绘帧线程进行调度,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
可选地,当根据绘帧线程的性能指标数据获取到绘帧线程的负载特征后,可以先确定历史记录信息中是否已经包含了该负载特征,如果历史记录信息没有包含该负载特征,那么,就继续获取该绘帧线程的负载值,并记录该绘帧线程的负载特征和负载值;如果历史记录信息中已经包含了该负载特征,说明可能已经记录了该绘帧线程的负载值了,此时只需要记录绘帧线程的负载特征即可(记录绘帧线程的负载特征可以是为了后续确定目标资源调度方式)。
图3是根据绘帧线程的性能指标数据获取绘帧线程的负载特征的示意性流程图。图3所示的过程包括步骤201至步骤207,下面对步骤201至步骤207进行详细的介绍。
201、开始。
步骤201表示开始对绘帧线程的性能指标数据进行采集,步骤201开始的时间可以是绘帧线程开始执行的时间。
202、采集绘帧线程的性能指标数据。
上述性能指标数据可以是绘帧线程在一段时间内(具体可以是上述第一时间间隔)的平均每条指令周期数、分支指令数、缓存缺失率以及程序计数器中的至少一种。
203、是否达到图像帧的帧特征边界。
上述帧特征边界可以是一段时间间隔,在该段时间间隔内采集绘帧线程的性能指标数据,当超出该段时间后,停止采集绘帧线程的性能指标数据。具体地,上述帧特征边界可以是上文中的第一时间间隔。
204、根据采集到的性能指标数据,确定绘帧线程的负载特征。
应理解,步骤204中确定绘帧线程的负载特征的具体方式和过程可以参见上文中步骤101至步骤103中相关段落中确定绘帧线程的负载特征的具体方式和过程。
205、绘帧线程的负载特征是否为已记录的负载特征。
应理解,已记录的负载特征可以是终端设备记录的图像帧之前的帧的负载特征,并且, 已记录的负载特征可以只包含不同的负载特征。
206、记录绘帧线程的负载特征。
步骤206中记录绘帧线程的负载特征主要是为了便于后续确定目标资源调度方式。
207、记录绘帧线程的负载特征和负载值。
在步骤207中,可以根据绘帧线程的负载特征确定绘帧线程的负载预测值(具体可以参见本文中根据绘帧线程的负载特征确定绘帧线程的负载预测值的相关内容),并将绘帧线程的负载预测值作为绘帧线程的负载值,然后记录绘帧线程的负载特征和负载值,便于后续直接根据记录的负载特征和负载值的对应关系来确定负载值。
本申请中,在根据绘帧线程的负载特征确定目标资源调度方式时,可以根据绘帧线程的负载的具体特点来确定资源的调度方式,例如,可以为绘帧线程调度更多的资源,从而加快绘帧线程的执行速度,提高用户体验。
在步骤103中,根据绘帧线程的负载特征确定目标资源调度方式的具体方式有多种。具体地,可以先根据绘帧线程的负载特征确定出绘帧线程的负载预测值,然后根据绘帧线程的负载特征和绘帧线程的负载预测值以及预设的目标帧率来计算确定目标资源调度方式;也可以根据绘帧线程的负载特征、绘帧线程的负载预测值以及预设的对应关系(这里的对应关系包括负载特征、负载值以及资源调度方式之间的对应关系)来确定目标资源调度方式,也可以直接根据绘帧线程的负载特征以及预设的对应关系(这里的对应关系包括负载特征与资源调度方式之间的对应关系)直接确定目标资源调度方式。
可选地,作为一个实施例,据绘帧线程的负载特征确定目标资源调度方式,包括:根据绘帧线程的负载特征确定绘帧线程的负载预测值;根据绘帧线程的负载特征、绘帧线程的负载预测值以及预设的目标帧率,确定目标资源调度方式。
进一步的,在根据绘帧线程的负载特征、绘帧线程的负载预测值以及预设的目标帧率确定目标资源调度方式时,可以先根绘帧线程的负载特征、绘帧线程的负载预测值以及预设的目标帧率确定出多种可选的资源调度方式,然后再将多种可选的资源调度方式中对应功耗最小的资源调度方式确定为目标资源调度方式。
本申请中,通过将多种可选的资源调度方式对应功耗最小的资源调度方式确定为目标资源调度方式,能够在满足图像帧的绘帧线程的资源调度要求的情况下,尽可能的减少功耗,从而实现性能与功耗的平衡。
图4是本申请实施例的资源调度方法的示意性流程图。应理解,图4所示的方法中主要示出了根据绘帧线程的负载特征确定目标资源调度方式的过程,图4所示的方法包括步骤301至步骤304,下面对步骤301至步骤304进行详细的介绍。
301、根据绘帧线程的负载特征确定绘帧线程的负载预测值。
302、根据绘帧线程的负载特征确定绘帧线程的资源调度方式的目标类型。
应理解,上述步骤301和步骤302没有先后顺序之分,步骤301和步骤302既可以同时进行,也可以先后进行(先执行步骤301后执行步骤302,或者,先执行步骤302后执行步骤301)。
对于不同类型的负载,需要的资源调度方式也有所差异,步骤202中是根据绘帧线程的负载特征确定与该绘帧线程的负载特征相匹配的资源调度方式的类型。
例如,当绘帧线程的负载为计算密集型时,与绘帧线程相匹配的资源调度方式的类型 主要是调度计算资源,而当绘帧线程的负载为存储密集型时,与绘帧线程相匹配的资源调度方式的类型主要是调度存储资源。
303、据绘帧线程的负载预测值和目标帧率从目标类型的资源调度方式中确定出至少一种资源调度方式。
例如,当上述目标类型为调度计算资源时,在步骤303中就需要在调度计算资源的类型中确定出至少一种资源调度方式。
304、将至少一种资源调度方式中对应功耗最低的资源调度方式确定为目标资源调度方式。
在步骤304中,可以根据能效表或者能效曲线,确定至少一种资源调度方式中对应功耗最低的资源调度方式,然后将该功耗最低的资源调度方式确定为目标资源调度方式。
上述能效表的具体表现形式可以如表2所示。在表2中,性能值可以用来表示处理器的处理能力,性能值越大说明处理器的性能越好,处理速度也越快。
假设,CPU中的最大核以最高频100%负载执行一个程序时,在一段固定的时间内执行了100M的程序指令,那么,可以将这个最大核最高频的性能值定义为1024。而如果采用CPU中的最小核以最低频同样以100%负载在相同的时间内执行同样的程序,在该段时间内最小核只执行了10M的指令,那么,可以认为CPU中的最小核以最低频运行时对应的性能值为102.4,也就是说,CPU中的最小核以最低频运行时,其性能值是CPU中的最大核以最高频运行时的性能值的1/10。
如表2所示,第一种资源调度方式的性能为107,频率为533,该资源调度方式对应的功耗为32。假设,步骤203中一共确定出了三种资调度方式,分别是资源调度方式1,资源调度方式2和资源调度方式3,这三种资源调度方式具体信息如下:
资源调度方式1:对应于小核,性能为306,频率为1042,功耗为119;
资源调度方式2:对应于小核,性能为388,频率为1804,功耗为242;
资源调度方式3:对应于大核,性能为373,频率为903,功耗为191。
在这三种资源调度方式中,资源调度方式1对应的功耗最低,可以将资源调度方式1确定为目标资源调度方式。
表2
Figure PCTCN2019090573-appb-000003
应理解,在确定目标资源调度方式时,为了简化确定目标资源调度方式的过程,减少 确定目标资源调度方式的复杂度,还可以直接根据图像帧的绘帧线程的负载信息(该负载信息可以包括负载特征和负载值)以及负载信息与资源调度方式之间的映射关系信息来直接确定目标资源调度方式。
可选地,作为一个实施例,根据绘帧线程的负载特征确定目标资源调度方式,包括:根据绘帧线程的负载特征确定绘帧线程的负载预测值;根据绘帧线程的负载特征、绘帧线程的负载预测值以及第一映射关系信息,确定目标资源调度方式,其中,第一映射关系信息包括多种负载信息和多种负载信息中的每种负载信息对应的资源调度方式,该多种负载信息中的每种负载信息包括一个负载特征和一个负载值。
具体地,根据绘帧线程的负载特征、绘帧线程的负载预测值以及第一映射关系信息,确定目标资源调度方式,包括:将绘帧线程的负载特征和绘帧线程的负载预测值在第一映射关系信息中对应的资源调度方式确定为目标资源调度方式。
在上述确定目标资源调度方式的过程中,可以从第一映射关系信息中确定出与绘帧线程的负载特征匹配的第一负载特征以及与绘帧线程的负载预测值匹配的第一负载值,然后根据第一映射关系信息将第一负载特征和第一负载值对应的资源调度方式确定为目标资源调度方式。
其中,在从第一映射关系信息中确定出第一负载特征时,可以将第一映射关系包括的多种负载特征中与绘帧线程的负载特征的相似度大于或者等于的相似度门限值的负载特征确定为第一负载特征。类似的,在从第一映射关系信息中确定出第一负载值时,可以将第一映射关系包括的多种负载值中与绘帧线程的负载预测值的相似度大于于或者等于的相似度门限值的负载值确定为第一负载值。
可选地,上述第一映射关系可以根据终端设备记录的历史信息来确定,该历史信息包括图像帧之前的图像帧的负载特征、负载值以及对应的资源的调度方式。
上述第一映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载特征、负载值以及对应的资源的调度方式的信息。
例如,第一映射关系信息的具体表现形式可以如表3所示。
表3
负载特征 负载值 资源调度方式
负载特征1 500 资源调度方式1
负载特征2 800 资源调度方式2
负载特征3 900 资源调度方式3
在表3中,负载特征包含的具体参数可以是表1中的平均每条指令周期数、分支指令数、缓存缺失率以及程序计数器中的至少一种,资源调度方式包含的具体参数可以是处理器类型、性能以及频率等参数中的任意一种,负载值可以根据线程运行的频率和时间来确定,负载值的大小可以表示绘帧线程需要执行的任务量的大小,负载值越大,绘帧线程需要执行的程序指令数越多。
如表3所示,当绘帧线程的负载特征与表3中的负载特征1相匹配,绘帧线程的负载值域表3中的负载值1相匹配,那么,根据表3,可以将负载特征1和负载值1对应的资源调度方式1确定为目标资源调度方式。
本申请中,通过根据绘帧线程的负载特征、负载预测值以及第一映射关系信息来确定目标资源调度方式,与通过直接计算的方式确定目标资源调度方式相比,能够简化确定目标资源调度方式的复杂度。
本申请中,在确定绘帧线程的负载预测值时可以根据绘帧线程的负载特征以及负载特征与负载值之间的映射关系来确定绘帧线程的负载预测值。
可选地,作为一个实施例,根据绘帧线程的负载特征确定绘帧线程的负载预测值,包括:根据绘帧线程的负载特征和第二映射关系信息,将绘帧线程的负载特征对应的负载值确定为绘帧线程的负载预测值,其中,第二映射关系信息包含多种负载特征以及多种负载特征中的每种负载特征对应的负载值。
上述第二映射关系信息可以根据终端设备记录的历史信息来确定,该历史信息可以包括图像帧之前的图像帧的负载特征和对应的负载值。
上述第二映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载特征和对应的负载值的信息。
通过绘帧线程的负载特征以及第二映射关系,能够较为方便地确定出绘帧线程的负载预测值,与直接根据绘帧线程的负载特征分析或计算绘帧线程的负载值的方式相比,确定绘帧线程的负载预测值的方式更为简便。
上述第二映射关系的具体形式可以如表4所示,其中的ID表示帧的编号,每帧都会对应一个帧特征,每个帧特征都会对应一个负载值。表4记录的可以是图像帧之前的帧对应的帧特征和负载,因此,可以将终端设备记录至少部分历史信息(包括帧、以及帧对应的帧特征和负载)生成表4。
表4
Figure PCTCN2019090573-appb-000004
应理解,表4中的帧特征只是以分支指令数和缓存缺失率为例进行的说明,实际上,帧特征还可以采用其它的能够反映帧特性的参数来表示。
根据绘帧线程的负载特征和第二映射关系信息,确定绘帧线程的负载预测值时,具体可以包含以下两种情况:
(1)当第二映射关系信息中多种负载特征中存在与绘帧线程的负载特征的相似度达到预设相似度的参考负载特征时,将参考负载特征对应的负载值确定为绘帧线程的负载预测值;
(2)当多种负载特征中不存在参考负载特征时,将图像帧的前一帧的负载值确定为绘帧线程的负载预测值。
上述与绘帧线程的负载特征的相似度达到预设相似度可以是指与绘帧线程的负载特征的相似度大于或者等于相似度门限值。
应理解,上述参考负载特征征既可以是一个负载特征(第二映射关系信息中仅有一个 负载特征与绘帧线程的负载特征的相似度大于或者等于相似度门限值),也可以是多个负载特征(第二映射关系信息中有多个负载特征与绘帧线程的负载特征的相似度大于或者等于相似度门限值),当参考负载特征为一个负载特征时,可以直接将该参考负载特征对应的负载值确定为绘帧线程的负载预测值。而当该参考负载特征为多个负载特征时,可以将其中的任意一个负载特征对应的负载值确定为绘帧线程的负载预测值,也可以将其中与绘帧线程的相似度最大的负载特征对应的负载值确定为目标资源调度方式。
应理解,图像帧的前一帧可以是在图像帧之前显示的一个图像帧,进一步的,图像帧的前一帧可以是在图像帧之前显示且与图像帧相邻的图像帧。
由于相邻帧的绘帧线程的负载值一般不会有太大的变化,因此,当多种负载特征中不存在与当前绘帧线程的相似度满足要求的参考负载特征时,可以直接将图像帧的前一帧的负载值确定为图像帧的绘帧线程的负载预测值。为了进一步的减少确定目标资源调度方式的复杂度或者计算量,还可以直接根据图像帧的绘帧线程的负载特征以及负载特征与资源调度方式之间的映射关系来确定目标调度方式。
图5是根据绘帧线程的负载特征确定绘帧线程的负载预测值的示意性流程图。图5所示的过程包括步骤401至步骤406,下面对这些步骤进行详细的描述。
401、记录绘帧线程的负载特征。
402、获取绘帧线程绘制的图像帧的前一帧的负载特征。
具体地,在步骤402中,可以在已记录的负载特征中获取图像帧的前一帧的负载特征。
403、确定绘帧线程的负载特征相对于图像帧的前一帧的负载特征的变化是否超过预设限度。
应理解,在步骤403中,当绘帧线程的负载特征相对于图像帧的前一帧的负载特征的变化超过预设限度时,说明图像帧的前一帧的负载特征与绘帧线程的相差较大,此时需要从之前记录的历史数据中寻找与绘帧线程的负载特征匹配的参考负载特征,也就是执行步骤404。而当绘帧线程的负载特征相对于图像帧的前一帧的负载特征的变化未超过预设限度时,说明图像帧的前一帧的负载特征与绘帧线程的相似度较高,此时,可以直接将图像帧的前一帧的负载特征确定为与绘帧线程的负载特征匹配的参考负载特征,也就是执行步骤406。
404、确定历史记录数据中是否存在与绘帧线程的负载特征匹配的参考负载特征。
在步骤404中,参考负载特征可以是与绘帧线程的负载特征的相似度大于或者等于相似度门限值的负载特征。
405、将图像帧的前一帧的负载特征对应的负载值确定为绘帧线程的负载预测值。
406、将参考负载特征对应的负载值确定为绘帧线程的负载预测值。
可选地,作为一个实施例,根据绘帧线程的负载特征确定目标资源调度方式,包括:根据绘帧线程的负载特征和第三映射关系信息,将绘帧线程的负载特征对应的资源调度方式确定为目标资源调度方式,其中,第三映射关系信息包括多种负载特征以及多种负载特征中的每种负载特征对应的资源调度方式。
上述第三映射关系信息可以是根据终端设备记录的历史信息(该历史信息包括图像帧之前显示的帧的负载特征以及相应的资源调度方式)确定的。
上述第三映射关系信息既可以是表格的形式,也可以是其它任意一种形式的记录负载 特征和对应的资源调度方式的信息。
本申请中,通过绘帧线程的负载特征以及负载特征与资源调度方式的映射关系信息来直接确定目标资源调度方式,能够省略根据图像帧的绘帧线程确定图像帧的负载预测值的过程,可以进一步简化确定目标资源调度方式的复杂度。
在根据绘帧线程的负载特征和第三映射关系信息确定目标资源调度方式时,可以从第三映射关系信息中选择与绘帧线程的负载特征比较相似的负载特征,然后把该相似的负载特征对应的资源调度方式确定为目标资源调度方式。
具体地,根据绘帧线程的负载特征和第三映射关系信息,确定目标资源调度方式,包括:在第三映射关系信息中的多种负载特征存在参考负载特征的情况下,将参考负载特征对应的资源调度方式确定为目标资源调度方式,其中,参考负载特征与绘帧线程的负载特征的相似度大于或者等于相似度门限值;在第三映射关系信息中的多种负载特征不存在参考负载特征的情况下,将图像帧的前一帧的绘帧线程的目标资源调度方式确定为目标资源调度方式。
应理解,上述参考负载特征征既可以是一个负载特征(第三映射关系信息中仅有一个负载特征与绘帧线程的负载特征的相似度大于或者等于相似度门限值),也可以是多个负载特征(第三映射关系信息中有多个负载特征与绘帧线程的负载特征的相似度大于或者等于相似度门限值),当参考负载特征为一个负载特征时,可以直接将该参考负载特征对应的资源调度方式确定为目标资源调度方式。而当该参考负载特征为多个负载特征时,可以将其中的任意一个负载特征对应的资源调度方式确定为目标资源调度方式,也可以将其中与绘帧线程的相似度最大的负载特征对应的资源调度方式确定为目标资源调度方式。
例如,上述第三映射关系可以如表5所示,表5记录了不同的负载特征以及这些不同的负载特征记录的资源调度方式。当绘帧线程的负载特征与表5中的负载特征1的相似度大于或者等于相似度门限值时,可以将负载特征1对应的资源调度方式1确定为目标资源调度方式。
表5
负载特征 资源调度方式
负载特征1 资源调度方式1
负载特征2 资源调度方式2
负载特征3 资源调度方式3
图6是根据绘帧线程的负载特征对绘帧线程进行资源调度的示意性流程图。图6所示的过程包括步骤501至步骤508,下面对步骤501至步骤508进行详细的描述。
501、确定绘帧线程的负载特征。
502、根据绘帧线程的负载特征确定绘帧线程的负载是访存密集型负载还是计算密集型负载。
如果绘帧线程的负载是计算密集型负载就执行步骤503,如果绘帧线程的负载是访存密集型负载就执行步骤504。
503、当绘帧线程的执行速率为低速时,调度CPU中的小核执行绘帧线程;当绘帧线程的执行速率为高速时,采用CPU中的大核来执行绘帧线程。
504、当绘帧线程的执行速率为高速时,采用CPU中的大核来执行绘帧线程,同时提高DDR的速率;当绘帧线程的执行速率为低速时,采用CPU中的小核来执行绘帧线程,同时提高DDR的频率。
505、确定绘帧线程属于高时延任务还是低时延任务。
506、执行分发(packing)策略,进行核间平衡(blance)。
其中,分发策略可以是指将当前任务分配给多个不同的CPU来执行,进行核间平衡可以是指将当前任务分配给CPU中的多个核来执行。
507、执行聚合(spreading)策略,不进行核间平衡。
聚合策略可以是指将当前任务分配给一个CPU来执行,不进行核间平衡可以是指将当前任务分配给CPU中的某个核来执行。
508、根据能效表选择CPU中合适的核执行绘帧线程。
应理解,上述图6主要示出了根据绘帧线程的负载特征选择相应的资源调度方式对绘帧线程进行调度的过程,步骤501至步骤507相当于是根据绘帧线程确定目标资源调度方式,而步骤508相当于上文中的根据目标资源调度方式为绘帧线程调度资源。
除了采用与绘帧线程相匹配的目标资源调度方式为绘帧线程调度资源外,还可以找出可能影响到绘帧线程执行的关联线程,为这些关联线程调度资源,加快关联线程的执行速度,进而加快绘帧线程的执行速度。
可选地,作为一个实施例,图1所示的方法还包括:确定绘帧线程的关联线程,其中,关联线程是能够引起所述绘帧线程休眠的线程;为关联线程调度资源,以加快关联线程的执行。
其中,引起绘帧线程休眠具体可以是指引起绘帧线程间歇性休眠,这里的休眠也可以是指停止工作。应理解,关联线程是能够引起绘帧线程休眠,进而使得绘帧线程的执行速度变慢的线程,通过加快绘帧线程的执行,能够间接的提高绘帧线程的执行速度。
本申请中,通过为关联线程调度资源,能够间接加快绘帧线程的执行速度,提高用户体验。
具体而言,通过为关联线程调度资源,能够使得关联线程尽快执行,减少关联线程的阻塞时间,从而加快绘帧线程的执行速度。
可选地,作为一个实施例,根据候选线程与绘帧线程的逻辑关系和/或资源相关关系,从候选线程中确定出与绘帧线程相关的线程。
图7是确定关联线程以及为关联线程调度资源的示意性流程图。图7所示的过程包括步骤601至步骤607,下面分别对这些步骤进行详细的描述。
601、根据负载情况,识别出候选线程。
具体地,在步骤601中可以根据负载值的大小从终端设备当前运行的线程中除绘帧线程之外的其它线程中选择负载值较大的线程作为候选线程。例如,在步骤601中可以其它线程中选择出负载值最大的10个线程作为候选线程。
602、根据候选线程的运行时间和睡眠时间(或者称为休眠时间),确定候选线程与绘帧线程的逻辑相关系数。
具体地,可以通过对比候选线程和绘帧线程的运行时间和睡眠时间,推测出绘帧线程和绘帧线程的逻辑相关性,并得到一个逻辑相关系数。该逻辑相关系数越大可以认为候选 线程与绘帧线程的相关性越大。
下面结合公式对确定关联线程进行详细的说明。
例如,可以通过公式(1)确定候选线程与绘帧线程的逻辑相关系数。
Figure PCTCN2019090573-appb-000005
在上述公式(1)中,X为绘帧线程的运行时间,Y为候选线程的运行时间,Cov(X,Y)表示X和Y的协方差,Var[X]表示X的方差,Var[Y]表示Y的方差,r(X,Y)为候选线程和绘帧线程的逻辑相关系数。
603、根据全局资源需求确定候选线程与绘帧线程的资源相关系数。
具体地,当绘帧线程休眠时,可以判断该绘帧线程是否因为缺乏全局资源而休眠,如果该绘帧线程由于缺乏全局资源而休眠,那么,进一步的判断该全局资源目前属于候选线程中的哪个线程(或者分配给了哪个线程),假设该全局资源属于第一线程,那么,第一线程与绘帧线程的资源相关系数为1,而另外的线程与绘帧线程的资源相关系数为0了。
应理解,这里以资源相关系数为1和0进行举例,实际上,还可以根据其它线程与绘帧线程的依赖的紧密程度,资源相关系数还可以是0和1之间的任意数值。
604、确定候选线程与绘帧线程的逻辑相关系数是否超过预设阈值。
当候选线程与绘帧线程的逻辑相关系数是否超过预设阈值超过预设阈值(例如,该预设阈值可以为0.8或者0.9)时,可以认为候选线程与绘帧线程的联系比较密切,可以认为该候选线程为绘帧线程的关联线程。接下来需要执行步骤606和步骤607。
605、确定候选线程与绘帧线程资源相关系数是否超过预设阈值。
当候选线程与绘帧线程资源相关系数超过预设阈值时,可以认为该候选线程为绘帧线程的关联线程。接下来需要执行步骤606和步骤607。
步骤605与步骤603中的预设阈值可以是不同的阈值,具体可以根据经验设置或者仿真实验设置等等。
应理解,在本申请中,也可以在逻辑相关系数超过预设阈值并且资源相关系数超过预设阈值的情况下执行步骤606和步骤607。
606、将候选线程加入到绘帧线程的关联线程组。
607、为关联线程组调度资源,加快关联线程组中的线程的执行。
另外,当步骤603中的逻辑相关系数未超过预设阈值时,可以将候选线程的信息记录下来,便于后续确定关联线程时排除掉该候选线程,从而加快确定关联线程的速度。
同样的,当步骤605中的资源相关系数未超过预设阈值时,也可以将候选线程的信息记录下来,便于后续确定关联线程时排除掉该候选线程。
由于目标资源调度方式是根据图像帧的绘帧线程的负载特征、负载预测值等估计出来的调度方式,在实际调度时可能由于负载预测值预测不准导致资源调度速度较慢,无法在预定时间内完成图像帧的绘制的情况的发生。
因此,如果终端设备在预定时间内仍然未完成图像帧的绘制的情况下,可以为绘帧线程调度额外的资源以加快绘帧线程的执行速度。
可选地,作为一个实施例,图1所示的方法还包括:在预定时间内未完成所述绘帧线程的执行,所述方法还包括:为所述绘帧线程调度额外资源,直到完成所述图像帧的绘制, 其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
应理解,当完成绘帧线程的执行时,也就完成了图像帧的绘制,如果图像帧在预定时间内仍未完成绘制,那么,说明根据目标资源调度方式为绘帧线程调度的资源可能偏少,此时,需要为绘帧线程调度额外的资源,以加快绘帧线程的执行,从而提高用户体验。
可选地,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
当第一差值越大时,超出预定时间越长,通过为绘帧线程调度更多的资源,以尽快完成绘帧线程的执行。
应理解,当绘帧线程完成时,停止为绘帧线程调度额外资源。
可选地,作为一个实施例,图1所示的方法还包括:确定所述绘帧线程的负载特征是否为典型负载特征;在所述绘帧线程的负载特征为典型负载特征的情况下,保存所述绘帧线程的负载特征和所述绘帧线程的负载预测值。
应理解,当绘帧线程的负载特征为典型负载特征时,绘帧线程的负载预测值为典型负载特征对应的负载值。
本申请中,通过保存典型负载特征与典型负载特征对应的负载值,便于后续直接根据负载特征确定负载预测值,能够确定负载预测值的复杂度。
可选地,作为一个实施例,确定绘帧线程的负载特征是否为典型负载特征包括:确定已记录的负载特征中是否存在与绘帧线程的负载特征的相似度大于或者等于相似度门限值的负载特征;如果已记录的负载特征中不存在与绘帧线程的负载特征的相似度大于或者等于相似度门限值的负载特征,确定所述绘帧线程的负载特征为典型负载特征。
应理解,当已记录的负载特征中存在与绘帧线程的负载特征的相似度大于或者等于相似度门限值的负载特征时,说明已经记录的负载特征中已经包含了与绘帧线程的负载特征类似的负载特征了,不必再记录绘帧线程的负载特征了。
图8是本申请实施例的资源调度方法的示意性流程图。图8所示的方法可以由终端设备执行。这里的终端设备可以是移动终端(例如,智能手机),电脑,个人数字助理,可穿戴设备,车载设备,物联网设备等等。
图8所示的方法包括步骤701至步骤704,下面对这些步骤进行详细的介绍。
701、确定绘帧线程的负载特征,该绘帧线程用于绘制图像帧。
在步骤701之前,可以先确定图像帧的绘帧线程。图像帧可以是终端设备当前将要显示的帧,图像帧具体可以是图像帧等等。而绘帧线程就是绘制图像帧的线程,绘帧线程执行的快慢直接影响到图像帧显示的快慢,进而影响到用户体验。具体地,当绘帧线程执行的速度较慢时,图像帧的显示需要较长的时间,用户可能会感觉到画面比较卡顿;而当绘帧线程执行的速度较快时,图像帧的显示不需要很长的时间,用户可能就会感觉到画面显示的比较流畅。
702、根据绘帧线程的负载特征和绘帧线程对应的应用场景,确定绘帧线程的目标负载预测值。
绘帧线程对应的应用场景可以是指绘帧线程所在的应用程序的类型,例如,绘帧线程对应的应用场景可以是视频应用程序,游戏以及其它需要与用户进行交互的应用程序(例 如,微信,淘宝,微博)等等。
另外,绘帧线程对应的应用场景还可以是指绘帧线程所在的应用程序所处的阶段,例如,绘帧线程对应的应用场景可以是指绘帧线程所在应用程序的启动阶段,结束阶段等等。
或者,绘帧线程对应的应用场景还可以是指绘帧线程所在的应用程序运行时的某个阶段,例如,绘帧线程对应的应用场景可以是微信的某个界面(聊天界面或者是点开小视频的界面)。
703、根据绘帧线程的负载特征、绘帧线程的目标负载预测值以及预设的目标帧率,确定目标资源调度方式。
704、以目标资源调度方式为绘帧线程调度资源。
本申请中,通过综合绘帧线程的负载特征和绘帧线程对应的应用场景,能够更合理地确定绘帧线程的负载预测值,进而更合理的确定目标资源调度方式,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
可选地,作为一个实施例,所述根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:根据所述绘帧线程的负载特征确定所述绘帧线程的第一负载预测值;根据所述绘帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的第二负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值;根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值。
例如,当终端设备启动一个应用时,能够识别到该应用是一个应用启动场景,然后根据预分配的供给引导(guideline,GL)表(该预先分配的GL表可以包含上述第四映射关系信息)确定该应用启动场景下对应的负载值,从而得到第二负载预测值。其中,GL表类似于一个配置文件,GL表包含不同的场景下对应的负载值以及不同的场景下对应的资源调度方式(选择大核还是小核,频率是多少等等),根据GL表能够确定不同的应用场景对应的负载值或者对应的资源调度方式。
应理解,在得到第一负载预测值和第二负载预测值之后,可以采用多种方式来确定目标负载预测值时,下面对几种可能的方式进行介绍。
第一种方式:将所述第一负载预测值和所述第二负载预测值中的最大负载值确定为所述目标负载预测值。
第二种方式:将所述第一负载预测值和所述第二负载预测值中的最小负载值确定为所述目标负载预测值。
第三种方式:将所述第一负载预测值和所述第二负载预测值的平均值确定为所述目标负载预测值。
另外,还可以对第一负载预测值和第二负载预测值进行加权求和,将第一负载预测值与第一加权系数的乘积以及第二负载预测值与第二加权系数的乘积的和确定为目标负载预测值,其中,第一加权系数和第二加权系数可以是预设的数值。
当应用场景对负载值的影响比较大时,可以设置一个较大的第一加权系数,当应用场景对负载值的影响比较小时,可以设置一个较小的第一加权系数。
可选地,根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:当绘帧线程对应的应用场景为启动场景时,根据所述绘 帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的目标负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值。
当绘帧线程对应的场景为启动场景时,由于启动场景对应的负载值较大,因此,可以直接根据绘帧线程的应用场景来确定绘帧线程的目标负载预测值。
可选地,根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:当绘帧线程对应的应用场景为启动场景之外的其它场景时,根据所述绘帧线程的负载特征确定所述目标负载预测值。
可选地,作为一个实施例,所述绘帧线程的负载特征用于指示绘帧线程的资源需求特性。
具体地,上述绘帧线程的负载特征可以是指示绘帧线程的负载是计算密集型还是资源密集型,便于后续确定相应的目标资源调度方式。
例如,当绘帧线程的负载是计算密集型的负载时,主要为绘帧线程调度计算资源,而当绘帧线程的负载是资源密集型的负载时,主要为绘帧线程调度存储资源。
应理解,绘帧线程的负载特征还可以指示绘帧线程的负载是计算密集型和资源密集型,这时,需要为绘帧线程既调度计算资源又调度存储资源。
可选地,作为一个实施例,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
本申请中,当采集到绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种时,就可以直接获取到绘帧线程的负载特征了,能够简化获取绘帧线程的负载特征的复杂度。
应理解,绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率等参数中的一种或者多种可以直接用于表示绘帧线程的负载特征,当获取到了绘帧线程的这些参数后,就相当于获取到了绘帧线程的负载特征了。
可选地,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间。
上述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率可以称为绘帧线程在第一时间间隔内的性能指标数据,在确定绘帧线程的负载特征时,可以直接将绘帧线程在第一时间间隔内的性能指标数据中的部分参数确定为绘帧线程的负载特征,也可以对绘帧线程在第一时间间隔内的性能指标数据进行处理或者运算(例如,对其中的两种参数做商,或者对某些参数进行哈希运算等等),将处理或运算得到的数据确定为绘帧线程的负载特征。
可选地,在预定时间内未完成所述绘帧线程的执行,图7所示的方法还包括:为所述绘帧线程调度额外资源,直到完成所述图像帧的绘制,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
应理解,当完成绘帧线程的执行时,也就完成了图像帧的绘制,如果图像帧在预定时间内仍未完成绘制,那么,说明根据目标资源调度方式为绘帧线程调度的资源可能偏少,此时,需要为绘帧线程调度额外的资源,以加快绘帧线程的执行,从而提高用户体验。
可选地,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
当第一差值越大时,超出预定时间越长,通过为绘帧线程调度更多的资源,以尽快完成绘帧线程的执行。
上文一共出现了第一映射关系信息,第二映射关系信息,第三映射关系信息以及第四映射关系信息,为了更好地理解各个映射关系信息的含义,下面结合表6对各个映射关系信息的含义进行介绍。
表6
Figure PCTCN2019090573-appb-000006
本申请中,上述各种映射关系信息可以是预先存储的,上述各种映射信息可以根据终端设备记录的历史信息(该历史信息可以包括负载信息、负载特征、应用场景、负载值以及资源调度方式中的某些信息之间的对应关系)来确定。并且,在完成了图像帧的执行之后,还可以根据图像帧的负载信息、负载特征,负载预测值以及对应的资源调度方式等信息对上述各种映射关系信息进行更新,便于后续根据上述各种映射关系信息确定绘帧线程对应的负载预测值或者目标资源调度方式等。
上文结合图1至图8对本申请实施例的资源调度方式进行了详细的介绍,下面结合图9至图11对本申请实施例的终端设备进行介绍,应理解,图9至图11中的终端设备能够执行本申请实施例中的资源调度方法中的各个步骤,为了避免重复,下面在介绍图9至图11中的终端设备时适当省略重复的描述。
图9是本申请实施例的终端设备的示意性框图。图9中的终端设备1000包括处理模块1001和调度模块1002,其中,处理模块1001和调度模块1002能够执行上文中图1至图8中涉及到的本申请实施例的资源调度方法中的各个步骤。
具体地,当终端设备1000用于执行图1所示的方法时,处理模块1001和调度模块1002的具体作用如下:
处理模块1001用于:确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;根据所述绘帧线程的负载特征确定目标资源调度方式;
调度模块1002用于以目标资源调度方式为绘帧线程调度资源。
本申请中,由于绘帧线程是绘制图像帧的线程,绘帧线程执行的快慢直接与用户体验相关,因此,通过绘帧线程的负载特征确定的目标资源调度方式对绘帧线程进行调度,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
当终端设备1000用于执行图8所示的方法时,处理模块1001和调度模块1002的具体作用如下:
处理模块1001用于:确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值;根据所述绘帧线程的负载特征、所述绘帧线程的目标负载预测值以及预设的目标帧率,确定目标资源调度方式;
调度模块1002用于以目标资源调度方式为绘帧线程调度资源。
本申请中,通过综合绘帧线程的负载特征和绘帧线程对应的应用场景,能够更合理地确定绘帧线程的负载预测值,进而更合理的确定目标资源调度方式,能够实现更细粒度的资源调度,使得资源调度更具有针对性,资源调度的效果更好。
图10是本申请实施例的终端设备的示意性框图。图10中的终端设备2000可以划分为硬件层2100、系统层2200和应用层2300。
如图10所示,硬件层2100主要有一些实体模块或者单元构成,硬件层2100可以包括CPU、双倍速率同步动态随机存储器(double data rate synchronous dynamic random access memory,DDR)和图形处理器(graphics processing unit,GPU),其中,CPU中还可以包括性能监控单元(performance monitor unit,PMU)。
应理解,本申请中的实施例中的资源调度方法中的各个步骤最终可以是由CPU来执行的。
如图10所示,系统层2200可以包括场景识别模块、用户体验量化模块、QoS调度控制器、负载预测模块、调度模块、能效采集模块、性能监控模块、统一调频模块以及渲染绘帧子系统、媒体子系统、网格子系统和内存管理子系统构成。
其中,系统层2200中的各个模块的具体作用如下:
场景识别模块用于识别用户当前使用的场景(例如,可以识别出用户观看的是视频,还是打开的网页);
用户体验量化模块用于实时抓取系统帧窗口信息并将其下发到内核,其中,帧窗口信息主要是指在绘帧过程中,CPU、GPU等计算器件参与绘帧工作的起止时间点,帧窗口信息用于量化用户体验,将用户能够感知的“卡、顿”等体验转化为内核能够感知的具体数据;
服务质量(quality of service,QoS)控制器用于根据识别出的当前场景,下发当前场景的性能约束和目标帧率;
负载预测模块用于对绘帧线程的负载进行预测,得到绘帧线程的负载预测值,该负载预测值可以是完成绘帧线程所需要的工作量,该工作量包括但不限于CPU、GPU、DDR等硬器件需要具体完成的工作量;
调度模块用于根据负载预测模块预测的负载以及上层QoS模块下发的截止时间(绘帧线程需要在截止时间内执行完成)指标等信息,决定针对绘帧线程(以及关联线程)的资源供给与线程调度;
能效采集模块用于实时采集当前系统功耗,以决定最佳能耗比的不同资源调度方式;
性能监控模块用于采集计算器件的性能工作状态,根据该状态表征帧特征;
调频模块用于调整CPU的工作频率;
渲染帧子系统用于对待显示的帧进行渲染。
如图10所示,应用层2300可以包含应用1、应用2…应用x等等。应用1、应用2…应用x表示不同的引用程序实体,例如,应用1可以是微信,应用2可以是微博。
应理解,本申请中的图像帧可以是图10所示的应用层2300中的某个应用中的当前待显示的一个图像帧。
上述图9和图10所示的终端设备具体可以是移动终端(例如,智能手机),电脑,个人数字助理,可穿戴设备,车载设备,物联网设备、人工智能设备等等。
图11是本申请实施例的终端设备的结构示意图。
图11中的终端设备包括通信模块3010、传感器3020、用户输入模块3030、输出模块3040、处理器3050、音视频输入模块3060、存储器3070以及电源3080。下面对这些模块进行详细的介绍。
通信模块3010可以包括至少一个能使该终端设备与其他终端设备之间进行通信的模块。例如,通信模块3010可以包括有线网络接口、广播接收模块、移动通信模块、无线因特网模块、局域通信模块和位置(或定位)信息模块等其中的一个或多个。
传感器3020可以感知用户的一些操作,传感器3020可以包括距离传感器,触摸传感器等等。传感器3020可以感知用户触摸屏幕或者靠近屏幕等操作。
用户输入模块3030,用于接收输入的数字信息、字符信息或接触式触摸操作/非接触式手势,以及接收与系统的用户设置以及功能控制有关的信号输入等。用户输入模块3030包括触控面板和/或其他输入设备。
输出模块3040包括显示面板,用于显示由用户输入的信息、提供给用户的信息或系统的各种菜单界面等。可选的,可以采用液晶显示器(liquid crystal display,LCD)或有机发光二极管(organic light-emitting diode,OLED)等形式来配置显示面板。在其他一些实施例中,触控面板可覆盖显示面板上,形成触摸显示屏。另外,输出模块3040还可以包括音频输出模块、告警器以及触觉模块等。
音视频输入模块3060,用于输入音频信号或视频信号。音视频输入模块3060可以包括摄像头和麦克风。
电源3080可以在处理器3050的控制下接收外部电力和内部电力,并且提供整个终端设备各个模块运行时需要的电力。
处理器3050可以指示一个或多个处理器,例如,处理器3050可以包括一个或多个中央处理器,或者包括一个中央处理器和一个图形处理器,或者包括一个应用处理器和一个协处理器(例如微控制单元或神经网络处理器)。当处理器3050包括多个处理器时,这多个处理器可以集成在同一块芯片上,也可以各自为独立的芯片。一个处理器可以包括一个或多个物理核,其中物理核为最小的处理模块。
存储器3070存储计算机程序,该计算机程序包括操作系统程序3071和应用程序3072等。典型的操作系统如微软公司的Windows,苹果公司的MacOS等用于台式机或笔记本的系统,又如谷歌公司开发的基于
Figure PCTCN2019090573-appb-000007
的安卓
Figure PCTCN2019090573-appb-000008
系统等用于移动终端的系统。当本申请实施例的资源调度方法通过软件的方式实现时,可以认为是通过应用程序3071来具体实现的。
存储器3070可以是以下类型中的一种或多种:闪速(flash)存储器、硬盘类型存储器、微型多媒体卡型存储器、卡式存储器(例如SD或XD存储器)、随机存取存储器(random access memory,RAM)、静态随机存取存储器(static RAM,SRAM)、只读存储器(read only memory,ROM)、电可擦除可编程只读存储器(electrically erasable programmable read-only  memory,EEPROM)、可编程只读存储器(programmable ROM,PROM)、磁存储器、磁盘或光盘。在其他一些实施例中,存储器3070也可以是因特网上的网络存储设备,系统可以对在因特网上的存储器3070执行更新或读取等操作。
处理器3050用于读取存储器3070中的计算机程序,然后执行计算机程序定义的方法,例如处理器3050读取操作系统程序3072从而在该系统运行操作系统以及实现操作系统的各种功能,或读取一种或多种应用程序3071,从而在该系统上运行应用。
例如,上述存储器3070可以存储一种计算机程序(该计算机程序是本申请实施例的资源调度方法对应的程序),当处理器3050执行该极端及程序时,处理器3050能够执行本申请实施例的资源调度方法。
存储器3070还存储有除计算机程序之外的其他数据3073,例如,存储器3070可以存储本申请的资源调度方法中涉及的绘帧线程的负载特征,绘帧线程的负载预测值等等。
图11中各个模块的连接关系仅为一种示例,本申请任意实施例提供的方法也可以应用在其它连接方式的终端设备中,例如所有模块通过总线连接。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (48)

  1. 一种资源调度方法,所述方法应用于终端设备,其特征在于,包括:
    确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;
    根据所述绘帧线程的负载特征确定目标资源调度方式;
    以所述目标资源调度方式为所述绘帧线程调度资源。
  2. 如权利要求1所述的方法,其特征在于,所述绘帧线程的负载特征用于指示所述绘帧线程的资源需求特性。
  3. 如权利要求1或2所述的方法,其特征在于,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
  4. 如权利要求1或2所述的方法,其特征在于,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间。
  5. 如权利要求1-4中任一项所述的方法,其特征在于,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:
    根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定所述目标资源调度方式。
  6. 如权利要求5所述的方法,其特征在于,所述根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定所述目标资源调度方式,包括:
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定对所述绘帧线程进行资源调度的至少一种资源调度方式;
    将所述至少一种资源调度方式中功耗最低的资源调度方式确定为所述目标资源调度方式。
  7. 如权利要求1-4中任一项所述的方法,其特征在于,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:
    根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及第一映射关系信息,确定所述目标资源调度方式,其中,所述第一映射关系信息包括多种负载信息和所述多种负载信息中的每种负载信息对应的资源调度方式,所述多种负载信息中的每种负载信息包括一个负载特征和一个负载值。
  8. 如权利要求5-7中任一项所述的方法,其特征在于,所述根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值,包括:
    根据所述绘帧线程的负载特征和第二映射关系信息,确定所述绘帧线程的负载预测值,其中,所述第二映射关系信息包含多种负载特征以及所述多种负载特征中的每种负载特征对应的负载值。
  9. 如权利要求8所述的方法,其特征在于,所述根据所述绘帧线程的负载特征以及 第二映射关系信息确定所述绘帧线程的负载预测值,包括:
    在所述第二映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  10. 如权利要求8或9所述的方法,其特征在于,所述根据所述绘帧线程的负载特征以及第二映射关系信息确定所述绘帧线程的负载预测值,包括:
    在所述第二映射关系信息中的多种负载特征中不存在参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  11. 如权利要求1-4中任一项所述的方法,其特征在于,所述根据所述绘帧线程的负载特征确定目标资源调度方式,包括:
    根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,其中,所述第三映射关系信息包括多种负载特征以及所述多种负载特征中的每种负载特征对应的资源调度方式。
  12. 如权利要求11所述的方法,其特征在于,所述根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,包括:
    在所述第三映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  13. 如权利要求11或12所述的方法,其特征在于,所述根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,包括:
    在所述第三映射关系信息中的多种负载特征不存在所述参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的绘帧线程的目标资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  14. 如权利要求1-13中任一项所述的方法,其特征在于,所述方法还包括:
    确定所述绘帧线程的关联线程,其中,所述关联线程是能够引起所述绘帧线程休眠的线程;
    为所述关联线程调度资源,以加快所述关联线程的执行。
  15. 如权利要求1-14中任一项所述的方法,其特征在于,在预定时间内未完成所述绘帧线程的执行,所述方法还包括:
    为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
  16. 如权利要求15所述的方法,其特征在于,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
  17. 一种资源调度方法,所述方法应用于终端设备,其特征在于,包括:
    确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;
    根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值;
    根据所述绘帧线程的负载特征、所述绘帧线程的目标负载预测值以及预设的目标帧率,确定目标资源调度方式;
    以所述目标资源调度方式为所述绘帧线程调度资源。
  18. 如权利要求17所述的方法,其特征在于,所述根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值,包括:
    根据所述绘帧线程的负载特征确定所述绘帧线程的第一负载预测值;
    根据所述绘帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的第二负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值;
    根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值。
  19. 如权利要求17或18所述的方法,其特征在于,所述绘帧线程的负载特征用于指示所述绘帧线程的资源需求特性。
  20. 如权利要求17-19中任一项所述的方法,其特征在于,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
  21. 如权利要求17-19中任一项所述的方法,其特征在于,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的。
  22. 如权利要求17-21中任一项所述的方法,其特征在于,所述方法还包括:
    确定所述绘帧线程的关联线程,其中,所述关联线程是能够引起所述绘帧线程休眠的线程;
    为所述关联线程调度资源,以加快所述关联线程的执行。
  23. 如权利要求17-22中任一项所述的方法,其特征在于,在预定时间内未完成所述绘帧线程的执行,所述方法还包括:
    为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
  24. 如权利要求23所述的方法,其特征在于,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
  25. 一种终端设备,其特征在于,包括:
    处理模块,用于确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;
    所述处理模块还用于根据所述绘帧线程的负载特征确定目标资源调度方式;
    调度模块,用于以所述目标资源调度方式为所述绘帧线程调度资源。
  26. 如权利要求25所述的终端设备,其特征在于,所述绘帧线程的负载特征用于指示所述绘帧线程的资源需求特性。
  27. 如权利要求25或26所述的终端设备,其特征在于,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
  28. 如权利要求25或26所述的终端设备,其特征在于,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的,所述第一时间间隔是从所述绘帧线程开始执行到所述绘制线程执行结束之间的一段时间。
  29. 如权利要求25-28中任一项所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定所述目标资源调度方式。
  30. 如权利要求29所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及预设的目标帧率,确定对所述绘帧线程进行资源调度的至少一种资源调度方式;
    将所述至少一种资源调度方式中功耗最低的资源调度方式确定为所述目标资源调度方式。
  31. 如权利要求25-28中任一项所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征确定所述绘帧线程的负载预测值;
    根据所述绘帧线程的负载特征、所述绘帧线程的负载预测值以及第一映射关系信息,确定所述目标资源调度方式,其中,所述第一映射关系信息包括多种负载信息和所述多种负载信息中的每种负载信息对应的资源调度方式,所述多种负载信息中的每种负载信息包括一个负载特征和一个负载值。
  32. 如权利要求29-31中任一项所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征和第二映射关系信息,确定所述绘帧线程的负载预测值,其中,所述第二映射关系信息包含多种负载特征以及所述多种负载特征中的每种负载特征对应的负载值。
  33. 如权利要求32所述的终端设备,其特征在于,所述处理模块用于:
    在所述第二映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  34. 如权利要求32或33所述的终端设备,其特征在于,所述处理模块用于:
    在所述第二映射关系信息中的多种负载特征中不存在参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的负载值确定为所述绘帧线程的负载预测值,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  35. 如权利要求25-28中任一项所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征和第三映射关系信息,确定所述目标资源调度方式,其中,所述第三映射关系信息包括多种负载特征以及所述多种负载特征中的每种负载特征对应的资源调度方式。
  36. 如权利要求35所述的终端设备,其特征在于,所述处理模块用于:
    在所述第三映射关系信息中的多种负载特征存在参考负载特征的情况下,将所述参考负载特征对应的资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  37. 如权利要求35或36所述的终端设备,其特征在于,所述处理模块用于:
    在所述第三映射关系信息中的多种负载特征不存在所述参考负载特征的情况下,将所述绘帧线程绘制的图像帧的前一帧的绘帧线程的目标资源调度方式确定为所述目标资源调度方式,其中,所述参考负载特征与所述绘帧线程的负载特征的相似度大于或者等于相似度门限值。
  38. 如权利要求25-37中任一项所述的终端设备,其特征在于,所述处理模块还用于:
    确定所述绘帧线程的关联线程,其中,所述关联线程是能够引起所述绘帧线程休眠的线程;
    所述调度模块还用于为所述关联线程调度资源,以加快所述关联线程的执行。
  39. 如权利要求25-38中任一项所述的终端设备,其特征在于,在预定时间内未完成所述绘帧线程的执行,所述调度模块还用于:
    为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
  40. 如权利要求39所述的终端设备,其特征在于,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
  41. 一种终端设备,其特征在于,包括:
    处理模块,用于确定绘帧线程的负载特征,所述绘帧线程用于绘制图像帧;
    所述处理模块还用于根据所述绘帧线程的负载特征和所述绘帧线程对应的应用场景,确定所述绘帧线程的目标负载预测值;
    所述处理模块还用于根据所述绘帧线程的负载特征、所述绘帧线程的目标负载预测值以及预设的目标帧率,确定目标资源调度方式;
    调度模块,用于以所述目标资源调度方式为所述绘帧线程调度资源。
  42. 如权利要求41所述的终端设备,其特征在于,所述处理模块用于:
    根据所述绘帧线程的负载特征确定所述绘帧线程的第一负载预测值;
    根据所述绘帧线程对应的应用场景以及第四映射关系信息,确定所述绘帧线程的第二负载预测值,其中,所述第四映射关系信息包括多种应用场景以及所述多种应用场景中的每种应用场景对应的负载值;
    根据所述第一负载预测值和所述第二负载预测值确定所述目标负载预测值。
  43. 如权利要求41或42所述的终端设备,其特征在于,所述绘帧线程的负载特征用于指示所述绘帧线程的资源需求特性。
  44. 如权利要求41-43中任一项所述的终端设备,其特征在于,所述绘帧线程的负载特征包括所述绘帧线程的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种。
  45. 如权利要求41-43中任一项所述的终端设备,其特征在于,所述绘帧线程的负载特征是根据所述绘帧线程在第一时间间隔内的平均每条指令周期数、分支指令数以及缓存缺失率中的至少一种确定的。
  46. 如权利要求41-45中任一项所述的终端设备,其特征在于,所述处理模块还用于:
    确定所述绘帧线程的关联线程,其中,所述关联线程是能够引起所述绘帧线程休眠的 线程;
    所述调度模块还用于为所述关联线程调度资源,以加快所述关联线程的执行。
  47. 如权利要求41-46中任一项所述的终端设备,其特征在于,在预定时间内未完成所述绘帧线程的执行,所述调度模块还用于:
    为所述绘帧线程调度额外资源,以加快所述绘帧线程的执行,其中,所述预定时间为采用所述目标资源调度方式为所述绘帧线程调度资源时执行完所述绘帧线程所需要的时间。
  48. 如权利要求47所述的终端设备,其特征在于,所述额外资源的大小与第一差值为正相关关系,其中,所述第一差值是调度所述额外资源时的时间点与所述预设时间结束时的时间点的差值。
PCT/CN2019/090573 2018-10-11 2019-06-10 资源调度方法和终端设备 WO2020073672A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
JP2020552909A JP7195334B2 (ja) 2018-10-11 2019-06-10 リソーススケジューリング方法および端末デバイス
EP19870764.8A EP3748470A4 (en) 2018-10-11 2019-06-10 RESOURCE PLANNING PROCEDURE AND DEVICE
KR1020207026994A KR102490908B1 (ko) 2018-10-11 2019-06-10 자원 스케줄링 방법 및 단말 장치
US17/018,551 US11765754B2 (en) 2018-10-11 2020-09-11 Resource scheduling method and terminal device
US18/449,790 US20230413304A1 (en) 2018-10-11 2023-08-15 Resource Scheduling Method and Terminal Device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811184979.7 2018-10-11
CN201811184979.7A CN111045814B (zh) 2018-10-11 2018-10-11 资源调度方法和终端设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/018,551 Continuation US11765754B2 (en) 2018-10-11 2020-09-11 Resource scheduling method and terminal device

Publications (1)

Publication Number Publication Date
WO2020073672A1 true WO2020073672A1 (zh) 2020-04-16

Family

ID=70163893

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/090573 WO2020073672A1 (zh) 2018-10-11 2019-06-10 资源调度方法和终端设备

Country Status (6)

Country Link
US (2) US11765754B2 (zh)
EP (1) EP3748470A4 (zh)
JP (1) JP7195334B2 (zh)
KR (1) KR102490908B1 (zh)
CN (1) CN111045814B (zh)
WO (1) WO2020073672A1 (zh)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112114975A (zh) * 2020-10-28 2020-12-22 Oppo广东移动通信有限公司 处理器频率的调整方法、装置、存储介质及电子设备
CN112416561A (zh) * 2020-12-07 2021-02-26 西北大学 一种面向目标计数任务场景的资源动态调度与管理方法
CN113535357A (zh) * 2021-07-07 2021-10-22 厦门墨逦标识科技有限公司 Eagle视觉应用中保障主线程性能的方法、存储介质
CN116703691A (zh) * 2022-11-17 2023-09-05 荣耀终端有限公司 图像处理方法、电子设备及计算机存储介质
CN116703691B (zh) * 2022-11-17 2024-05-14 荣耀终端有限公司 图像处理方法、电子设备及计算机存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736558A (zh) * 2020-07-01 2020-10-02 佛山科学技术学院 一种生产联线设备控制方法以及控制系统
CN112764915B (zh) * 2020-12-10 2023-11-14 国家卫星气象中心(国家空间天气监测预警中心) 一种时间相关度的资源消耗分析方法
CN115237583A (zh) * 2021-04-22 2022-10-25 华为技术有限公司 计算资源调度方法及装置
CN113590621B (zh) * 2021-07-26 2024-01-23 上海英方软件股份有限公司 一种数据库表比对方法及装置
CN115017003B (zh) * 2021-12-22 2023-05-30 荣耀终端有限公司 负载预测方法和负载预测装置
WO2023167438A1 (ko) * 2022-03-03 2023-09-07 삼성전자주식회사 시스템의 성능 병목 현상을 처리하는 전자 장치 및 그 동작 방법

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7526682B1 (en) * 2008-06-20 2009-04-28 International Business Machines Corporation Effective diagnosis of software hangs
CN104460934A (zh) * 2013-09-13 2015-03-25 华为终端有限公司 多cpu调度方法及装置
CN105376236A (zh) * 2015-11-24 2016-03-02 成都微讯云通科技有限公司 移动设备信息传递方法

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6909836B2 (en) * 2001-02-07 2005-06-21 Autodesk Canada Inc. Multi-rate real-time players
US8255912B2 (en) * 2005-04-13 2012-08-28 Qualcomm Incorporated Techniques for setting events in a multi-threaded system
US20070136725A1 (en) * 2005-12-12 2007-06-14 International Business Machines Corporation System and method for optimized preemption and reservation of software locks
US8291431B2 (en) * 2006-08-29 2012-10-16 Qualcomm Incorporated Dependent instruction thread scheduling
US20090165007A1 (en) * 2007-12-19 2009-06-25 Microsoft Corporation Task-level thread scheduling and resource allocation
US8200594B1 (en) * 2008-09-10 2012-06-12 Nvidia Corporation System, method, and computer program product for accelerating a game artificial intelligence process
US8429665B2 (en) * 2010-03-19 2013-04-23 Vmware, Inc. Cache performance prediction, partitioning and scheduling based on cache pressure of threads
JP2012511204A (ja) 2008-12-08 2012-05-17 ケーピーアイティ クミンズ インフォシステムズ リミテッド リソースを最適化するためのタスク再編成方法
JP5448032B2 (ja) 2008-12-25 2014-03-19 インターナショナル・ビジネス・マシーンズ・コーポレーション リソース管理装置、リソース管理プログラム、およびリソース管理方法
US8533719B2 (en) * 2010-04-05 2013-09-10 Oracle International Corporation Cache-aware thread scheduling in multi-threaded systems
US10386900B2 (en) * 2013-09-24 2019-08-20 Intel Corporation Thread aware power management
US9639363B2 (en) * 2013-10-30 2017-05-02 The Regents Of The University Of Michigan Heterogeneity within a processor core
US9569062B2 (en) * 2014-05-21 2017-02-14 Facebook, Inc. Asynchronous execution of animation tasks for a GUI
US10332230B2 (en) * 2015-08-31 2019-06-25 Qualcomm Incorporated Characterizing GPU workloads and power management using command stream hinting
US10509677B2 (en) * 2015-09-30 2019-12-17 Lenova (Singapore) Pte. Ltd. Granular quality of service for computing resources
CN106936883B (zh) 2015-12-31 2020-03-20 伊姆西Ip控股有限责任公司 用于云系统的方法和装置
US20170206111A1 (en) * 2016-01-15 2017-07-20 Qualcomm Innovation Center, Inc. Managing processing capacity provided to threads based upon load prediction
US10877816B2 (en) * 2016-04-20 2020-12-29 Samsung Electronics Co., Ltd. Optimal task scheduler
US10146583B2 (en) * 2016-08-11 2018-12-04 Samsung Electronics Co., Ltd. System and method for dynamically managing compute and I/O resources in data processing systems
US10956220B2 (en) * 2017-06-04 2021-03-23 Apple Inc. Scheduler for amp architecture using a closed loop performance and thermal controller
US11023245B2 (en) * 2018-09-04 2021-06-01 Apple Inc. Serialization floors and deadline driven control for performance optimization of asymmetric multiprocessor systems

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7526682B1 (en) * 2008-06-20 2009-04-28 International Business Machines Corporation Effective diagnosis of software hangs
CN104460934A (zh) * 2013-09-13 2015-03-25 华为终端有限公司 多cpu调度方法及装置
CN105376236A (zh) * 2015-11-24 2016-03-02 成都微讯云通科技有限公司 移动设备信息传递方法

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112114975A (zh) * 2020-10-28 2020-12-22 Oppo广东移动通信有限公司 处理器频率的调整方法、装置、存储介质及电子设备
CN112114975B (zh) * 2020-10-28 2023-06-27 Oppo广东移动通信有限公司 处理器频率的调整方法、装置、存储介质及电子设备
CN112416561A (zh) * 2020-12-07 2021-02-26 西北大学 一种面向目标计数任务场景的资源动态调度与管理方法
CN112416561B (zh) * 2020-12-07 2022-11-25 西北大学 一种面向目标计数任务场景的资源动态调度与管理方法
CN113535357A (zh) * 2021-07-07 2021-10-22 厦门墨逦标识科技有限公司 Eagle视觉应用中保障主线程性能的方法、存储介质
CN116703691A (zh) * 2022-11-17 2023-09-05 荣耀终端有限公司 图像处理方法、电子设备及计算机存储介质
CN116703691B (zh) * 2022-11-17 2024-05-14 荣耀终端有限公司 图像处理方法、电子设备及计算机存储介质

Also Published As

Publication number Publication date
CN111045814A (zh) 2020-04-21
EP3748470A4 (en) 2021-07-07
KR102490908B1 (ko) 2023-01-19
US20200413423A1 (en) 2020-12-31
KR20200122364A (ko) 2020-10-27
US20230413304A1 (en) 2023-12-21
JP2021517697A (ja) 2021-07-26
EP3748470A1 (en) 2020-12-09
CN111045814B (zh) 2023-12-08
JP7195334B2 (ja) 2022-12-23
US11765754B2 (en) 2023-09-19

Similar Documents

Publication Publication Date Title
WO2020073672A1 (zh) 资源调度方法和终端设备
WO2021008543A1 (zh) 一种资源调度的方法和电子设备
CN107515663B (zh) 调整中央处理器内核运行频率的方法和装置
CN112711387B (zh) 缓冲区容量的调整方法、装置、电子设备及可读存储介质
TW201732496A (zh) 用於經由記憶體時延控制來提供功率效率的系統和方法
US11782761B2 (en) Resource management unit for capturing operating system configuration states and offloading tasks
CN110795238A (zh) 负载计算方法、装置、存储介质及电子设备
EP4042305A1 (en) Resource management unit for capturing operating system configuration states and managing malware
CN110795323A (zh) 负载统计方法、装置、存储介质及电子设备
WO2020263418A1 (en) Managing workloads of a deep neural network processor
US11630698B2 (en) Resource management unit for capturing operating system configuration states and swapping memory content
CN112114967B (zh) 一种基于服务优先级的gpu资源预留方法
CN114968546A (zh) 一种负载处理方法及相关装置
CN116303110B (zh) 一种内存垃圾的回收方法及电子设备
JP5713973B2 (ja) 情報処理装置および並列処理方法
CN114860405B (zh) 多任务模型的参数更新方法、装置和存储介质
Hsu et al. REFROM: Responsive, Energy-Efficient Frame Rendering for Mobile Devices
CN107807855B (zh) 应用清理方法、装置、存储介质及电子设备
CN113138909A (zh) 负载统计方法、装置、存储介质及电子设备
CN117827988A (zh) 一种数据仓库优化方法、装置、设备及其存储介质
Kumakura et al. CPU Clock Rate Control Based on Method Invocation in Foreground Application in Android Smartphone
CN117687574A (zh) 一种i/o管理方法、装置、电子设备及介质
CN116991351A (zh) 垂直同步模块偏移参数的获取方法、偏移控制方法及系统
CN113051048A (zh) 处理性能的提升方法、装置和电子设备
CN116303132A (zh) 一种数据缓存方法、装置、设备以及存储介质

Legal Events

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

Ref document number: 19870764

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019870764

Country of ref document: EP

Effective date: 20200902

ENP Entry into the national phase

Ref document number: 20207026994

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2020552909

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE