Performance index capturing method and device, storage medium and electronic equipment

By caching and filtering the performance indicator information in the target thread, and only saving the total duration indicator data, the problem of excessive data volume in the existing technology is solved, and the data utilization rate and system performance are improved.

CN118733371APending Publication Date: 2024-10-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310326516.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-29
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing technology generates a large amount of data that does not require attention during the process of capturing performance indicator information, which occupies storage space and increases system power consumption, resulting in low data utilization.

Method used

By obtaining the performance indicator information of one frame of the target thread and caching it, if the total duration indicator does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data is discarded.

Benefits of technology

Eliminate performance index data that does not need attention in the target thread, reduce the amount of data obtained, improve data utilization, save storage space and reduce system power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733371A_ABST
    Figure CN118733371A_ABST
Patent Text Reader

Abstract

The invention discloses a performance index capturing method and device, a storage medium and electronic equipment. The method comprises the steps that performance index information of a frame of a target thread is acquired and cached; and if the total duration index in the performance index information does not exceed the preset filtering threshold value, storing the total duration index data, and discarding the rest performance index data in the performance index information. According to the method, the performance index data which does not need to be concerned in the target thread can be removed, the obtained data volume is reduced, and the data utilization rate is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a performance indicator capture method, device, storage medium and electronic device. Background Art

[0002] As the performance of mobile devices continues to improve, users' performance requirements for applications are also getting higher and higher. In order to meet these requirements, developers need to analyze and optimize the performance of applications. Currently, performance analysis tools such as Android's Systrace tool can capture trace information to help developers analyze the performance indicators of applications. By analyzing these performance indicator information, developers can locate potential performance bottlenecks and optimize them. However, in the process of capturing performance indicator information, existing technologies often generate a large amount of data, which will take up a lot of storage space and increase system power consumption. Summary of the invention

[0003] The embodiments of the present application provide a performance indicator capture method, device, storage medium and electronic device, which can eliminate performance indicator data that does not need to be paid attention to in the target thread, reduce the amount of data obtained, and improve data utilization.

[0004] In a first aspect, an embodiment of the present application provides a performance indicator capture method, including:

[0005] Obtain the performance indicator information of one frame of the target thread and cache it;

[0006] If the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded.

[0007] In a second aspect, an embodiment of the present application provides a performance indicator capture device, comprising:

[0008] The data cache module obtains the performance indicator information of one frame of the target thread and caches it;

[0009] The first saving module saves the total duration indicator data and discards the remaining performance indicator data in the performance indicator information if the total duration indicator in the performance indicator information does not exceed a preset filtering threshold.

[0010] In a third aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the above-mentioned method steps.

[0011] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the above-mentioned method steps.

[0012] The beneficial effects brought about by the technical solutions provided by some embodiments of the present application include at least:

[0013] In an embodiment of the present application, the performance indicator information of one frame of the target thread is obtained and cached; if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded; the present application can eliminate the performance indicator data that does not need to be paid attention to in the target thread, reduce the amount of data obtained, and improve the utilization rate of the data. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0015] Figure 1 A schematic diagram of a flow chart of a performance indicator capture method provided in an embodiment of the present application;

[0016] Figure 2 A schematic diagram of a flow chart of a performance indicator capture method provided in an embodiment of the present application;

[0017] Figure 3 An example diagram of the relationship between the refresh rate of a terminal device and the corresponding refresh period provided in an embodiment of the present application;

[0018] Figure 4 An example diagram of trace stack information of a target thread provided in an embodiment of the present application;

[0019] Figure 5 An example diagram of trace stack information of an optimized target thread provided in an embodiment of the present application;

[0020] Figure 6 A schematic diagram of the structure of a performance indicator capture device provided in an embodiment of the present application;

[0021] Figure 7 A schematic diagram of the structure of a performance indicator capture device provided in an embodiment of the present application;

[0022] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0024] In the description of the present application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances. In addition, in the description of the present application, unless otherwise specified, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0025] In related technologies, developers often use performance analysis tools to collect detailed execution information of the system and applications in order to find performance bottlenecks and optimize applications. For example, Android's Systrace tool can capture trace information and generate an HTML (HyperText Markup Language) file, which contains detailed performance indicator information. Developers can analyze this information to find the performance bottleneck of the application and optimize it. However, in the process of capturing performance indicator information, a large amount of data is often generated, most of which is not helpful for problem analysis under normal circumstances, and will also take up a lot of storage space and increase system power consumption.

[0026] Based on this, an embodiment of the present application provides a performance indicator capture method, which can be implemented by a computer program and can be run on a performance indicator capture device based on the von Neumann system. The computer program can be integrated in an application or run as an independent tool application. Among them, the performance indicator capture device in the embodiment of the present application can be a terminal device, including but not limited to: a personal computer, a tablet computer, a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing device connected to a wireless modem. In different networks, terminal devices can be called different names, such as: user equipment, access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device, cellular phone, cordless phone, 5G network or terminal device in future evolution network, etc.

[0027] The performance indicator capture method provided by the present application is described in detail below with reference to specific embodiments.

[0028] See also Figure 1 , is a flow chart of a performance indicator capture method provided in an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application may include the following steps:

[0029] S101, obtaining performance indicator information of a frame of a target thread and caching it.

[0030] First, let's introduce threads. Threads are the basic unit of processor time allocated by the operating system. A process can contain multiple threads, which share the memory space and resources of the process. Threads can run and execute tasks independently to achieve concurrent operations. Each thread is responsible for performing specific tasks, such as UI (User Interface) updates, file I / O (Input / Output), network requests, etc. Analyzing thread performance indicators can help developers find performance bottlenecks and optimize application performance.

[0031] In the embodiment of the present application, the target thread refers to the thread for which performance indicator information needs to be captured. In order to obtain the performance indicator information of the target thread by frame, the target thread may be a specific thread related to the program frame rate. For example, such a thread may have any of the following characteristics:

[0032] Display or rendering task related: The target thread can be responsible for the display or rendering tasks in the program, such as graphics rendering, interface updates, etc.

[0033] Computation-intensive tasks: The target thread can involve computation-intensive tasks, such as physics simulation, animation calculation, etc.

[0034] Real-time response requirements: The target thread needs to complete the task within a specific time to meet the real-time response requirements. For example, the logic processing thread in the game, the real-time communication thread, etc.

[0035] The tasks of threads with these characteristics are closely related to the frame rate, so the execution process of these threads is usually organized by frame, and the performance indicator information of each frame can usually be obtained. In each frame, these threads can perform a series of operations, such as calculation, rendering, communication, etc. By collecting the performance indicator information of each frame, developers can analyze and optimize the performance of the threads.

[0036] In the embodiment of the present application, the performance indicator information refers to data used to measure the performance of the target thread during the execution of each frame. Such data may include but is not limited to the following features:

[0037] Execution time: Performance indicator information can include the execution time of the thread at the beginning, end, and intermediate key points of each frame to analyze the running speed and efficiency of the thread.

[0038] Resource usage: Performance metric information can include the computation, memory, and other system resources occupied by a thread during each frame execution to assess the impact of the thread on overall system performance.

[0039] Task completion: Performance indicator information can include the number and type of tasks completed by the thread in each frame, so as to analyze the workload and execution effect of the thread.

[0040] Errors and exceptions: Performance metrics information may include errors and exceptions encountered by threads during each frame of execution to help developers identify and resolve potential problems.

[0041] Frame rate related data: Performance indicator information may include statistics related to frame rate, such as rendering time and latency of each frame, so as to evaluate the impact of threads on the overall frame rate.

[0042] It should be noted that the execution process of the target thread is usually organized by frame, and the length of each frame is determined by the refresh rate of the terminal device. For example, in the Android system, a frame time refers to the time from the start of the VSYNC signal to the next VSYNC signal. A 60Hz display sends 60 VSYNC signals per second, that is, a VSYNC signal is sent every 16.67ms (1000ms / 60). The VSYNC signal is the vertical synchronization signal of the display, which is used to tell the application when to start rendering a new frame of the image. Ideally, the application should complete the rendering of a frame before each VSYNC signal arrives.

[0043] S102: If the total duration indicator in the performance indicator information does not exceed a preset filtering threshold, the total duration indicator data is saved, and the remaining performance indicator data in the performance indicator information is discarded.

[0044] In an embodiment of the present application, the performance index information obtained includes a total duration index, and the total duration index refers to the time consumed by the target thread to complete a frame of task operation. For example, in the Android system, the target thread receives the VSYNC signal and starts to process the task of the current frame. The time consumed when the frame task processing is completed is the time of the total duration index. In order to ensure a smooth user experience, the target thread needs to complete the processing of a frame in the shortest possible time. To this end, it is necessary to preset a filtering threshold for the total duration index of the target thread, and the purpose of setting the filtering threshold is to determine whether the total duration index of each frame is normal. If the total duration index of a frame does not exceed the filtering threshold, it indicates that the processing time of the frame is normal (i.e., a normal frame), and the possibility of a performance bottleneck is very low; if the total duration index of a frame exceeds the filtering threshold, it indicates that the processing time of the frame is abnormal (i.e., an abnormal frame), and the user may feel stuck and delayed.

[0045] In some application scenarios, it is necessary to give priority to the data of abnormal frames, without paying too much attention to the data of normal frames. Therefore, in the embodiment of the present application, only the total duration index data of normal frames in the cache is retained, and the remaining performance index data of normal frames are all discarded to improve the utilization of data.

[0046] In some embodiments, the target thread can be a main thread, a rendering thread, a SurfaceFlinger thread, and the like. The following will take the Android system as an example for a detailed introduction. Among them, the main thread is also called the UI thread, which is responsible for processing UI updates, user input events, and part of the application logic in the Android application. The rendering thread is responsible for performing drawing operations, thereby reducing the burden on the main thread. By analyzing the performance indicators of the rendering thread, the efficiency and performance of graphics drawing can also be understood. The SurfaceFlinger thread is responsible for managing the Surface of each application and system in the Android system, synthesizing the screen image and displaying it on the screen. Analyzing the performance indicators of the SurfaceFlinger thread helps to understand the graphics synthesis efficiency of the entire system.

[0047] For example, the performance index information of the main thread frame may include the following aspects:

[0048] CPU time: CPU time refers to the time the CPU spends when the main thread processes a frame of image. The shorter the CPU time, the higher the processing efficiency of the main thread. When the CPU time is too long, the frame rate of the application may drop.

[0049] GPU time: GPU time refers to the time the GPU takes to render a frame of an image. The shorter the GPU time, the higher the rendering efficiency. When the GPU time is too long, the frame rate of the application may drop.

[0050] Input event processing time: Input event processing time refers to the time required for the main thread to process input from the user (such as touch, key, etc.). The shorter the input event processing time, the smoother the user experience.

[0051] Layout, measurement, and drawing time: These times represent the time the main thread spends on layout, measurement, and drawing UI elements in one frame. The shorter these times are, the higher the UI rendering efficiency is.

[0052] The performance indicator information obtained by different target threads may involve different aspects. For example, the performance indicator data of the SurfaceFlinger thread may involve the following aspects:

[0053] Composition time: refers to the time it takes for SurfaceFlinger to combine different applications and system Surfaces into the final screen image. Shorter composition time means higher rendering efficiency.

[0054] Waiting time: refers to the time SurfaceFlinger waits for the application to submit a new frame. Longer waiting time may cause frame rate drops and freezes.

[0055] Flip time: refers to the time it takes SurfaceFlinger to send the synthesized image to the display. A shorter flip time means a faster image update speed.

[0056] In an embodiment of the present application, the performance indicator information of one frame of the target thread is obtained and cached; if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded; the present application can eliminate the performance indicator data that does not need to be paid attention to in the target thread, reduce the amount of data obtained, and improve the utilization rate of the data.

[0057] See also Figure 2 , is a flow chart of a performance indicator capture method provided in an embodiment of the present application. Figure 2 As shown, the method of the embodiment of the present application may include the following steps:

[0058] S201, obtaining a refresh rate supported by a terminal device, and determining a preset filtering threshold according to the refresh rate.

[0059] In an embodiment of the present application, the target thread in the task processing process changes periodically based on the refresh rate supported by the terminal device. It is understandable that in the task processing process, the working state of the target thread (such as the main thread, rendering thread, etc.) will change periodically according to the refresh rate of the terminal device, and process related tasks of one frame in each refresh cycle. The refresh rate of the terminal device refers to the number of times the screen is refreshed per second, usually expressed in Hertz (Hz). For example, for a terminal device with a refresh rate of 60Hz, the screen refreshes 60 times per second, and the time interval between each refresh is about 16.67ms. In this case, the target thread needs to complete related tasks in each refresh cycle, such as UI updates, graphics rendering, etc., to ensure the smoothness of the user interface; if the processing time of a frame exceeds the refresh interval of the display, the user may feel stuck and delayed.

[0060] For example, under normal circumstances, the SurfaceFlinger thread performs tasks according to the refresh rate and VSYNC signal of the terminal device, showing a certain periodic pattern. Its screen refresh cycle is the time interval between two VSYNC signals. In each refresh cycle, the SurfaceFlinger thread processes and presents a frame. When the performance is sufficient to support the refresh rate of the terminal device, the SurfaceFlinger thread can complete the task in each refresh cycle and start executing the next frame on time according to the VSYNC signal.

[0061] As the refresh rate of the adapted terminal device changes, the working state of the target thread should also be adjusted accordingly. Figure 3 As shown, for a terminal device with a refresh rate of 120Hz, the target thread needs to complete a frame of tasks within a refresh cycle of 8.33ms. This may increase the workload of the thread and require higher performance optimization. Therefore, different filter thresholds need to be set for different refresh rates supported by terminal devices. In an embodiment of the present application, the time of the terminal device screen refresh cycle (i.e., the time interval between two VSYNC signals) can be used as the preset filter threshold, which can be adapted to terminal devices that support various refresh rates.

[0062] S202, obtaining and caching performance indicator information of a frame of the target thread.

[0063] In the embodiment of the present application, the performance indicator information of a frame of the target thread includes a total duration indicator, and the total duration indicator refers to the time required for the target thread to complete a frame-related operation. It can be understood that when the target thread processes a frame task, the time from the start of frame processing to the end of frame processing is the total duration indicator.

[0064] In some embodiments, a start mark and an end mark may be set at the beginning and the end of frame processing in the target thread, respectively, and the total duration indicator of each frame in the target thread is determined based on the corresponding start mark and the end mark.

[0065] For example, at the beginning of a frame of processing, insert a trace point to record the current timestamp; at the end of a frame of processing, insert another trace point to record the current timestamp; by calculating the time difference between the two trace points, the total duration indicator of a frame of the target thread can be obtained.

[0066] In some embodiments, the performance indicator information may be trace information used to evaluate the running status of the application program. The following will take caching trace stack information as an example to introduce the process of obtaining and caching the performance indicator information.

[0067] Before starting to capture the trace stack information of the target thread, insert trace points into the program of the target thread. These trace points can be implemented through the Trace class or other similar tools provided by the Android system. When the program is running, the system will collect performance indicator data based on the inserted trace points. This data can include information such as timestamps, thread IDs, event types, etc. As for the identification of trace points, they can be identified by the labels or identifiers used when tracing. For example, when using the Trace class to insert trace points in Android, a descriptive string label can be assigned to each trace point, such as Trace.beginSection("FrameStart"). During the analysis process, different trace points can be identified based on these labels.

[0068] Because of the working principle of the trace stack, a first-in, last-out (FILO) strategy is usually adopted when caching the trace stack. Understandably, when encountering a new trace point, the previous trace points will be processed first. Therefore, when caching trace data, the total duration indicator of the first point will be processed first, but because it needs to wait for the processing of other related points to be completed, its calculation result will be obtained last and located at the top level of the trace stack information. This strategy helps to maintain the structure and order of trace data so that the performance of the thread can be correctly analyzed. And when the total duration indicator (top stack) of one frame of the target thread is cached, the data of other layers of the trace stack has also been cached.

[0069] See also Figure 4 , is an example diagram of trace stack information of a target thread provided in an embodiment of the present application.

[0070] exist Figure 4 In the example, each "Frame" represents a frame, and "Event" represents an event that occurs within the frame. Each event can contain relevant performance indicator information such as timestamp, duration, and resource usage. In this example, the target thread changes periodically according to the frame rate, that is, it executes a series of related tasks after the start of a frame, completes all tasks of the frame before the next frame arrives, and repeats this step in the next frame. The length of each layer of the stack represents its duration. Events are executed sequentially from top to bottom. The start time of the lower layer is later than that of the upper layer, and the end time is earlier than that of the upper layer. Therefore, each layer is shorter than the previous layer. The top stack information (such as Event1.1) is the total duration indicator, which indicates the total time consumed by the target thread to process the frame task.

[0071] It should be noted that in the embodiment of the present application, the performance indicator data of each frame of the target thread can be cached in sequence according to the processing time of the target thread, and the subsequent steps are processed immediately after caching a frame, that is, the current cached data is selected. However, depending on the specific implementation scenario, frame skipping or configuring the cache order can also be considered, and multiple frames can be cached first and then processed in batches. The embodiment of the present application is only an exemplary explanation for this and is not limited.

[0072] S203: Determine whether the total duration indicator in the performance indicator information exceeds a preset filtering threshold.

[0073] Specifically, if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, S204 is executed; if the total duration indicator in the performance indicator information exceeds the preset filtering threshold, S205 is executed.

[0074] In an embodiment of the present application, the total duration indicator in the performance indicator information is compared with a preset filtering threshold to determine whether the current frame is a normal frame or an abnormal frame. Different data storage methods are used according to different categories to achieve the purpose of reducing the amount of data captured by the performance indicator.

[0075] It should be noted that the target thread should usually complete a frame of tasks before the next VSYNC signal arrives, but in special cases, the target thread may need to use multiple frames to process a frame of tasks. Therefore, the preset filtering threshold is not necessarily the same as the refresh cycle of the terminal device screen. In actual application scenarios, it can be adjusted appropriately based on the refresh cycle and actual needs. In special cases, you can either configure a special filtering threshold separately, or not configure it separately and use a small number of special frames as abnormal frames to capture relevant performance indicator information.

[0076] S204: Save the total duration indicator data, and discard the remaining performance indicator data in the performance indicator information.

[0077] Specifically, if the total duration indicator in the performance indicator information of a frame of the target thread does not exceed the preset filtering threshold, it indicates that the processing time of the frame is normal and has little value for performance analysis. In the application scenario of lightweight performance indicator capture, you can choose to discard all the performance indicator data of the frame. In an embodiment of the present application, the total duration indicator data of normal frames also needs to be saved. When the frame processing is normal, only the total duration indicator data is captured instead of all performance indicator data, which can reduce the amount of performance indicator data captured. Compared to completely giving up capturing the performance indicator data of the frame, only capturing the total duration indicator data can reduce performance overhead while still providing valuable information to developers. This can help developers understand whether each frame performs tasks as expected, as well as the efficiency of frame processing, which is helpful for performance analysis and application optimization.

[0078] S205: Save all performance indicator data in the performance indicator information.

[0079] Specifically, if the total duration of a frame of the target thread exceeds the preset filtering threshold, it indicates that the processing time of the frame is abnormal, the user may experience lag and delay, and the frame needs to be optimized. Therefore, it is necessary to save all performance indicator data of the frame to analyze the application performance bottleneck and make further optimization.

[0080] It should be noted that when the total duration exceeds the filtering threshold (frame interval), this may affect the start or end time of the next frame, causing the next frame to fail to start on time according to the VSYNC signal. Even if the total duration indicator of the next frame itself is less than the filtering threshold, it may still not be completed within the second frame due to the long processing time of the previous frame. This will cause the frame rate to drop, and may cause freezes, dropped frames, etc.

[0081] When the processing time exceeds the frame interval, the frame rate is usually reduced. Specifically, when the processing time of a frame exceeds the frame interval, the display system will still display the content of the previous frame when the next VSYNC signal arrives, which leads to a reduction in the frame rate.

[0082] In this case, the general display system will not actively adjust the VSYNC signal interval, because the VSYNC signal is usually fixedly associated with the refresh rate of the display device. The display system will continue to run according to the original VSYNC signal interval, and try to execute each frame according to the signal. Taking a 60Hz terminal device as an example, ideally, 60 frames of picture tasks need to be executed per second. However, if in the actual operation process, because the processing time of some frames exceeds the frame interval time, these timeout frames will cause the subsequent frames to fail to start execution on time according to the time when the VSYNC signal is sent. In this case, the actual number of frames executed may be less than 60 frames, for example, only 50 frames of content can be executed.

[0083] In this case, although the actual execution time of subsequent frames cannot correspond to the VSYNC signal interval temporarily, after the developer optimizes the abnormal frame, as long as the total duration index of subsequent frames is less than the filtering threshold, it will correspond to the VSYNC signal interval again. Therefore, when the current frame is an abnormal frame, it does not affect the abnormal judgment process of subsequent frames.

[0084] See also Figure 5 , is an example diagram of the trace stack information of an optimized target thread provided in an embodiment of the present application.

[0085] like Figure 5 As shown, it is Figure 4 The trace stack information is optimized. Figure 5 The total duration indicator data (top stack) of normal frames (Frame1 and Frame2) and all performance indicator data of abnormal frames (Frame3) are retained, and the remaining performance indicator data of normal frames are discarded. Figure 4 Compared with , the amount of performance indicator data captured is significantly reduced.

[0086] In an embodiment of the present application, by obtaining the refresh rate supported by the terminal device, a preset filtering threshold is determined according to the refresh rate; the performance indicator information of a frame of the target thread is obtained and cached; if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded; if the total duration indicator in the performance indicator information exceeds the preset filtering threshold, all performance indicator data in the performance indicator information is saved. The present application can eliminate the performance indicator data that does not need to be concerned about in the target thread and only save the data with analysis value. Since the performance indicator data of the normal frame of the target thread is not fully saved, the amount of captured data can usually be reduced by about 70% or more, which not only saves memory and storage space, but also reduces the impact on system performance and power consumption.

[0087] See also Figure 6 , Figure 6A schematic diagram of the structure of a performance indicator capture device provided by an exemplary embodiment of the present application. The performance indicator capture device can be implemented as all or part of the device through software, hardware or a combination of both. The device 3 includes a data cache module 31 and a first storage module 32.

[0088] A data cache module 31 is used to obtain and cache the performance indicator information of a frame of the target thread;

[0089] The first saving module 32 is used to save the total duration indicator data and discard the remaining performance indicator data in the performance indicator information if the total duration indicator in the performance indicator information does not exceed a preset filtering threshold.

[0090] In some embodiments, the target thread changes periodically during the task processing process based on a refresh rate supported by the terminal device.

[0091] In some embodiments, Figure 7 As shown, the device 3 also includes:

[0092] A data marking module 33, used to set a start mark and an end mark at the beginning and end of frame processing in the target thread respectively;

[0093] The total duration indicator of each frame in the target thread is determined based on the corresponding start mark and end mark.

[0094] In some embodiments, Figure 7 As shown, the device 3 also includes:

[0095] The second saving module 34 is configured to save all performance indicator data in the performance indicator information if the total duration indicator in the performance indicator information exceeds a preset filtering threshold.

[0096] In some embodiments, Figure 7 As shown, the device 3 also includes:

[0097] The threshold configuration module 35 is used to obtain the refresh rate supported by the terminal device and determine the preset filtering threshold according to the refresh rate.

[0098] In some embodiments, the performance indicator information is trace information.

[0099] In some embodiments, the target thread is a main thread, a rendering thread, or a SurfaceFlinger thread.

[0100] In an embodiment of the present application, the performance indicator information of one frame of the target thread is obtained and cached; if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded; the present application can eliminate the performance indicator data that does not need to be paid attention to in the target thread, reduce the amount of data obtained, and improve the utilization rate of the data.

[0101] It should be noted that the performance indicator capture device provided in the above embodiment only uses the division of the above functional modules as an example when executing the performance indicator capture method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the performance indicator capture device provided in the above embodiment and the performance indicator capture method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.

[0102] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0103] The present application also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 1-Figure 5 The performance indicator capture method of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 5 The specific description of the illustrated embodiment will not be repeated here.

[0104] The present application also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 1-Figure 5 The performance indicator capture method of the embodiment shown in the figure can be found in the specific execution process. Figure 1-Figure 5 The specific description of the illustrated embodiment will not be repeated here.

[0105] See also Figure 8 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 400 may include: at least one processor 410 , at least one network interface 420 , a user interface 430 , a memory 440 , and at least one communication bus 450 .

[0106] The communication bus 450 is used to realize the connection and communication between these components.

[0107] The user interface 430 may include a display screen (Display) and a camera (Camera), and the optional user interface 430 may also include a standard wired interface and a wireless interface.

[0108] The network interface 420 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0109] Among them, the processor 410 may include one or more processing cores. The processor 410 uses various interfaces and lines to connect various parts within the entire electronic device 400, and executes various functions and processes data of the electronic device 400 by running or executing instructions, programs, code sets or instruction sets stored in the memory 440, and calling data stored in the memory 440. Optionally, the processor 410 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 410 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 410, and it can be implemented separately through a chip.

[0110] Among them, the memory 440 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 440 includes a non-transitory computer-readable storage medium. The memory 440 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 440 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 440 may also be optionally at least one storage device located away from the aforementioned processor 410. As Figure 8 As shown, the memory 440 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a performance indicator capture program.

[0111] exist Figure 8 In the electronic device 400 shown, the user interface 430 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 410 can be used to call the performance indicator capture program stored in the memory 440 and specifically perform the following operations:

[0112] Obtain the performance indicator information of one frame of the target thread and cache it;

[0113] If the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded.

[0114] In some embodiments, the target thread changes periodically during the task processing process based on a refresh rate supported by the terminal device.

[0115] In some embodiments, before obtaining and caching the performance indicator information of a frame of the target thread, the processor 410 further performs the following operations:

[0116] Setting a start mark and an end mark at the beginning and the end of frame processing in the target thread respectively;

[0117] The total duration indicator of each frame in the target thread is determined based on the corresponding start mark and end mark.

[0118] In some embodiments, the processor 410 further performs the following operations:

[0119] If the total duration indicator in the performance indicator information exceeds a preset filtering threshold, all performance indicator data in the performance indicator information are saved.

[0120] In some embodiments, before obtaining and caching the performance indicator information of a frame of the target thread, the processor 410 further performs the following operations:

[0121] Obtain a refresh rate supported by the terminal device, and determine the preset filtering threshold according to the refresh rate.

[0122] In some embodiments, the performance indicator information is trace information.

[0123] In some embodiments, the target thread is a main thread, a rendering thread, or a SurfaceFlinger thread.

[0124] In an embodiment of the present application, the performance indicator information of one frame of the target thread is obtained and cached; if the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded; the present application can eliminate the performance indicator data that does not need to be paid attention to in the target thread, reduce the amount of data obtained, and improve the utilization rate of the data.

[0125] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0126] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A performance indicator capture method, characterized in that: The method comprises: Obtain the performance indicator information of one frame of the target thread and cache it; If the total duration indicator in the performance indicator information does not exceed the preset filtering threshold, the total duration indicator data is saved and the remaining performance indicator data in the performance indicator information is discarded.

2. The method according to claim 1, characterized in that The target thread changes periodically in the task processing flow based on the refresh rate supported by the terminal device.

3. The method according to claim 1, characterized in that Before obtaining the performance indicator information of a frame of the target thread and caching it, it also includes: Setting a start mark and an end mark at the beginning and the end of frame processing in the target thread respectively; The total duration indicator of each frame in the target thread is determined based on the corresponding start mark and end mark.

4. The method according to claim 1, characterized in that: The method further comprises: If the total duration indicator in the performance indicator information exceeds a preset filtering threshold, all performance indicator data in the performance indicator information are saved.

5. The method according to claim 2, characterized in that: Before obtaining the performance indicator information of a frame of the target thread and caching it, it also includes: Obtain a refresh rate supported by the terminal device, and determine the preset filtering threshold according to the refresh rate.

6. The method according to claim 1, characterized in that The performance indicator information is trace information.

7. The method according to claim 1, characterized in that The target thread is a main thread, a rendering thread or a SurfaceFlinger thread.

8. A performance index capturing device, characterized in that: The device comprises: A data cache module is used to obtain and cache the performance indicator information of a frame of the target thread; The first saving module is used to save the total duration indicator data and discard the remaining performance indicator data in the performance indicator information if the total duration indicator in the performance indicator information does not exceed a preset filtering threshold.

9. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions, which are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 7.

10. An electronic device, characterized in that: include: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the method steps as claimed in any one of claims 1 to 7.