Method for obtaining and displaying rendering time, method, device and equipment for performance monitoring
By triggering the instructions of the graphics application program interface in the game program, the GPU rendering time of the game is obtained, which solves the problem of users having difficulty in obtaining the GPU rendering time, and realizes simple and convenient performance monitoring and hardware bottleneck location.
Patent Information
- Application Number
- CN202011263374.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-11-12
AI Technical Summary
It is difficult for game users to obtain GPU rendering time-consuming information while the game is running, and existing technology requires administrator rights to enter developer mode, which is complex to operate and affects game stability.
By setting the first instruction and the second instruction in the target program, the graphics application program interface is called to start and terminate the GPU rendering time-consuming query task before and after the execution of each frame of the game screen rendering subroutine to obtain accurate GPU rendering time-consuming information. , and does not affect the normal operation of the game.
It enables users to conveniently obtain GPU rendering time, simplifies the operation process, improves the accuracy and stability of game performance monitoring, and helps users quickly locate hardware performance problems.
Smart Images

Figure CN112346935B
Abstract
Description
Technical Field
[0001] The present application relates to the field of game technology, and in particular to a method for obtaining and displaying rendering time consumption, a performance monitoring method, device and equipment. Background Art
[0002] In the Internet information age, the ways of entertainment and leisure for people are becoming more and more diverse. Among them, various electronic games are often favored by the public and become an important tool for relaxation, intellectual training, social entertainment.
[0003] For the majority of users, whether an electronic game is popular or not, the gaming experience is a factor they pay more attention to. Whether the gaming experience is good or not is related to the design of the game itself, as well as the hardware equipment that runs the game, such as the processor that processes the game data, the graphics card that displays the game screen, etc. Among them, GPU (Graphics Processing Unit) is a hardware device related to the game screen rendering calculation task. The computing speed of GPU rendering game screen is very important for the smoothness of game screen refresh. By determining the time consumed by GPU to process a frame of screen (referred to as GPU rendering time), the performance of GPU can be effectively analyzed. However, in related electronic games, the data of GPU rendering time is often obtained by the game engine only during the development stage and provided to game developers for reference, which is mainly used to analyze where there are rendering problems and facilitate further improvement of the game; while when the game is running, it is difficult for users to obtain GPU rendering time, and they may need to obtain the administrator privileges of the terminal device to enter the developer mode. Users who know less about the terminal device are prone to misoperation. In summary, when game users want to evaluate the rendering performance of the GPU when running the game, it is very difficult to obtain GPU rendering time, and the problems existing in the relevant technology need to be solved urgently. Summary of the invention
[0004] The purpose of this application is to solve one of the technical problems existing in the related art to at least a certain extent.
[0005] To this end, an object of an embodiment of the present application is to provide a method for obtaining and displaying rendering time, which can effectively obtain GPU rendering time information during game running, and the implementation process is simple and convenient.
[0006] Another purpose of an embodiment of the present application is to provide a game performance monitoring method that can help users quickly locate performance problems of hardware devices.
[0007] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present application include:
[0008] On the one hand, an embodiment of the present application provides a method for obtaining rendering time consumption, the method comprising the following steps:
[0009] In response to a first instruction in the target program, calling a graphics application program interface to start a GPU rendering time-consuming query task;
[0010] In response to a second instruction in the target program, calling the graphics application program interface to terminate the GPU rendering time-consuming query task;
[0011] Obtain the rendering time returned by the GPU rendering time query task;
[0012] The first instruction is triggered before the rendering subroutine of each frame in the target program is executed, and the second instruction is triggered after the rendering subroutine is executed.
[0013] On the other hand, the embodiment of the present application also provides another method for obtaining rendering time, which includes the following steps:
[0014] Run the target program and application performance monitoring program;
[0015] A first instruction is triggered before the rendering subroutine in the target program is executed; the first instruction is used to call the application performance monitoring program to send a first call instruction to the graphics application program interface, and the first call instruction is used to trigger the graphics application program interface to start a GPU rendering time-consuming query task;
[0016] A second instruction is triggered after the rendering subroutine is executed; the second instruction is used to call the application performance monitoring program to send a second call instruction to the graphics application program interface, and the second call instruction is used to trigger the graphics application program interface to terminate the GPU rendering time-consuming query task;
[0017] The rendering time returned by the GPU rendering time query task is obtained.
[0018] On the other hand, an embodiment of the present application further provides a method for displaying time-consuming rendering, the method comprising the following steps:
[0019] Obtain the GPU rendering time when the game is running through the rendering time acquisition method described above;
[0020] On the game screen, information about the time consumed by the GPU rendering is displayed.
[0021] On the other hand, the embodiment of the present application also provides a game performance monitoring method, the method comprising the following steps:
[0022] Get the CPU usage during game running;
[0023] Obtain the GPU rendering time during game operation through the rendering time acquisition method described above;
[0024] When the CPU usage rate is higher than a first threshold and the GPU rendering time is lower than a second threshold, the CPU is determined as a hardware bottleneck of the game rendering performance;
[0025] or,
[0026] When the CPU usage rate is lower than a third threshold and the GPU rendering time is higher than a fourth threshold, the GPU is determined to be a hardware bottleneck of the game rendering performance.
[0027] On the other hand, an embodiment of the present application further provides a device for obtaining rendering time consumption, including:
[0028] A first processing unit is used to call a graphics application program interface to start a GPU rendering time-consuming query task in response to a first instruction in the target program;
[0029] A second processing unit, configured to call the graphics application program interface to terminate the GPU rendering time-consuming query task in response to a second instruction in the target program;
[0030] An acquisition unit, used to acquire the rendering time returned by the GPU rendering time query task;
[0031] The first instruction is triggered before the rendering subroutine of each frame in the target program is executed, and the second instruction is triggered after the rendering subroutine is executed.
[0032] On the other hand, an embodiment of the present application provides a terminal device, which is equipped with a graphics application program interface. The terminal device is used to obtain GPU rendering time through the rendering time acquisition method described above, and display the GPU rendering time.
[0033] On the other hand, an embodiment of the present application provides a computer device, including:
[0034] at least one processor;
[0035] at least one memory for storing at least one program;
[0036] When the at least one program is executed by the at least one processor, the at least one processor implements at least one of the aforementioned rendering time acquisition method, rendering time display method or game performance monitoring method.
[0037] On the other hand, an embodiment of the present application also provides a computer-readable storage medium, which stores a program executable by a processor. When the program executable by the processor is executed by the processor, it is used to implement at least one of the rendering time acquisition method, rendering time display method or game performance monitoring method described above.
[0038] On the other hand, an embodiment of the present application also provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in the computer-readable storage medium mentioned above; the processor of the computer device mentioned above can read the computer instructions from the computer-readable storage medium mentioned above, and the processor executes the computer instructions, so that the computer device executes at least one of the rendering time acquisition method, rendering time display method or game performance monitoring method mentioned above.
[0039] The advantages and benefits of the present application will be partially given in the following description, and partially become apparent from the following description, or be understood through the practice of the present application:
[0040] In the embodiment of the present application, the method for obtaining the rendering time is to set the first instruction and the second instruction in the target program. The first instruction is triggered before the rendering subroutine of each frame of the target program is executed, and the second instruction is triggered after the rendering subroutine is executed, so that before and after the rendering of each frame of the game screen during the game running, the application performance monitoring program can be triggered to call the graphics application program interface to query the GPU rendering time, thereby obtaining accurate and effective GPU rendering time; this method provides game users with a simple means of obtaining GPU rendering time, without having to obtain the administrator authority of the game terminal to enter the developer mode for complex operations, and does not affect the normal operation of the game, and facilitates the acquisition of GPU performance information. The game performance monitoring method in the embodiment of the present application determines the hardware bottleneck that limits the game rendering performance by comparing the CPU usage rate and the GPU rendering time with the predetermined thresholds, which is conducive to helping users quickly locate hardware performance problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings of the technical solutions in the embodiments of the present application or related technologies are introduced below. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0042] Figure 1 A schematic diagram of the process from development to implementation of an electronic game in the related art;
[0043] Figure 2 A data processing schematic diagram of a game screen rendering process of an electronic game in the related art;
[0044] Figure 3 A data processing schematic diagram of another electronic game screen rendering process in the related art;
[0045] Figure 4 A flowchart of a method for obtaining rendering time consumption provided in an embodiment of the present application;
[0046] Figure 5 A schematic diagram of the interaction between the program and the interface in the process of obtaining GPU rendering time by a terminal device of a method for obtaining rendering time provided in an embodiment of the present application;
[0047] Figure 6 A flowchart of another method for obtaining rendering time consumption provided in an embodiment of the present application;
[0048] Figure 7 A schematic diagram of a GPU executing a rendering instruction when rendering a frame of a game screen provided in an embodiment of the present application;
[0049] Figure 8 A schematic diagram of another GPU executing rendering instructions when rendering a frame of a game screen provided in an embodiment of the present application;
[0050] Fig. 9 A schematic diagram of another GPU executing rendering instructions when rendering a frame of a game screen provided in an embodiment of the present application;
[0051] Fig.10 A schematic diagram of a partial script life cycle of a Unity game engine in the related art;
[0052] Fig.11 A schematic diagram of a flow chart of a time-consuming rendering display method provided in an embodiment of the present application;
[0053] Fig.12 A schematic diagram of an interface of a terminal device provided in an embodiment of the present application;
[0054] Fig.13 A flowchart of a method for monitoring game performance provided in an embodiment of the present application;
[0055] Fig.14 A schematic diagram of the structure of a device for obtaining rendering time consumption provided in an embodiment of the present application;
[0056] Fig.15 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and are not to be construed as limitations on the present application. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0059] Before describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0060] Game engine: refers to the core components of some pre-written editable electronic game systems or some interactive real-time graphics applications. Game engines mainly provide electronic game developers with various tools needed to write game programs, with the aim of making it easier and faster for developers to make game programs without having to start from scratch. In related technologies, game engines can include the following systems: rendering engine (including 2D graphics engine or 3D graphics engine), physics engine, collision detection system, sound effects, script engine, computer animation, artificial intelligence, network engine and scene management, etc.
[0061] GPU rendering time: refers to the time consumed by GPU computing in executing the rendering task of one frame.
[0062] Application Programming Interface (API), also known as application programming interface, is the agreement for connecting different components of a software system. As the scale of software becomes increasingly large, it is often necessary to divide complex systems into small components. Therefore, the design of the application interface is very important. A good application interface can reduce the mutual dependence of various parts of the system, improve the cohesion of the components, and reduce the degree of coupling between the components, thereby improving the maintainability and scalability of the system.
[0063] Hook: Also called hook function, before the system calls the function, the hook program will capture the message first, and the hook function will get control first. At this time, the hook function can process (change) the execution behavior of the function, and can also force the end of the message transmission. In simple terms, it is to pull out the system program and embed the code snippet you want to execute temporarily.
[0064] With the rapid development of Internet technology, people's means of leisure and entertainment are becoming more and more diverse after work and study. Among them, electronic games are a kind of entertainment activity that relies on terminal devices. They are widely loved by users because of their rich game content and varied game experience. Figure 1 , Figure 1 The figure shows a process diagram of an electronic game from development to implementation in the related art. In the process, the subjects involved mainly include a game developer 110 , a game platform 120 and a user 130 .
[0065] Among them, the game developer 110 refers to the producer of the electronic game, for example, it may include at least one of the enterprises, groups or individuals that produce electronic game software. The game platform 120 refers to the operation platform of the electronic game. In some embodiments, the game platform 120 may refer to an operating system, for example, it may be a Web Player platform, a PC platform, an IOS platform, an Android platform, etc.; in some embodiments, the game platform 120 may also refer to software or a webpage with a function of running a game, for example, it may be UPLAY, EPIC Games, Blizzard game platform, Origin, Steam, WeGame, etc.; in some embodiments, the game platform 120 may also refer to the background server of the game, which may be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud storage and other services; in some embodiments, the game platform 120 may also refer to a dedicated system designed for hardware devices such as home game consoles or multi-function handheld game consoles.
[0066] User 130 is a player of electronic games, and user 130 can run electronic games through terminal devices. In some embodiments, the terminal device can be any one of a home game console, a multi-function handheld game console, a smart phone, a tablet computer, a notebook computer, or a desktop computer.
[0067] When an electronic game is produced by the game developer 110, the game resources, such as a compressed package containing game applications, environment configurations, and registry entries, can be uploaded to the corresponding game platform 120 for release, and users can play online games on the game platform 120, or download the corresponding game installation package through the game platform 120 and install it on a terminal device for playing. Of course, it is understandable that the game developer 110 can also adjust the game content through the game platform 120, such as performing version updates, bug maintenance, and the like.
[0068] For game developers 110, due to the fast update and iteration speed of games, and the fact that most of the game play methods have been fixed and patterned, such as the more typical first-person shooting game (First-person shooting game, FPS), multiplayer online tactical competitive game (Multiplayer Online Battle Arena, MOBA), etc., there may be many types of games of the same type, but there are certain differences in settings and details. If all these games are developed from scratch and the code is written, a lot of duplication of work will be caused. The emergence of game engines has solved this problem well. It is a core component that includes a large number of pre-written editable electronic game systems or some interactive real-time image applications. It can provide game developers 110 with various tools required for writing electronic games, which helps to make game programs easily and quickly without starting from scratch. For example, when making a first-person shooting game, game developers 110 can use part of the code in games of similar themes as the basic framework of the new game through the game engine to save a lot of development time and cost. Games made by game engines only need to carry the environment configuration of the corresponding game engine in the game's resource package to be played by users, and users do not need to download the game engine separately. Among the related technologies, the most commonly used game engines include Unity engine, Creation engine, Unreal engine, Frostbite engine, etc. As the graphics of electronic games enter the 3D era, the use of game engines can not only make game development work more efficient, but also bring rich game graphics and detailed texture performance, which greatly improves the quality of electronic games.
[0069] For the vast majority of users 130, whether an electronic game is popular or not, the gaming experience is the part they care about most. The gaming experience is not only related to the quality of the game itself, but also to the performance of the hardware device used by the user, that is, the hardware environment in which the electronic game runs. If the hardware device used by the user itself has poor performance or fails, the effect of the game running may be greatly affected. Among them, the GPU is one of the hardware devices mainly used to process the rendering of the game screen. The performance of the GPU is very important for the smoothness of the game screen refresh. If the GPU performance of the user's terminal device is poor, the game screen will often drop frames, freeze or display errors; the CPU is the center for processing game running data, and its performance is also closely related to the rendering and presentation effects of the game screen. If the user encounters a problem with the screen display during the game running process, generally by analyzing the CPU and GPU, the cause of the problem in the game performance can be roughly located. For users, the performance of the CPU can be analyzed through information such as CPU utilization, but the rendering performance of the GPU is more low-level, and it is not very convenient to analyze. For example, the time consumed by the GPU to render a frame of the game screen (referred to as the GPU rendering time) is difficult for users to obtain. In the related art, the GPU rendering time is generally provided to the game developer 110 by the game engine or game platform to assist in the development of the game, such as locating the bottleneck of the game screen rendering. When the game is developed and released with the corresponding game engine environment, the terminal device on the user side cannot use this information when running the game. It may require the user 130 to obtain the administrator privileges of the terminal device and enter the developer mode to achieve this, which is difficult for the user and is prone to operational errors. If the Hook technology is adopted, that is, when the game is running, by replacing part of the code in the game program and embedding a program that executes the task of querying the GPU rendering time, this is equivalent to temporarily changing the function of the game itself, which will have an adverse effect on the stability of the game operation, and may cause the game to crash, which will affect the user experience.
[0070] In view of this, in an embodiment of the present application, a method for obtaining rendering time is provided. This method can effectively obtain GPU rendering time information during game running. It does not need to obtain administrator privileges of the game terminal to enter the developer mode for complex operations, nor does it affect the normal operation of the game. The implementation process is simple, which is convenient for developers to implement and obtain on the user side.
[0071] Before describing in detail the method for obtaining the rendering time provided in the embodiment of the present application, a brief introduction to the rendering process of the game screen in the related art is first given. Figure 2 , Figure 2A data processing schematic diagram of a game screen rendering process of an electronic game in the related art is shown. After the electronic game is developed, it is released to the game platform in the form of a game program. When the game program is running on the terminal device on the user side, the CPU of the terminal device is mainly used to confirm which objects in the game screen need to be rendered. After collecting the data of each object that needs to be rendered, the CPU integrates the data into the form of a rendering instruction sequence, and sends the rendering task to be processed to the GPU by calling the graphics application program interface. The rendering instruction sequence is translated by the graphics card driver and executed by the GPU. The GPU completes the rendering data calculation work of the game screen and stores the result in the frame buffer. The frames in the frame buffer are sent to the display, and the rendered game screen can be presented to the user.
[0072] Reference Figure 3 In simple terms, during the running of the game, the hardware devices work together to process the game program, among which the CPU is responsible for coordinating the overall work involved in each frame of the game screen. For the actual execution of the rendering work, the CPU forms the corresponding rendering instructions for the game screen, and transmits the rendering instruction sequence to the GPU through the corresponding interface (and driver). The GPU receives the rendering instructions from the sequence and is responsible for processing and completing the calculation of related data. Figure 3 In the figure, the game program 310 covered by a frame of game screen generally includes an input subroutine, which is responsible for receiving the user's operation instructions; an update subroutine, which is responsible for processing the game logic process caused by the user's operation instructions; a rendering subroutine 3101, which is responsible for rendering the game screen. The processing process of the rendering subroutine covers the entire process from the CPU determining the rendering object, sending the rendering instruction to the image application program interface to the GPU completing the rendering of a frame of the screen. The game screen generally includes multiple consecutive frames, with Figure 3 Assume that the N-1th frame, the Nth frame, and the N+1th frame (N is an integer, and N is greater than or equal to 2) are a set of continuous frame sequences. When the CPU processes the N-1th frame, the Nth frame, and the N+1th frame, it will generate corresponding rendering instructions and send them to the GPU for operation. These continuously sent rendering instructions are the aforementioned rendering instruction sequence. Figure 3 The rendering instruction sequence in includes 3 rendering instructions. Of course, it should be understood that the above is only an example of a continuous frame sequence, and the number of frames and rendering instructions of the actual game screen is not fixed.
[0073] In an embodiment of the present application, a method for obtaining rendering time is provided. The execution subject of the method may be a terminal device, which is equipped with a graphics application program interface and may be any one of the aforementioned home game consoles, multi-function handheld game consoles, smart phones, tablet computers, laptop computers or desktop computers. Figure 4 and Figure 5 , Figure 4 This is an optional flowchart of a method for obtaining rendering time consumption on a terminal device in an embodiment of the present application. Figure 5 This is a schematic diagram of the interaction between the program and the interface in the process of obtaining GPU rendering time by the terminal device in the embodiment of the present application. Figure 4 and Figure 5 A detailed description of the process of obtaining the rendering time on the terminal device is provided. Figure 4 The steps in the embodiment mainly include step 410 to step 440:
[0074] Step 410: Run the target program and the application performance monitoring program;
[0075] Step 420: triggering a first instruction before the rendering subroutine in the target program is executed; the first instruction is used to enable the application performance monitoring program to send a first call instruction to the graphics application program interface, and the first call instruction is used to call the graphics application program interface to start the GPU rendering time query task;
[0076] Step 430: triggering a second instruction after the rendering subroutine is executed; the second instruction is used to cause the application performance monitoring program to send a second call instruction to the graphics application program interface, and the second call instruction is used to call the graphics application program interface to terminate the GPU rendering time-consuming query task;
[0077] Step 440: Obtain the rendering time returned by the GPU rendering time query task.
[0078] In the embodiment of the present application, the target program can be the game program itself or a part of the game program including the rendering subroutine. When the target program is run on the terminal device, the GPU rendering time can be obtained by calling the graphics application program interface through the application performance monitoring program. The process mainly involves the interaction between the target program, the application performance monitoring program and the graphics application program interface. Specifically, the target program can be downloaded from the game resources released by the game developer, and the target program can be run on the terminal device based on the corresponding game engine environment; the application performance monitoring program is mainly used to obtain the rendering time, which is independent of the game itself, for example, it can be a game plug-in, an application performance monitoring software, or a small program that depends on the host program to run; the graphics application program interface is a cross-language and cross-platform application programming interface for rendering 2D and 3D vector graphics. This interface is generally composed of a variety of different function calls, and can be accompanied by simple function functions, mainly used to draw from simple graphics bits to complex three-dimensional scenes. For example, the graphics application program interface can be any one of OpenGL, OpenCL, Vulkan, OpenGL ES, WebGL, Metal, Directx, etc. The graphics application program interface is generally provided by the graphics card driver, that is, the terminal device can be equipped with the graphics application program interface when the graphics card driver is installed.
[0079] In an embodiment of the present application, the game developer may set two instructions in the target program, which are recorded as the first instruction and the second instruction, respectively, wherein the first instruction is triggered before or when the rendering subroutine of each frame of the target program is executed, and the target object of the first instruction is the application performance monitoring program. Specifically, the game developer may prompt the user to set up the corresponding application performance monitoring program to ensure the smooth triggering of the first instruction. For example, a game plug-in with an application performance monitoring program may be added to the game resources, or the user may be prompted to install the corresponding application performance monitoring program software. The purpose of setting the first instruction is to notify the application performance monitoring program that the target program is or is about to start executing the rendering task (i.e., the rendering subroutine) of a frame of the picture, so that the application performance monitoring program starts to obtain the GPU rendering time of the frame of the picture; similarly, the target object of the second instruction is also the application performance monitoring program, and the purpose of setting the second instruction is to notify the application performance monitoring program that the target program has completed the rendering task of a frame of the picture, so that the application performance monitoring program ends the acquisition of the GPU rendering time of the frame of the picture. It should be noted that the target objects of the first instruction and the second instruction in the embodiment of the present application are the same, that is, the application performance monitoring program that receives the first instruction and the application performance monitoring program that receives the second instruction are the same application performance monitoring program; the first instruction is used to notify the application performance monitoring program to start the GPU rendering time acquisition task, and the second instruction is used to notify the application performance monitoring program to end the GPU rendering time acquisition task initiated based on the first instruction. And it can be understood that in the embodiment of the present application, the role of the first instruction and the second instruction is to send a notification to the application performance monitoring program, and the first instruction and the second instruction do not need to return a result for the game, and the execution situation has nothing to do with the game itself. In other words, the specific GPU rendering time acquisition task is executed by the application performance monitoring program, and there is no substantial change to the target program, that is, the game itself, so the triggering of the first instruction and the second instruction will not have a negative impact on the operation of the game itself.
[0080] Reference Figure 5 When the application performance monitoring program receives the first instruction, it sends a first call instruction to the graphics application program interface, and the first call instruction is used to call the graphics application program interface to start the GPU rendering time query task; when the application performance monitoring program receives the second instruction, it sends a second call instruction to the graphics application program interface, and the second call instruction is used to call the graphics application program interface to terminate the GPU rendering time query task. Figure 3, for the rendering of the game screen, the CPU may need some time to determine the rendering object, generate rendering instructions, and submit the rendering instructions to the interface, and the actual GPU execution of the rendering instructions to complete the rendering process is only a part of the execution of the rendering subroutine, so it can be clearly known that the process of executing the rendering subroutine is not equivalent to the GPU rendering process. When processing rendering tasks, since it is necessary to call the graphics application program interface to inform the GPU of the specific data that needs to be processed, it is more accurate and reasonable to determine the GPU rendering time from the graphics application program interface. In the embodiment of the present application, the application performance monitoring program is triggered by the target program, and then the graphics application program interface is called to determine the GPU rendering time. On the one hand, it can effectively reduce the interference with the operation of the game itself and improve the stability of the game operation. On the other hand, it can make the determination result of the GPU rendering time relatively more accurate, which is conducive to helping users accurately locate hardware performance problems.
[0081] Based on the above Figure 5 As described in the embodiments, another method for obtaining rendering time is provided in the embodiments of the present application. The execution subject of the method is the aforementioned application performance monitoring program. The method can be applied to a terminal device, for example, the application performance monitoring program can be installed in the terminal device. The method can also be applied to a server, and can also be applied to software in a terminal or server to implement a part of the software function, for example, it can be applied to game plug-ins, application performance monitoring software, or small programs that rely on the host program to run, etc., but it is not limited to the above forms. Reference Figure 6 , Figure 6 is an optional flowchart of another method for obtaining rendering time provided in an embodiment of the present application. Figure 6 The method shown in mainly includes steps 610 to 630.
[0082] Step 610: In response to the first instruction in the target program, call a graphics application program interface to start a GPU rendering time-consuming query task;
[0083] Reference Figure 5 In the present application embodiment, for Figure 5As for the application performance monitoring program in, it can run synchronously during the game to obtain the current GPU rendering time. Specifically, the running location of the application performance monitoring program can be flexibly adjusted. For example, it can run on the same terminal device as the game, or it can run on a server to obtain the GPU rendering time and provide application performance monitoring services to users. When the target program runs to a certain moment before the execution of the rendering subroutine of each frame (this moment is after the execution of the rendering subroutine of the previous frame), the first instruction set in the target program is triggered. At this time, the application performance monitoring program responds to the first instruction and sends a first call instruction to the graphics application program interface. The first call instruction is used to call the graphics application program interface to start the GPU rendering time query task.
[0084] Step 620: In response to the second instruction in the target program, call the graphics application program interface to terminate the GPU rendering time-consuming query task;
[0085] When the target program runs to a certain moment after the rendering subroutine of each frame is executed (this moment is before the rendering subroutine of the next frame is executed), the second instruction set in the target program is triggered. At this time, the application performance monitoring program responds to the second instruction and sends a second call instruction to the graphics application program interface. The second call instruction is used to call the graphics application program interface to terminate the GPU rendering time-consuming query task.
[0086] Step 630, obtaining the rendering time returned by the GPU rendering time query task;
[0087] In an embodiment of the present application, when the first instruction and the second instruction in the game subroutine corresponding to a frame of the game screen are triggered, a closed loop of a GPU rendering time query task can be completed, and the application performance monitoring program can thereby obtain the rendering time returned by the task. Due to the different types of graphics application program interfaces, there are certain differences in the process of corresponding GPUs executing rendering instructions. In an embodiment of the present application, a variety of execution methods for GPU rendering time query tasks are provided for the specific situation of GPU executing rendering instructions. The detailed process of the GPU rendering time query task is described below in conjunction with the accompanying drawings.
[0088] Specifically, refer to Figure 7 , Figure 7The figure is a schematic diagram of the GPU executing rendering instructions when rendering a frame of game screen. In this embodiment, the rendering instructions obtained by the GPU from the graphics application program interface are executed in sequence, and the next rendering instruction is executed after the previous rendering instruction is executed. The rendering instructions are numbered in the order of the time when the execution starts, and are recorded as the first rendering instruction, the second rendering instruction, the third rendering instruction... the Mth rendering instruction (M is a positive integer). The GPU starts to execute from the first rendering instruction, and immediately executes the second rendering instruction after the execution is completed. After the second rendering instruction is executed, the third rendering instruction is immediately executed, and so on, until the last rendering instruction of the current frame of game screen, that is, the Mth rendering instruction, is executed and the rendering work is ended.
[0089] In this case, when calling the graphics application program interface to perform the GPU rendering time query task, the first call instruction can be an instruction for triggering the graphics application program interface to record the rendering start time, recorded as the first query instruction. When the graphics application program interface receives the first query instruction, it automatically records the time when the next rendering instruction starts to execute through the set function. Since the first query instruction is issued by the application performance monitoring program before the rendering subroutine of each frame of the game screen is executed, the next rendering instruction processed by the GPU at this time is the first rendering instruction of the game screen that is about to be rendered, corresponding to Figure 7 is the first rendering instruction. Similarly, the second call instruction can be an instruction for triggering the graphics application program interface to record the rendering end time, recorded as the second query instruction. When the graphics application program interface receives the second query instruction, it automatically records the time when the previous rendering instruction is executed through the set function. Since the second query instruction is issued by the application performance monitoring program after the rendering subroutine of each frame of the game screen is executed, the previous rendering instruction processed by the GPU at this time is the last rendering instruction of a frame of the game screen that has been rendered, corresponding to Figure 7 The first rendering instruction is used to determine the rendering start time of the frame of the game screen, and the Mth rendering instruction is used to determine the rendering end time of the frame of the game screen. The time interval between the rendering start time and the rendering end time is the GPU rendering time that needs to be obtained. Therefore, the rendering time can be determined by the difference between the rendering end time and the rendering start time. For example, Figure 7 The first rendering instruction of a certain frame of game screen shown in the figure starts to be executed at 14 minutes 16 seconds 720 milliseconds, and the Mth rendering instruction is completed at 14 minutes 16 seconds 732 milliseconds. It can be calculated that the GPU rendering time of this frame of game screen is 12 milliseconds.
[0090] Reference Figure 8 , Figure 8This is another schematic diagram of the GPU executing rendering instructions when rendering a frame of game screen. The rendering instructions obtained by the GPU from the graphics application program interface are executed in sequence, and the next rendering instruction is executed after the previous rendering instruction is executed. The rendering instructions are numbered in the order of the time when the execution starts, and are recorded as the first rendering instruction, the second rendering instruction, the third rendering instruction... the Mth rendering instruction (M is a positive integer). The GPU starts to execute from the first rendering instruction, and executes the second rendering instruction after the execution is completed. After the second rendering instruction is executed, the third rendering instruction is executed, and so on, until the last rendering instruction of the current frame of game screen, that is, the Mth rendering instruction, is executed and the rendering work is ended.
[0091] In this case, when calling the graphics application program interface to execute the GPU rendering time query task, the first calling instruction can be an instruction for triggering the graphics application program interface to start recording the time consumed to execute each rendering instruction. The first calling instruction at this time is recorded as the third query instruction, and the time consumed to execute each rendering instruction is recorded as the first time consumed. When the graphics application program interface receives the third query instruction, it starts to record the first time consumed to execute each rendering instruction through the set function. Figure 8 , the first time consumption corresponding to the first rendering instruction is T1, the first time consumption corresponding to the second rendering instruction is T2… The first time consumption corresponding to the Mth rendering instruction is TM. Similarly, the second call instruction can be an instruction for triggering the graphics application program interface to end recording the first time consumption of executing each rendering instruction. The second call instruction at this time is recorded as the fifth query instruction. When the graphics application program interface receives the fifth query instruction, it terminates recording the first time consumption of executing each rendering instruction through the set function. Since the third query instruction is issued by the application performance monitoring program before the rendering subroutine of each frame of the game screen is executed, and the fifth query instruction is issued by the application performance monitoring program after the rendering subroutine of the frame of the game screen is executed, what is recorded between the third query instruction and the fifth query instruction at this time is the first time consumption corresponding to all rendering instructions of a complete frame of the game screen, corresponding to Figure 8 In the figure, it is T1, T2, T3, ... TM. The GPU rendering time refers to the time consumed by the GPU to process a frame of game screen, that is, the total time consumed to process the rendering instructions corresponding to the frame of game screen. Therefore, the required GPU rendering time can be obtained by summing up the first time consumed by processing the frame of game screen.
[0092] For example, Figure 8In the game frame shown, the GPU completes the rendering task calculation through four rendering instructions (i.e., M is equal to 4), and the four rendering instructions are the first rendering instruction, the second rendering instruction, the third rendering instruction, and the fourth rendering instruction. The first rendering instruction corresponds to a first time consumption T1 of 2 milliseconds, the second rendering instruction corresponds to a first time consumption T2 of 3 milliseconds, the third rendering instruction corresponds to a first time consumption T3 of 4 milliseconds, and the fourth rendering instruction corresponds to a first time consumption T4 of 5 milliseconds. It can be calculated that the GPU rendering time of this frame of the game screen is 14 milliseconds. In the embodiment of the present application, relative to Figure 7 The illustrated embodiment of executing the GPU rendering time query task determines the GPU rendering time by summing up the first time of each rendering instruction, which can avoid counting the non-GPU actual processing time between the execution of each rendering instruction, effectively reducing the rendering time error that may be caused by the delay in issuing rendering instructions, and can make the determined rendering time result more accurate, so as to clearly reflect the real working performance of the GPU.
[0093] Reference Fig. 9 , Fig. 9 This is another schematic diagram of the GPU executing rendering instructions when rendering a frame of game screen. The rendering instructions obtained by the GPU from the graphics application program interface are executed in sequence, and the next rendering instruction is executed at a certain time point after the previous rendering instruction starts to be executed. The rendering instructions are numbered in the order of the time when the execution starts, and are recorded as the first rendering instruction, the second rendering instruction, the third rendering instruction... the Mth rendering instruction (M is a positive integer). The GPU starts to execute from the first rendering instruction, and continues to execute the second rendering instruction after the execution starts. After the second rendering instruction starts to be executed, it continues to execute the third rendering instruction, and so on, until the last rendering instruction of the current frame of game screen, that is, the Mth rendering instruction, is executed and the rendering work is ended.
[0094] In this case, when calling the graphics application program interface to execute the GPU rendering time query task, the first calling instruction can be an instruction for triggering the graphics application program interface to start recording the timing information of executing each rendering instruction. The first calling instruction at this time is recorded as the fourth query instruction. When the graphics application program interface receives the fourth query instruction, it starts to record the timing information of the execution of each rendering instruction through the set function. Fig. 9 In the example, the timing information corresponding to the first rendering instruction is TS1, the timing information corresponding to the second rendering instruction is TS2, and the timing information corresponding to the Mth rendering instruction is TSM. For example, TS1 can represent the time from 14 minutes 16 seconds 750 milliseconds to 14 minutes 16 seconds 752 milliseconds, indicating that the time taken to execute the first rendering instruction is 2 milliseconds. Figure 8The time consumption corresponding to the rendering instruction is recorded as the second time consumption, and the second time consumption corresponding to the first rendering instruction is 2 milliseconds. Similarly, the second call instruction can be an instruction for triggering the graphics application program interface to end recording the timing information of executing each rendering instruction. The second call instruction at this time is recorded as the sixth query instruction. When the graphics application program interface receives the sixth query instruction, it terminates recording the timing information of the execution of each rendering instruction through the set function. Since the fourth query instruction is issued by the application performance monitoring program before the rendering subroutine of each frame of the game screen is executed, and the sixth query instruction is issued by the application performance monitoring program after the rendering subroutine of the frame of the game screen is executed, what is recorded between the fourth query instruction and the sixth query instruction at this time is the timing information corresponding to all the rendering instructions of a complete frame of the game screen, corresponding to Fig. 9 That is TS1, TS2, TS3...TSM.
[0095] The foregoing Figure 7 and Figure 8 In the embodiment in, the GPU is a single rendering thread and can only process rendering instructions synchronously, that is, the next rendering instruction can only be processed after one rendering instruction is processed. In the embodiment of the present application, rendering instructions can be processed asynchronously through multiple threads, so the actual GPU rendering time is less than the sum of the second time corresponding to each rendering instruction. In this case, the corresponding second time can be determined based on the timing information corresponding to each rendering instruction, for example, the second time corresponding to the first rendering instruction is 2 milliseconds, and then the overlapping time of executing each rendering instruction is determined. The overlapping time refers to the time period in which the execution time of the rendering instruction in the latter sequence overlaps with the execution time of at least one rendering instruction in the previous sequence. For example, for the second rendering instruction, its timing information starts from 14 minutes 16 seconds 751.5 milliseconds and ends at 14 minutes 16 seconds 754 milliseconds, indicating that the second execution time of the second rendering instruction is 2.5 milliseconds, and the partial execution time period of the second rendering instruction overlapping with the previous first rendering instruction (that is, during this period of time, the first rendering instruction and the second rendering instruction are executed at the same time) is 14 minutes 16 seconds 751.5 milliseconds to 14 minutes 16 seconds 752 milliseconds, which is the overlapping time of the second rendering instruction, that is, Fig. 9 TD1 shown in . In the embodiment of the present application, after removing the overlapping time from all the second time corresponding to each frame of the game screen, the second time is summed up to obtain the required rendering time. For example, Fig. 9In the game frame shown, the GPU completes the rendering task through four rendering instructions (i.e., M is equal to 4). The four rendering instructions are the first rendering instruction, the second rendering instruction, the third rendering instruction and the fourth rendering instruction. The second time consumption T1 corresponding to the first rendering instruction is 2 milliseconds, the second time consumption T2 corresponding to the second rendering instruction is 2.5 milliseconds, the second time consumption T3 corresponding to the third rendering instruction is 3 milliseconds, and the first time consumption T4 corresponding to the fourth rendering instruction is 3 milliseconds. The overlapping time consumption of the second rendering instruction and the previous rendering instruction is 0.5 milliseconds, the overlapping time consumption of the third rendering instruction and the previous rendering instruction is 0 milliseconds, and the overlapping time consumption of the fourth rendering instruction and the previous rendering instruction is 1 millisecond. It can be calculated that the GPU rendering time consumption of this frame of game screen is 9 milliseconds. It can be understood that the aforementioned Figure 7 , Figure 8 and Fig. 9 The numerical values involved in the embodiments are only used to illustrate the technical principles and are not intended to limit or prove the actual GPU rendering time.
[0096] The following is a detailed description of the method for obtaining the rendering time in the embodiment of the present application in combination with the game program and the graphics application program interface corresponding to the specific game engine. It should be understood that the following embodiments are only exemplary descriptions of the present application and do not limit the actual application of the present application.
[0097] In the embodiments of this application, the Unity engine is used as an example for explanation. The Unity engine is a real-time 3D interactive content creation and operation platform. It is widely used because it is easy to use, compatible with most game platforms, and has a low learning threshold. Fig.10 , Fig.10 What is shown is part of the script life cycle of the Unity engine (the loop path and some specific functions are omitted). Fig.10The various parts of the script program are executed from top to bottom. Among them, the initialization subroutine is often used to initialize data or game logic before the game starts; the physical operation subroutine is often used to perform physical operations on game objects or detect collisions and trigger conditions; the input event subroutine is used to obtain user input instructions, such as mouse clicks or movements; the game logic subroutine is used to execute the game's logical settings, which includes the update function (Update function) and the late update function (LateUpdate, also called the delayed update function). When the game program is started, the above two functions will be called when each frame of the scene is rendered; the rendering subroutine includes scene rendering, object icon rendering and interface rendering; after rendering is completed, wait for the CPU to complete the work, and then execute the waiting frame end callback function (WaitForEndOfFrame); the subsequent destruction and exit subroutines in the end stage. It can be seen that for the game program made by the Unity engine, in the rendering process of a frame of the game screen, the function step executed before the rendering subroutine is executed is the late update function, and the function step executed after the subroutine is executed is the waiting frame end callback function. Taking the game program as the target program as an example, at this time, the setting position of the first instruction can be executed synchronously with the post-update function, that is, when the target program executes to the post-update function of the game logic subroutine, the first instruction is triggered; the setting position of the second instruction can be executed synchronously with the waiting frame end callback function, that is, when the target program executes to the waiting frame end callback function, the second instruction is triggered. Specifically, the Unity engine provides a custom event callback mechanism (GL.IssuePluginEvent mechanism), which allows the game program to send a user-defined event to the local code plug-in. In the embodiment of the present application, this mechanism can be used to trigger the first instruction and the second instruction. The local code plug-in can be either an application performance monitoring program or a plug-in for forwarding the first instruction and the second instruction to the application performance monitoring program or a server.
[0098] As for the graphics application programming interface, most games on the Android platform use OpenGL ES (OpenGL for Embedded Systems). OpenGL ES is a subset of OpenGL (Open Graphics Library, open graphics library or "open graphics library"), which is designed for embedded devices such as mobile phones, PDAs and game consoles. In the embodiment of the present application, Figure 6Taking the illustrated embodiment as an example, if the graphics application program interface is OpenGL ES, then the calling of the graphics application program interface to start the GPU rendering time query task in step 610 may be to call an initiation query function (glBeginQuery function) to OpenGL ES to initiate a query for GL_TIME_ELAPSED (OpenGL ES interface work time); correspondingly, the calling of the graphics application program interface to terminate the GPU rendering time query task in step 620 may be to call an end query function (glEndQuery function) to OpenGL ES to end the query for GL_TIME_ELAPSED and obtain the query result of GL_TIME_ELAPSED as the GPU rendering time. The GPU using the OpenGL ES type interface is synchronous when executing rendering instructions, and it can adopt Figure 7 or Figure 8 The embodiment shown determines the GPU rendering time. For the iOS platform, its dedicated graphics application program interface Metal is executed asynchronously when used by the GPU, generally using Fig. 9 The illustrated embodiment determines GPU rendering time.
[0099] Reference Fig.11 In an embodiment of the present application, a method for displaying rendering time is also provided. The display method can be applied to a terminal device. The execution subject of the method can be either the aforementioned terminal device or the aforementioned application performance monitoring program. Fig.11 FIG. 1 shows an optional flow chart of a method for displaying time-consuming rendering provided in an embodiment of the present application. The method mainly includes steps 1110 to 1120:
[0100] Step 1110: Figure 4 or Figure 6 The method for obtaining the rendering time shown obtains the GPU rendering time when the game is running;
[0101] Step 1120: Display the time-consuming GPU rendering information on the game screen.
[0102] In the embodiment of the present application, the terminal device can adopt Figure 4 The rendering time acquisition method shown in the figure obtains the GPU rendering time information when the game is running and displays it on the game screen. It can also be used by the application performance monitoring program as shown in the figure. Figure 6 The rendering time acquisition method shown obtains the GPU rendering time information when the game is running, and displays it on the game screen through the terminal device. For details, please refer to Fig.12 , Fig.12A method of displaying GPU rendering time information on the game screen is shown in FIG. After obtaining the current GPU rendering time information through the aforementioned rendering time acquisition method, it can be displayed in a corner of the game screen through a hardware status prompt box 1210. For example Fig.12 In the hardware status prompt box 1210, the information "the current GPU rendering time is 15 milliseconds" is displayed. Of course, it is understandable that the actual implementation methods for displaying the above-mentioned GPU rendering time can be various. For example, it can be displayed in the game screen in the form of a transparent watermark, or it can be displayed in the form of a scrolling report at intervals. It should be noted that since the actual game screen refreshes very quickly, the above-mentioned GPU rendering time information may not be real-time. For example, the GPU rendering time of one of the frames refreshed during the period can be taken every predetermined time period, and displayed as the GPU rendering time information for the period. For example, the GPU rendering time can be taken every 1 minute, and the value can be displayed as the GPU rendering time information for one minute.
[0103] Understandably, Figure 4 or Figure 6 The contents of the method for obtaining the rendering time shown in the embodiment are all applicable to the method for displaying the rendering time in the embodiment of the present invention. The functions specifically implemented in the method for displaying the rendering time in the process of determining the rendering time are the same as those in the embodiment of the present invention. Figure 4 or Figure 6 The method for obtaining the rendering time shown in the embodiment is the same as that in the embodiment of the present invention, and the beneficial effects achieved are the same as those achieved in the embodiment of the present invention. Figure 4 or Figure 6 The beneficial effects achieved by the embodiment of the method for obtaining the rendering time consumption shown are also the same.
[0104] Reference Fig.13 In an embodiment of the present application, a game performance monitoring method is also provided. Similarly, the game performance monitoring method can be applied in a terminal, in a server, or in software in a terminal or a server to implement a part of the software functions, but is not limited to the above forms. Fig.13 FIG. 1 is an optional flow chart of a method for monitoring game performance provided in an embodiment of the present application. The method mainly includes steps 1310 to 1330:
[0105] Step 1310: Obtain the CPU usage rate during game operation;
[0106] In the embodiment of the present application, the CPU usage rate indicates the CPU resources occupied by the running program. Under the same other conditions (for example, the other running programs are the same), for the same terminal device running different games, the higher the CPU usage rate corresponding to the game, the more CPU hardware resources the game occupies; for different terminal devices running the same game, the higher the CPU usage rate corresponding to the terminal device, the worse the CPU performance of the terminal device.
[0107] Step 1320: Figure 4 or Figure 6 The method for obtaining the rendering time shown obtains the GPU rendering time during game running;
[0108] Step 1330: When the CPU usage rate is higher than the first threshold and the GPU rendering time is lower than the second threshold, the CPU is determined as the hardware bottleneck of the game rendering performance;
[0109] or,
[0110] When the CPU usage is lower than the third threshold and the GPU rendering time is higher than the fourth threshold, the GPU is determined to be the hardware bottleneck of the game rendering performance.
[0111] In the embodiment of the present application, the CPU usage and GPU time consumption during the game running on the terminal device are obtained, and by comparing with the preset performance threshold, it is determined which of the two hardwares restricts the rendering performance of the game to a greater extent. The principle is that since the game rendering performance is related to both the CPU and the GPU, and in most cases, the CPU and the GPU cannot be in the best operating performance at the same time. If the CPU's operating performance is good, the GPU rendering speed cannot keep up, resulting in a low CPU utilization rate and a high rendering time consumption; if the GPU's operating performance is good, the CPU cannot keep up with the speed of issuing rendering instructions, resulting in a high CPU utilization rate and a low rendering time consumption. Therefore, in the embodiment of the present application, a first threshold and a third threshold are set for the CPU usage rate, and the third threshold is less than or equal to the first threshold. A second threshold and a fourth threshold are set for the GPU time consumption, and the second threshold is less than or equal to the fourth threshold. When the CPU usage rate is higher than the first threshold and the GPU rendering time is lower than the second threshold, it means that the CPU performance is poor, which is the main factor restricting the game rendering performance, and it can be defined as the hardware bottleneck of the game rendering performance; when the CPU usage rate is lower than the third threshold and the GPU rendering time is higher than the fourth threshold, it means that the GPU performance is poor, which is the main factor restricting the game rendering performance, and it can be defined as the hardware bottleneck of the game rendering performance. For example, in an embodiment of the present application, the first threshold can be set to 80%, the second threshold can be set to 10 milliseconds, the third threshold can be set to 60%, and the fourth threshold can be set to 14 milliseconds. It should be understood that the above values are for illustration only and do not represent the specific circumstances in the actual use of this embodiment.
[0112] It should be noted that, although the method for obtaining the rendering time in the embodiment of the present application is mainly to solve the problem that it is inconvenient for users to obtain GPU time information, this does not mean that the embodiment of the present application cannot be implemented by other types of people. For example, for game developers, they can also use the method for obtaining the rendering time provided in the embodiment of the present application to obtain the GPU rendering time, and use the game performance monitoring method provided in the embodiment of the present application to analyze the running performance of the game.
[0113] Reference Fig.14 The embodiment of the present application further discloses a device for obtaining rendering time consumption, including:
[0114] The first processing unit 1410 is used to call a graphics application program interface to start a GPU rendering time-consuming query task in response to a first instruction in the target program;
[0115] The second processing unit 1420 is used to call a graphics application program interface to terminate the GPU rendering time-consuming query task in response to a second instruction in the target program;
[0116] An acquiring unit 1430 is used to acquire the rendering time returned by the GPU rendering time query task;
[0117] The first instruction is triggered before the rendering subroutine of each frame in the target program is executed, and the second instruction is triggered after the rendering subroutine is executed.
[0118] Understandably, Figure 6 The contents of the method for obtaining the rendering time shown in the embodiment are all applicable to the embodiment of the device for obtaining the rendering time. The functions specifically implemented by the device for obtaining the rendering time are the same as those in the embodiment of the present invention. Figure 6 The method for obtaining the rendering time shown in the embodiment is the same as that in the embodiment of the present invention, and the beneficial effects achieved are the same as those achieved in the embodiment of the present invention. Figure 6 The beneficial effects achieved by the embodiment of the method for obtaining the rendering time consumption shown are also the same.
[0119] The present application also provides a terminal device, which is used to Figure 4 The method shown obtains the GPU rendering time and displays the GPU rendering time.
[0120] Understandably, Figure 4 The contents of the method for obtaining the rendering time consumption in the embodiment shown in the figure are applicable to the terminal device embodiment. The functions specifically implemented by the terminal device embodiment are the same as those in the embodiment shown in the figure. Figure 4 The method for obtaining the rendering time shown in the embodiment is the same as that in the embodiment of the present invention, and the beneficial effects achieved are the same as those achieved in the embodiment of the present invention. Figure 4 The beneficial effects achieved by the embodiment of the method for obtaining the rendering time consumption shown are also the same.
[0121] Reference Fig.15 , the embodiment of the present application further discloses a computer device, including:
[0122] at least one processor 1510;
[0123] At least one memory 1520, used to store at least one program;
[0124] When at least one program is executed by at least one processor 1510, at least one processor 1510 implements the following Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 Any of the game performance monitoring method embodiments shown.
[0125] It is understandable that if Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The contents of the game performance monitoring method embodiment shown in the figure are all applicable to the computer device embodiment. The functions specifically implemented by the computer device embodiment are similar to those of Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The game performance monitoring method embodiment shown is the same as that of the embodiment of the present invention, and the beneficial effects achieved are the same as those of the embodiment of the present invention. Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The beneficial effects achieved by the game performance monitoring method embodiment shown are also the same.
[0126] The present application also discloses a computer-readable storage medium in which a program executable by a processor is stored. When the program executable by the processor is executed by the processor, it is used to implement the following Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 An embodiment of a game performance monitoring method is shown.
[0127] Understandably, Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The contents of the game performance monitoring method embodiment shown in the figure are all applicable to the computer-readable storage medium embodiment. The functions specifically implemented by the computer-readable storage medium embodiment are similar to those of the embodiment shown in the figure. Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The game performance monitoring method embodiment shown is the same as that of the embodiment of the present invention, and the beneficial effects achieved are the same as those of the embodiment of the present invention. Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The beneficial effects achieved by the game performance monitoring method embodiment shown are also the same.
[0128] The embodiment of the present application further discloses a computer program product or a computer program, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in the above-mentioned computer-readable storage medium; Fig.15The processor of the computer device shown in the figure can read the computer instruction from the above-mentioned computer readable storage medium, and the processor executes the computer instruction so that the computer device executes the following Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 An embodiment of a game performance monitoring method is shown.
[0129] Understandably, Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The contents of the game performance monitoring method embodiment shown in the figure are all applicable to the computer program product or computer program embodiment, and the functions specifically implemented by the computer program product or computer program embodiment are the same as those in the embodiment of FIG. Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The game performance monitoring method embodiment shown is the same as that of the embodiment of the present invention, and the beneficial effects achieved are the same as those of the embodiment of the present invention. Figure 4 or Figure 6 The rendering time-consuming acquisition method embodiment shown in FIG. Fig.11 The time-consuming rendering method embodiment shown in FIG. Fig.13 The beneficial effects achieved by the game performance monitoring method embodiment shown are also the same.
[0130] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the application is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part described as a larger operation is performed independently.
[0131] In addition, although the present application is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present application. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional techniques of the engineer. Therefore, those skilled in the art can implement the present application set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present application, which is determined by the full scope of the attached claims and their equivalents.
[0132] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0133] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0134] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in another suitable manner as necessary, and then stored in a computer memory.
[0135] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0136] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0137] Although the embodiments of the present application have been shown and described, those skilled in the art will appreciate that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present application, and that the scope of the present application is defined by the claims and their equivalents.
[0138] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the embodiments. Technical personnel familiar with the field can make various equivalent modifications or substitutions without violating the spirit of the present application. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A method for obtaining rendering time consumption, characterized in that: The following steps are involved: Run gaming programs and application performance monitoring programs; The application performance monitoring program responds to the first instruction in the game program and calls the graphics application program interface to start the GPU rendering time query task; wherein the GPU rendering time query task is used to query the rendering time of a frame of the game program; the calling of the graphics application program interface to start the GPU rendering time query task includes: sending a fourth query instruction to the graphics application program interface, wherein the fourth query instruction is used to trigger the graphics application program interface to start recording the timing information of executing each rendering instruction; The application performance monitoring program sends a second calling instruction to the graphics application program interface in response to the second instruction in the game program, wherein the second calling instruction is used to call the graphics application program interface to terminate the GPU rendering time-consuming query task; The application performance monitoring program obtains the rendering time returned by the GPU rendering time query task; the rendering time is determined by the following steps: obtaining the timing information corresponding to each rendering instruction; determining the second time and overlapping time of the graphics application program interface executing each rendering instruction according to the timing information; eliminating the overlapping time from each second time, and summing up each second time to obtain the rendering time; The first instruction is triggered before the rendering subroutine of each frame in the game program is executed, and the second instruction is triggered after the rendering subroutine is executed.
2. The method according to claim 1, characterized in that The calling of the graphics application program interface to start the GPU rendering time-consuming query task includes: A first query instruction is sent to the graphics application program interface, where the first query instruction is used to trigger the graphics application program interface to record a rendering start time.
3. The method according to claim 2, characterized in that The calling of the graphics application program interface to terminate the GPU rendering time-consuming query task includes: A second query instruction is sent to the graphics application program interface, where the second query instruction is used to trigger the graphics application program interface to record a rendering end time.
4. The method according to claim 3, characterized in that The rendering time is determined by the following steps: Get the rendering start time and the rendering end time; The rendering time is determined according to the difference between the rendering end time and the rendering start time.
5. The method according to claim 1, characterized in that The calling of the graphics application program interface to start the GPU rendering time-consuming query task includes: A third query instruction is sent to the graphics application program interface, where the third query instruction is used to trigger the graphics application program interface to start recording a first time consumption of executing each rendering instruction.
6. The method according to claim 5, characterized in that The rendering time is determined by the following steps: Obtaining the first time consumption corresponding to each of the rendering instructions; The first time consumptions are summed to obtain the rendering time consumption.
7. A time-consuming rendering display method, characterized in that: The following steps are involved: Obtaining the GPU rendering time when the game is running by the method for obtaining the rendering time described in any one of claims 1 to 6; On the game screen, information about the time consumed by the GPU rendering is displayed.
8. A method for monitoring game performance, characterized in that: The following steps are involved: Get the CPU usage during game running; Obtaining the GPU rendering time during game operation by the method for obtaining the rendering time described in any one of claims 1 to 6; When the CPU usage rate is higher than a first threshold and the GPU rendering time is lower than a second threshold, the CPU is determined as a hardware bottleneck of the game rendering performance; or, When the CPU usage rate is lower than a third threshold and the GPU rendering time is higher than a fourth threshold, the GPU is determined to be a hardware bottleneck of the game rendering performance.
9. A terminal device equipped with a graphical application program interface, characterized in that: The terminal device is used to obtain the GPU rendering time through the method for obtaining the rendering time as described in claim 1, and display the GPU rendering time.
10. A computer device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 1 to 8.
11. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, it is used to implement the method according to any one of claims 1 to 8.
