Data processing method and device, electronic equipment and storage medium
By replacing the operating system's screen rendering function as a proxy rendering function, combined with time-consuming statistics, the cause of the operating system's screen rendering exception is determined, which solves the problem of slow or unresponsive screen update speed and improves rendering and update efficiency.
Patent Information
- Application Number
- CN202310518622.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2024-11-12
AI Technical Summary
The abnormal screen rendering process of the operating system results in slow or unresponsive screen update speed, and lack of effective analysis methods.
By replacing the operating system's native screen rendering function as a proxy rendering function, the proxy rendering function includes screen rendering function and time-consuming statistical function, and counts the time-consuming process of screen rendering to determine the cause of screen rendering exceptions.
It improves the screen rendering efficiency of the operating system, improves the screen update efficiency, and avoids the problem of unresponsive interface.
Smart Images

Figure CN118939351A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art
[0002] When the application is running, each time the screen is updated based on user operations, the main process of the application and the operating system where the application is located cooperate with each other to draw and render the screen, thereby updating the screen. The study found that if the screen rendering process of the operating system is abnormal, it may cause the screen to update slowly or even become unresponsive. Summary of the invention
[0003] The embodiments of the present disclosure provide a data processing method, device, electronic device and storage medium, which can determine the cause of abnormal screen rendering of an operating system, improve the screen rendering efficiency of the operating system, improve the screen update efficiency, and avoid screen unresponsiveness.
[0004] In a first aspect, an embodiment of the present disclosure provides a data processing method, including:
[0005] Get the first screen rendering function used to render the screen in the operating system;
[0006] The first screen rendering function is replaced by a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0007] In response to the screen rendering instruction of the application, the proxy rendering function is executed, the screen is rendered by the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted by the time consumption statistics function; the statistically obtained time consumption is used to determine the cause of the screen rendering abnormality of the operating system.
[0008] In a second aspect, an embodiment of the present disclosure provides a data processing device, including:
[0009] An acquisition unit, used for acquiring a first screen rendering function for rendering a screen in an operating system;
[0010] A replacement unit, used to replace the first screen rendering function with a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0011] An execution unit is used to respond to a screen rendering instruction of an application program, execute the proxy rendering function, render the screen through the second screen rendering function, and count the time consumed by the screen rendering process in at least one rendering performance dimension through the time consumption statistics function; the time consumption obtained by statistics is used to determine the cause of the screen rendering abnormality of the operating system.
[0012] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, enable the processor to implement the steps of the method described in the first aspect above.
[0013] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the steps of the method described in the first aspect above.
[0014] In one or more embodiments of the present disclosure, a first screen rendering function for rendering a screen in an operating system is obtained, and the first screen rendering function is replaced with a proxy rendering function, the proxy rendering function includes a second screen rendering function and a time consumption statistics function, the second screen rendering function is used to render the screen, and the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension, and in response to a screen rendering instruction of an application, the proxy rendering function is executed, the screen is rendered through the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted through the time consumption statistics function, and the statistically obtained time consumption is used to determine the cause of the abnormal screen rendering of the operating system. It can be seen that through this embodiment, the proxy rendering function can be used to replace the first screen rendering function, the screen is rendered through the proxy rendering function and the time consumption of the screen rendering process in at least one rendering performance dimension is counted, and the cause of the abnormal screen rendering of the operating system is determined based on the statistically obtained time consumption, which is usually the cause of the unresponsiveness in the interface rendering process, thereby laying a foundation for improving the screen rendering efficiency of the operating system, improving the screen update efficiency, and avoiding the interface being unresponsive. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate one or more embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor.
[0016] Figure 1 A flowchart of a data processing method provided by an embodiment of the present disclosure;
[0017] Figure 2 A schematic diagram of the structure of a data processing device provided by an embodiment of the present disclosure;
[0018] Figure 3 A schematic diagram of the structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on one or more embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the present disclosure.
[0020] The various embodiments of the present disclosure provide a data processing method that can determine the cause of abnormal screen rendering of the operating system, thereby improving the screen rendering efficiency of the operating system and improving the screen update efficiency. The method can be applied to a terminal device and executed by the terminal device. The terminal devices involved in the various embodiments of the present disclosure include but are not limited to mobile phones, computers, tablet computers, car computers and other terminal devices. An operating system and an application are running on the terminal device. The operating system can be any operating system such as Android, IOS, etc. The application can be any program that can update the screen, such as a short video program, an instant messaging program, etc. The application can also be a small program, such as a short video small program, an instant messaging small program, a shopping small program, etc. The application can be used as long as it can update the screen during user use.
[0021] In the existing technology, taking the Android system as an example, starting from Android 3.0, the drawing efficiency can be improved through hardware acceleration. Each frame of the screen is drawn by the main thread of the application, and then handed over to the rendering thread RenderThread of the operating system for rendering. When the main thread submits the rendering task to the rendering thread RenderThread, a synchronization process may be required, and this synchronization process may last for a long time and is completely black box to the application layer. Therefore, this process is likely to cause the application to be unresponsive and there is currently no good and effective analysis method at the application layer.
[0022] Based on this, an embodiment of the present disclosure provides a data processing method. Figure 1 A flowchart of a data processing method provided by an embodiment of the present disclosure is shown in FIG. Figure 1 As shown, the process is executed by the terminal device and includes:
[0023] Step S102, obtaining a first screen rendering function for rendering a screen in the operating system;
[0024] Step S104, replacing the first screen rendering function with a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0025] Step S106, in response to the screen rendering instruction of the application, execute the proxy rendering function, render the screen through the second screen rendering function, and use the time consumption statistics function to count the time consumption of the screen rendering process in at least one rendering performance dimension; the statistically obtained time consumption is used to determine the cause of the screen rendering abnormality of the operating system.
[0026] In this embodiment, a first screen rendering function for rendering a screen in an operating system is obtained, and the first screen rendering function is replaced with a proxy rendering function, the proxy rendering function includes a second screen rendering function and a time consumption statistics function, the second screen rendering function is used to render a screen, and the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension, and in response to a screen rendering instruction of an application, the proxy rendering function is executed, the screen is rendered through the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted through the time consumption statistics function, and the statistically obtained time consumption is used to determine the cause of the abnormal screen rendering of the operating system. It can be seen that through this embodiment, the proxy rendering function can be used to replace the first screen rendering function, the screen is rendered through the proxy rendering function and the time consumption of the screen rendering process in at least one rendering performance dimension is counted, and the cause of the abnormal screen rendering of the operating system is determined based on the statistically obtained time consumption, which is usually the cause of the unresponsiveness in the interface rendering process, thereby laying a foundation for improving the screen rendering efficiency of the operating system, improving the screen update efficiency, and avoiding the interface being unresponsive.
[0027] The method in this embodiment can be integrated into an application in the form of a plug-in. When the terminal device installs the application and starts the application, the terminal device can execute the above method flow to realize data processing. The data processing method in the embodiment of the present disclosure is described in detail below.
[0028] In the above step S102, a first screen rendering function for rendering the screen in the operating system is obtained. The first screen rendering function may be a native rendering function of the operating system. For example, when the operating system is an Android system, the first screen rendering function may be a rendering function threadLoop function in a rendering class RenderThread class corresponding to a rendering thread.
[0029] In the above step S104, the first screen rendering function is replaced by a proxy rendering function, the proxy rendering function includes a second screen rendering function and a time consumption statistics function, the second screen rendering function is used to render the screen, and the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension.
[0030] Specifically, when the application starts, steps S102 and S104 can be executed to replace the first screen rendering function with the proxy rendering function. When the application exits, the proxy rendering function is replaced with the first screen rendering function, so that the proxy rendering function is used to render the screen and count the time consumption while the user operates the application.
[0031] The proxy rendering function includes a second screen rendering function and a time consumption statistics function. The second screen rendering function has the same function as the first rendering function, and both are used to render the screen. The time consumption statistics function is used to count the time consumed by the screen rendering process in at least one rendering performance dimension. The at least one rendering performance dimension includes at least one of the total dimension of rendering the screen, the CPU (Central Processing Unit) dimension, the disk access IO (Input / Output) dimension, and the sleep time consumption dimension.
[0032] In one embodiment, the second screen rendering function is generated by the following steps:
[0033] Get the screen rendering method in the operating system; the screen rendering method is a private method of the operating system;
[0034] Based on the screen rendering method, a second screen rendering function is constructed; the second screen rendering function accesses the screen rendering method based on a way of accessing a private method of the operating system to render the screen.
[0035] Specifically, the native screen rendering method in the operating system is obtained. The method may be a screen rendering method in a rendering function threadLoop function, such as a run method. The screen rendering method is a private method of the operating system, specifically a private method of a rendering class RenderThread class corresponding to the rendering thread.
[0036] Next, a second screen rendering function is constructed according to the screen rendering method. Since the screen rendering method is a private method of the operating system, the second screen rendering function can be constructed based on the way of accessing the private method of the operating system, so that the second screen rendering function accesses the screen rendering method based on the way of accessing the private method of the operating system to render the screen. The way of accessing the private method of the operating system can be any method, which is not limited here.
[0037] It can be seen that through this embodiment, it is possible to avoid the access restrictions of the private attributes of the operating system and construct a second screen rendering function based on the way of accessing the private methods of the operating system, so that the second screen rendering function accesses the screen rendering method based on the way of accessing the private methods of the operating system to render the screen, thereby realizing the construction of the second screen rendering function.
[0038] Further, in one embodiment, the proxy rendering function is generated by the following steps:
[0039] In the second screen rendering function, inserting a time-consuming statistics function at the start position and the end position of the screen rendering method respectively;
[0040] Generate a proxy rendering function according to the second screen rendering function in which the time-consuming statistics function is inserted.
[0041] The time-consuming statistics function may be a time acquisition function such as the clock_gettime function, through which the time can be acquired. In the second screen rendering function, the time-consuming statistics function is inserted at the start position of the screen rendering method and the end position of the screen rendering method, respectively. Therefore, the start time and the end time of the screen rendering can be counted by the time-consuming statistics function, and the screen rendering time can be obtained by calculating the difference. In addition, a proxy rendering function is generated according to the second screen rendering function into which the time-consuming statistics function is inserted. For example, the second screen rendering function into which the time-consuming statistics function is inserted is determined as a proxy rendering function.
[0042] It can be seen that through this embodiment, the proxy rendering function can be generated by inserting the time-consuming statistical function at the starting position and the ending position of the screen rendering method respectively, which has the advantage of simple and efficient generation of the proxy rendering function.
[0043] In one embodiment, in the above step S104, replacing the first screen rendering function with the proxy rendering function includes:
[0044] In the virtual function table of the operating system, the first storage address of the first screen rendering function in the operating system is replaced with the second storage address of the proxy rendering function in the operating system.
[0045] Specifically, by hooking the virtual function table, in the virtual function table of the operating system, the first storage address of the first screen rendering function in the operating system is replaced with the second storage address of the proxy rendering function in the operating system. Hook is equivalent to a hook. The specific explanation is as follows. Therefore, when the terminal device needs to render the screen, the second storage address of the proxy rendering function in the operating system will be read in the virtual function table, so as to execute the proxy rendering function to render the screen and count the time consumed.
[0046] It can be seen that through this embodiment, the first screen rendering function can be replaced by the proxy rendering function by hooking the virtual function table. The technical solution is simple, efficient and easy to implement.
[0047] In one embodiment, in a virtual function table of the operating system, replacing a first storage address of the first screen rendering function in the operating system with a second storage address of the proxy rendering function in the operating system includes:
[0048] In the virtual function table of the operating system, searching for the value recorded in the preset position, and using the found value as the first storage address of the first screen rendering function in the operating system;
[0049] In the virtual function table of the operating system, the value recorded in the preset position is modified to the second storage address, so as to replace the first storage address with the second storage address.
[0050] The preset position may be the position where the rendering function threadloop function is located in the virtual function table. Specifically, in the virtual function table of the operating system, the position where the rendering function threadloop function is located in the hook virtual function table is used, and the value recorded in the position is used as the first storage address of the first screen rendering function in the operating system, and then, in the virtual function table of the operating system, the value recorded in the position is modified to the second storage address of the proxy rendering function in the operating system, so as to replace the first storage address with the second storage address. The proxy rendering function may be called the proxy_threadloop function.
[0051] It can be seen that through this embodiment, the value recorded in the preset position can be found in the virtual function table of the operating system, and the found value can be used as the first storage address, thereby replacing the first storage address with the second storage address, and the implementation process is simple and efficient.
[0052] For the explanation of hook, please refer to the prior art: Hook is a mechanism for Windows message processing. The hook mechanism allows the application to intercept messages or specific events, that is, the hook function first obtains control. The hook function can change the message, or continue to pass the message without processing, or force the message to end. In this embodiment, the first rendering function is replaced by the proxy rendering function through the hook principle.
[0053] In one embodiment, replacing the first screen rendering function with the proxy rendering function includes:
[0054] Before the class to which the first screen rendering function belongs is initialized, the first screen rendering function is replaced with the proxy rendering function.
[0055] Normally, after the class to which the first screen rendering function belongs is initialized, the first screen rendering function will be executed immediately, which may easily cause the first screen rendering function to render the screen instead of the proxy rendering function. Based on this, before the class to which the first screen rendering function belongs is initialized, the first screen rendering function is replaced with the proxy rendering function to ensure the success rate of rendering the screen using the proxy rendering function and avoid rendering the screen by the first screen rendering function.
[0056] In a specific example, the first screen rendering function may be a rendering function threadLoop function in a rendering class RenderThread class corresponding to the rendering thread. Considering that the threadloop function will be executed immediately after a rendering instance, such as a RenderThread instance, is initialized, and the RenderThread instance initialization occurs when the first window needs to draw the first frame after the application is started, in order to ensure that the proxy rendering function can successfully replace the first screen rendering function and use the proxy rendering function to render the screen, in this embodiment, before the class to which the first screen rendering function belongs, such as the RenderThread class, is initialized, the first screen rendering function is replaced with the proxy rendering function, thereby avoiding the threadloop function from rendering the screen.
[0057] It can be seen that through this embodiment, the first screen rendering function can be replaced with the proxy rendering function before the class to which the first screen rendering function belongs is initialized, thereby ensuring the success rate of rendering the screen using the proxy rendering function and avoiding rendering the screen by the first screen rendering function.
[0058] In one embodiment, the above steps S102 and S104 may be executed by a specific plug-in in the application, and step S106 may be executed by the operating system of the terminal device.
[0059] In the above step S106, after the application determines that the screen needs to be updated based on the user operation, it will draw the updated screen and send a screen rendering instruction to the operating system so that the operating system renders the screen and completes the screen update. Based on this, the operating system responds to the screen rendering instruction of the application, executes the proxy rendering function, renders the screen through the second screen rendering function in the proxy rendering function, and counts the time consumed by the screen rendering process in at least one rendering performance dimension through the time consumption statistics function in the proxy rendering function. The terminal device can determine the cause of the abnormal screen rendering of the operating system based on the statistically obtained time consumption, or the terminal device can send the statistically obtained time consumption to the server, and the server determines the cause of the abnormal screen rendering of the operating system.
[0060] As described above, the second screen rendering function accesses the screen rendering method to render the screen based on the way of accessing the private method of the operating system. Based on this, in one embodiment, rendering the screen through the second screen rendering function includes:
[0061] Access the screen rendering method in the second screen rendering function based on the way of accessing the private method of the operating system;
[0062] Render to the screen via the screen rendering method.
[0063] Specifically, in this embodiment, the screen needs to be rendered through a screen rendering method such as the run method, and this method is a private method of the operating system. Therefore, based on the way of accessing the private method of the operating system, the screen rendering method in the second screen rendering function is accessed, and the screen is rendered through the screen rendering method. The way of accessing the private method of the operating system can be any way, which is not limited here.
[0064] It can be seen that through this embodiment, the screen rendering method in the second screen rendering function can be accessed based on the way of accessing the private method of the operating system, and the screen can be rendered through the screen rendering method, thereby avoiding the limitations of the operating system's private method and realizing the rendering of the screen through the second screen rendering function.
[0065] As mentioned above, the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension, and the at least one rendering performance dimension includes at least one of the total dimension of the rendered screen, the CPU (Central Processing Unit) dimension, the disk access IO (Input / Output) dimension, and the sleep time consumption dimension. Based on this, in one embodiment, the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension, including:
[0066] At least one of the following information is counted through the time consumption statistics function: the total time consumption for rendering the screen, the CPU time consumption during the screen rendering process, the disk access time consumption during the screen rendering process, and the sleep time consumption during the screen rendering process.
[0067] Specifically, through the time consumption statistics function, at least one of the total time consumption for rendering one frame of the screen, the CPU time consumption during the process of rendering one frame of the screen, the IO time consumption during the process of rendering one frame of the screen, and the sleep time consumption during the process of rendering one frame of the screen can be counted. In addition, the sum of the CPU time consumption, the IO time consumption, and the sleep time consumption is equal to the total time consumption for rendering one frame of the screen.
[0068] In a specific implementation, one or more time-consuming statistical functions may be set in the proxy rendering function to count one or more of the above time consumptions. Furthermore, during the running of the application, one or more of the above time consumptions may be counted each time a frame of the screen is rendered.
[0069] It can be seen that through this embodiment, the time consumed by the screen rendering process in at least one rendering performance dimension can be counted, so as to determine the cause of the screen rendering abnormality of the operating system based on the time consumed in at least one rendering performance dimension, thereby avoiding interface unresponsiveness.
[0070] In one embodiment, the terminal device or the server can determine the cause of the screen rendering abnormality of the operating system based on the statistically obtained time consumption through the following steps:
[0071] Based on the statistically obtained time consumption, at least one of the following information is determined: the proportion of the CPU time consumption in the process of rendering the screen to the total time consumption of rendering the screen, the proportion of the disk access time consumption in the process of rendering the screen to the total time consumption of rendering the screen, and the proportion of the sleep time consumption in the process of rendering the screen to the total time consumption of rendering the screen;
[0072] Based on the determined information, determine the cause of the screen rendering abnormality of the operating system.
[0073] Specifically, after rendering multiple frames of the screen, the terminal device or server can count at least one of the first proportion of the CPU time consumed in the process of rendering each frame of the screen to the total time consumed in rendering the frame of the screen, the second proportion of the disk access time consumed in the process of rendering each frame of the screen to the total time consumed in rendering the frame of the screen, and the third proportion of the sleep time consumed in the process of rendering each frame of the screen to the total time consumed in rendering the frame of the screen. Each proportion is an average proportion obtained by statistics on the rendering process of multiple frames of the screen. For example, taking the rendering of fifty frames of the screen as an example, the first proportion can be the average value calculated from the proportion of the CPU time consumed in the process of rendering each frame of the screen to the total time consumed in rendering the frame of the screen (a total of 50 proportions).
[0074] Next, based on the determined information, determine the cause of the screen rendering anomaly of the operating system. If the first proportion is greater than the corresponding preset threshold, it means that the cause of the anomaly is that the CPU takes too long, and if the second proportion is greater than the corresponding preset threshold, it means that the cause of the anomaly is that the disk read and write takes too long. The number of abnormal causes located can be one or more.
[0075] It can be seen that through this embodiment, at least one of the above proportions can be determined based on the statistically obtained time consumption, and according to the determined information, the abnormal cause of the screen rendering abnormality of the operating system can be determined in a targeted manner, that is, the reason for the unresponsive screen is determined to avoid the unresponsive interface.
[0076] Furthermore, based on the determined abnormal reasons, the screen rendering efficiency of the operating system can be improved. For example, when the first proportion is found to be greater than the corresponding threshold, you can consider reducing the complexity of drawing, using the manufacturer's adjustment plan, adjusting the intimacy, etc. When the second proportion is found to be greater than the corresponding threshold, you can locate the optimization by hooking the io read write function. When the third proportion is found to be greater than the corresponding threshold, you can locate the optimization by memory monitoring.
[0077] It can be seen from the above process that this embodiment can count the time and time proportion of the screen rendering process in at least one rendering performance dimension. According to the comparison result of the time proportion with the corresponding threshold, the screen rendering efficiency of the operating system can also be improved.
[0078] In one embodiment, the terminal device can also upload the first return value and the second return value to the server at each drawing task to help refine the analysis of bottleneck points. The first return value can be the return value of canUnblockUiThread, and the second return value can be the return value of canDrawThisFrame. The return value of canUnblockUiThread indicates whether the main process of the application can be woken up before rendering the next frame of the screen. When the return value of canUnblockUiThread is not True, it means that the main process of the application can be woken up before the rendering thread Render Thread renders the next frame of the application window. Otherwise, it is necessary to wait until the Render Thread renders the next frame of the application window before waking up the main process of the application. The return value of canDrawThisFrame is used to indicate whether the next frame of the application needs to be rendered. When the value of canDrawThisFrame is false, it means that the next frame of the application does not need to be rendered.
[0079] In summary, through the method embodiments introduced above, a proxy rendering function can be used to replace the first screen rendering function. The screen is rendered by the proxy rendering function and the time consumed by the screen rendering process in at least one rendering performance dimension is counted. The cause of the screen rendering abnormality of the operating system is determined based on the statistically obtained time consumption. This cause is usually the reason for the unresponsiveness during the interface rendering process, thereby laying the foundation for improving the screen rendering efficiency of the operating system, improving the screen update efficiency, and avoiding interface unresponsiveness.
[0080] An embodiment of the present disclosure further provides a data processing device, Figure 2 A structural diagram of a data processing device provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the device comprises:
[0081] An acquisition unit 21 is used to acquire a first screen rendering function for rendering a screen in an operating system;
[0082] A replacement unit 22 is used to replace the first screen rendering function with a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0083] The execution unit 23 is used to respond to the screen rendering instruction of the application, execute the proxy rendering function, render the screen through the second screen rendering function, and count the time consumed by the screen rendering process in at least one rendering performance dimension through the time consumption statistics function; the statistically obtained time consumption is used to determine the cause of the screen rendering abnormality of the operating system.
[0084] Optionally, the method further includes a first generating unit, configured to:
[0085] Obtaining a screen rendering method in the operating system; the screen rendering method is a private method of the operating system;
[0086] Based on the screen rendering method, the second screen rendering function is constructed; the second screen rendering function accesses the screen rendering method to render the screen based on a way of accessing a private method of the operating system.
[0087] Optionally, the method further includes a second generating unit, configured to:
[0088] In the second screen rendering function, the time-consuming statistical function is respectively inserted at the starting position of the screen rendering method and the ending position of the screen rendering method;
[0089] The proxy rendering function is generated according to the second screen rendering function into which the time-consuming statistical function is inserted.
[0090] Optionally, the replacement unit 22 is specifically configured to:
[0091] In the virtual function table of the operating system, a first storage address of the first screen rendering function in the operating system is replaced with a second storage address of the proxy rendering function in the operating system.
[0092] Optionally, the replacement unit 22 is further specifically configured to:
[0093] In the virtual function table of the operating system, searching for a value recorded at a preset position, and using the found value as the first storage address of the first screen rendering function in the operating system;
[0094] In the virtual function table of the operating system, the value recorded in the preset position is modified to the second storage address, so as to replace the first storage address with the second storage address.
[0095] Optionally, the replacement unit 22 is specifically configured to:
[0096] Before the class to which the first screen rendering function belongs is initialized, the first screen rendering function is replaced with a proxy rendering function.
[0097] Optionally, the execution unit 23 is specifically configured to:
[0098] Accessing the screen rendering method in the second screen rendering function based on a way of accessing a private method of the operating system;
[0099] The screen is rendered by the screen rendering method.
[0100] Optionally, the execution unit 23 is specifically configured to:
[0101] At least one of the following information is counted through the time consumption statistics function: the total time consumption for rendering the screen, the CPU time consumption during the screen rendering process, the disk access time consumption during the screen rendering process, and the sleep time consumption during the screen rendering process.
[0102] Optionally, a positioning unit is further included, for:
[0103] Based on the statistically obtained time consumption, at least one of the following information is determined: the proportion of the CPU time consumption in the process of rendering the screen to the total time consumption of rendering the screen, the proportion of the disk access time consumption in the process of rendering the screen to the total time consumption of rendering the screen, and the proportion of the sleep time consumption in the process of rendering the screen to the total time consumption of rendering the screen;
[0104] According to the determined information, the cause of the screen rendering abnormality of the operating system is determined.
[0105] The device in the embodiment of the present disclosure can implement each process of the above-mentioned method embodiment and achieve the same effect and function, which will not be repeated here.
[0106] An embodiment of the present disclosure further provides an electronic device, Figure 3 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, such as Figure 3As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 301 and memory 302, and one or more applications or data may be stored in the memory 302. Among them, the memory 302 may be a temporary storage or a permanent storage. The application stored in the memory 302 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 301 may be configured to communicate with the memory 302 to execute a series of computer executable instructions in the memory 302 on the electronic device. The electronic device may also include one or more power supplies 303, one or more wired or wireless network interfaces 304, one or more input or output interfaces 305, one or more keyboards 306, etc.
[0107] In a specific embodiment, the electronic device includes a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor implements the following process:
[0108] Get the first screen rendering function used to render the screen in the operating system;
[0109] The first screen rendering function is replaced by a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0110] In response to the screen rendering instruction of the application, the proxy rendering function is executed, the screen is rendered by the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted by the time consumption statistics function; the statistically obtained time consumption is used to determine the cause of the screen rendering abnormality of the operating system.
[0111] The electronic device in the embodiment of the present disclosure can implement each process of the above-mentioned method embodiment and achieve the same effect and function, which will not be repeated here.
[0112] Another embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following process is implemented:
[0113] Get the first screen rendering function used to render the screen in the operating system;
[0114] The first screen rendering function is replaced by a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension;
[0115] In response to the screen rendering instruction of the application, the proxy rendering function is executed, the screen is rendered by the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted by the time consumption statistics function; the statistically obtained time consumption is used to determine the cause of the screen rendering abnormality of the operating system.
[0116] The storage medium in the embodiment of the present disclosure can implement each process of the above-mentioned method embodiment and achieve the same effect and function, which will not be repeated here.
[0117] In various embodiments of the present disclosure, the computer-readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0118] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0119] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0120] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0121] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of the present disclosure, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0122] Those skilled in the art will appreciate that one or more embodiments of the present disclosure may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0123] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0124] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0125] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0126] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0127] One or more embodiments of the present disclosure may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present disclosure may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0128] Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0129] The above description is only an embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims of the present disclosure.
Claims
1. A data processing method, characterized in that: include: Get the first screen rendering function used to render the screen in the operating system; Replacing the first screen rendering function with the proxy rendering function; The proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension; In response to the screen rendering instruction of the application, the proxy rendering function is executed, the screen is rendered by the second screen rendering function, and the time consumption of the screen rendering process in at least one rendering performance dimension is counted by the time consumption statistics function; the time consumption obtained by statistics is used to determine the cause of the screen rendering abnormality of the operating system.
2. The method according to claim 1, characterized in that: The second screen rendering function is generated by the following steps: Obtaining a screen rendering method in the operating system; the screen rendering method is a private method of the operating system; Based on the screen rendering method, the second screen rendering function is constructed; the second screen rendering function accesses the screen rendering method to render the screen based on a way of accessing a private method of the operating system.
3. The method according to claim 2, characterized in that The proxy rendering function is generated by the following steps: In the second screen rendering function, the time-consuming statistical function is respectively inserted at the starting position of the screen rendering method and the ending position of the screen rendering method; The proxy rendering function is generated according to the second screen rendering function into which the time-consuming statistical function is inserted.
4. The method according to claim 1, characterized in that: The replacing the first screen rendering function with the proxy rendering function includes: In the virtual function table of the operating system, a first storage address of the first screen rendering function in the operating system is replaced with a second storage address of the proxy rendering function in the operating system.
5. The method according to claim 4, characterized in that The step of replacing, in a virtual function table of the operating system, a first storage address of the first screen rendering function in the operating system with a second storage address of the proxy rendering function in the operating system comprises: In the virtual function table of the operating system, searching for a value recorded at a preset position, and using the found value as the first storage address of the first screen rendering function in the operating system; In the virtual function table of the operating system, the value recorded in the preset position is modified to the second storage address, so as to replace the first storage address with the second storage address.
6. The method according to claim 1, characterized in that The replacing the first screen rendering function with the proxy rendering function includes: Before the class to which the first screen rendering function belongs is initialized, the first screen rendering function is replaced with a proxy rendering function.
7. The method according to claim 2, characterized in that The rendering of the screen by the second screen rendering function includes: Accessing the screen rendering method in the second screen rendering function based on a way of accessing a private method of the operating system; The screen is rendered by the screen rendering method.
8. The method according to claim 1, characterized in that The counting of the time consumption of the screen rendering process in at least one rendering performance dimension by the time consumption statistical function includes: At least one of the following information is counted through the time consumption statistics function: the total time consumption for rendering the screen, the CPU time consumption during the screen rendering process, the disk access time consumption during the screen rendering process, and the sleep time consumption during the screen rendering process.
9. The method according to claim 8, characterized in that The cause of the screen rendering abnormality of the operating system is determined based on the statistically obtained time consumption through the following steps: Based on the statistically obtained time consumption, at least one of the following information is determined: the proportion of the CPU time consumption in the process of rendering the screen to the total time consumption of rendering the screen, the proportion of the disk access time consumption in the process of rendering the screen to the total time consumption of rendering the screen, and the proportion of the sleep time consumption in the process of rendering the screen to the total time consumption of rendering the screen; According to the determined information, the cause of the screen rendering abnormality of the operating system is determined.
10. A data processing device, characterized in that: include: An acquisition unit, used for acquiring a first screen rendering function for rendering a screen in an operating system; A replacement unit, used to replace the first screen rendering function with a proxy rendering function; the proxy rendering function includes a second screen rendering function and a time consumption statistics function; the second screen rendering function is used to render the screen; the time consumption statistics function is used to count the time consumption of the screen rendering process in at least one rendering performance dimension; An execution unit is used to respond to a screen rendering instruction of an application program, execute the proxy rendering function, render the screen through the second screen rendering function, and count the time consumed by the screen rendering process in at least one rendering performance dimension through the time consumption statistics function; the time consumption obtained by statistics is used to determine the cause of the screen rendering abnormality of the operating system.
11. An electronic device, characterized in that: include: processor; as well as, A memory configured to store computer executable instructions, which, when executed, cause the processor to implement the steps of the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement the steps of the method described in any one of claims 1 to 9.
