Picture monitoring method and device, electronic equipment and storage medium
The image monitoring method using Hook technology addresses the inefficiencies in image management by tracking and locating abnormal image instances, enhancing application performance through comprehensive image monitoring.
Patent Information
- Application Number
- CN202510373966.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-07-15
AI Technical Summary
In the prior art, images are difficult to be accurately monitored in applications, and developers cannot determine the source and name of the images, making it difficult to accurately monitor the images.
The Hook technology intercepts the creation and setting methods of the image instance, obtain the location and resource status information of the image instance, and combine preset detection rules to dynamically monitor the status of the image instance and locate it.
Dynamic monitoring and location tracking of image instances are realized, which can accurately determine the source and status of the image, optimize memory usage, and avoid memory overflow and performance bottlenecks.
Smart Images

Figure CN120316745A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer image processing, and more particularly, to a picture monitoring method, device, electronic device and storage medium. Background Art
[0002] Pictures are an important factor affecting application performance. Reading pictures from disk to memory consumes a lot of CPU resources; when pictures need to be displayed, the pictures will request decoding, and the decoded pictures will be saved in the memory space and occupy a lot of memory space. In the process of implementing the present invention, the inventors found that when developers optimize the performance of an application, they often need to optimize pictures, but there is often a lack of perfect tools for troubleshooting, and there is also a lack of monitoring of pictures existing in memory. As a result, for developers, they only know how much memory a picture occupies, but they cannot determine the source and name of the picture, making it difficult to accurately monitor pictures. Summary of the Invention
[0003] The present invention aims to overcome at least one defect of the above-mentioned prior art, and provides a picture monitoring method, device, electronic device and storage medium for solving the problem that pictures are difficult to be accurately monitored in an application.
[0004] According to a first aspect of the present application, a picture monitoring method is provided. The monitoring method includes: Obtaining the location information and resource status information of all picture instances; When setting the picture instance in the picture view, updating the resource status information of the set picture instance; Obtaining the picture parameter information of the picture instance, and using a preset method for obtaining view attribute information, obtaining the view attribute information corresponding to the picture view according to the picture parameter information of the picture instance; According to a preset detection rule, obtaining the status of the picture instance according to the resource status information and the view attribute information of the picture view of the picture instance; Locating the picture instance in an abnormal state according to the location information of the picture instance.
[0005] Optionally, the obtaining the location information and resource status information of all picture instances specifically includes: Initializing the location information and resource status information of the picture instance; Capturing the picture instance creation method through Hook; When creating the picture instance through the picture instance creation method, intercepting the created picture instance through Hook and obtaining the location data and status data of the created picture instance; Update the location information according to the location data, and update the resource status information according to the status data.
[0006] Optionally, updating the resource status information of the set picture instance specifically includes: Capture the picture setting method of the picture view through Hook; When setting a picture instance in the picture view through the picture setting method, intercept the status data of the set picture instance through Hook; Update the corresponding resource status information according to the status data of the set picture instance.
[0007] Optionally, the detection rule includes a selection strategy and a detection strategy; Obtaining the status of the picture instance according to the resource status information of the picture instance and the view attribute information of the picture view according to the preset detection rule specifically includes: According to the selection strategy in the detection rule, select the specified picture instance from all the picture instances as the picture instance to be detected, and use the picture view corresponding to the picture instance to be detected as the picture view to be detected; According to the detection strategy in the detection rule, obtain the status of the picture instance to be detected according to the resource status information of the picture instance to be detected and the view attribute information of the picture view to be detected.
[0008] Optionally, the selection strategy is global selection or page selection; The step of selecting the specified picture instance from all the picture instances as the picture instance to be detected according to the selection strategy in the detection rule, and using the picture view corresponding to the picture instance to be detected as the picture view to be detected specifically includes: When the selection strategy is global selection, use all the picture instances as the picture instances to be detected, and use the picture view corresponding to the picture instances to be detected as the picture views to be detected; When the selection strategy is page selection, use the picture instances included in the specified page as the picture instances to be detected, and use the picture view corresponding to the picture instances to be detected as the picture views to be detected.
[0009] Optionally, the view attribute information includes the size ratio between the picture instance and the picture view, the visibility of the picture view, and the decoded memory size of the picture instance; The resource status information includes the instance usage status, the instance decoding status, the loading thread and the loading time consumption.
[0010] Optionally, the detection strategy includes one or a combination of more of a visibility detection strategy, a memory detection strategy, a main thread detection strategy, a time-consuming detection strategy, and a size detection strategy; Obtaining the status of the to-be-detected picture instance according to the detection strategy in the detection rule, based on the resource status information of the to-be-detected picture instance and the view attribute information of the to-be-detected picture view specifically includes: For the visibility detection strategy, obtaining the status of the to-be-detected picture instance according to the instance usage status of the to-be-detected picture instance and the visibility of the corresponding picture view of the to-be-detected picture view; For the memory detection strategy, obtaining the status of the corresponding to-be-detected picture instance according to the decoded memory size of the picture instance of the to-be-detected picture view; For the main thread detection strategy, obtaining the status of the to-be-detected picture instance according to the loading thread of the to-be-detected picture instance; For the time-consuming detection strategy, obtaining the status of the to-be-detected picture instance according to the loading time-consuming of the to-be-detected picture instance; For the size detection strategy, obtaining the status of the corresponding to-be-detected picture instance according to the size ratio between the picture instance and the picture view of the to-be-detected picture view.
[0011] According to a second aspect of the present application, there is provided a picture monitoring device, the monitoring device includes: A debugging attribute acquisition module, configured to acquire the position information and resource status information of all picture instances; A debugging attribute update module, configured to update the resource status information of the set picture instance when setting the picture instance in the picture view; A view attribute acquisition module, configured to acquire the picture parameter information of the picture instance, and use a preset acquisition method for view attribute information to acquire the view attribute information of the corresponding picture view according to the picture parameter information of the picture instance; A status acquisition module, configured to acquire the status of the picture instance according to a preset detection rule, based on the resource status information of the picture instance and the view attribute information of the picture view; A picture positioning module, configured to position the picture instance in an abnormal state according to the position information of the picture instance.
[0012] According to a third aspect of the present application, there is provided an electronic device, including: A memory, configured to store one or more computer programs; A processor, when the one or more computer programs are executed by the processor, implementing the picture monitoring method described in the first aspect above.
[0013] According to the fourth aspect of the present application, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a picture monitoring method described in the first aspect above when executed.
[0014] Based on any of the above aspects, a picture monitoring method, apparatus, electronic device, and computer storage medium provided by the embodiments of the present application can dynamically intercept and obtain the position information and resource status information of a picture instance, and thus can dynamically determine the specific information of the picture corresponding to the picture instance; dynamically intercept and obtain the view attribute information of the picture view where the picture instance is set, and thus can dynamically obtain the status of the picture instance based on the resource status information and the view attribute information, and locate the picture instance in an abnormal state based on the position information of the picture instance, effectively realizing the monitoring and position tracking of the picture instance. Description of the Drawings
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for description in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0016] Figure 1 It is a schematic application scenario diagram of the monitoring method provided in this embodiment.
[0017] Figure 2 It is a flowchart of the monitoring method provided in this embodiment.
[0018] Figure 3 It is a schematic diagram of the sub-step process of step S1 provided in this embodiment.
[0019] Figure 4 It is a schematic diagram of the sub-step process of step S2 provided in this embodiment.
[0020] Figure 5 It is a schematic diagram of the sub-step process of step S3 provided in this embodiment.
[0021] Figure 6 It is a schematic diagram of the functional modules of the monitoring apparatus provided in this embodiment.
[0022] Figure 7 It is a schematic diagram of the structure of the electronic device provided in this embodiment. Detailed Embodiments
[0023] The accompanying drawings of this application are only for illustrative purposes and should not be construed as a limitation on this application. To better illustrate the following embodiments, some components in the drawings will be omitted, enlarged, or reduced, which does not represent the dimensions of the actual product; for those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0024] In order to enable those skilled in the art of this technology to better understand the solution of this application, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only some of the embodiments of this application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.
[0025] It should be noted that the terms "first", "second", etc. in the specification, claims, and the above-mentioned accompanying drawings of this application are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0026] With the continuous development of digital technology, application programs have gradually been integrated into people's daily lives and production processes. At the same time, the functions of application programs have also been continuously enriched and improved. However, with the enrichment of the functions of application programs, the overhead occupied by application programs during operation has also continuously increased. Therefore, it is necessary to optimize the operation of application programs and improve the performance of application programs.
[0027] Among them, pictures are an important factor affecting the performance of application programs. Reading pictures from the disk to the memory consumes a relatively large amount of CPU (Central Processing Unit) resources; when pictures need to be displayed, the pictures will request decoding, and the decoded pictures will be stored in the memory space and occupy a relatively large amount of memory space. In the process of implementing the present invention, the inventor found that when developers optimize the performance of applications, they often need to optimize pictures, but often lack perfect tools for troubleshooting and lack monitoring of pictures existing in the memory. As a result, for developers, they only know how much memory a picture occupies, but cannot determine the source and name of the picture, and thus cannot track pictures that may be in an abnormal state, making it difficult to accurately monitor pictures.
[0028] This embodiment provides a technical solution that can solve the above problems. Next, in conjunction with the accompanying drawings, the specific implementation manners of the present application will be described in detail.
[0029] Exemplarily, Figure 1 FIG. is a schematic diagram of an application scenario of a picture monitoring method provided by an embodiment of the present application. As Figure 1 shown, the application scenario at least includes a server 100 and a terminal 200 that can communicate with the server 100.
[0030] It can be understood that the server 100 may be an independent electronic device or a cluster composed of multiple electronic devices; the terminal 200 may be a smart phone terminal, a personal computer, a tablet computer, a vehicle-mounted terminal, etc., but is not limited thereto.
[0031] In an implementable manner, the server 100 and the terminal 200 can respectively execute a picture monitoring method provided by an embodiment of the present application, or, optionally, a part of the picture monitoring method provided by an embodiment of the present application is executed in the server 100, and a part is executed in the terminal 200.
[0032] As Figure 2 shown, this embodiment provides a picture monitoring method, which may include the following steps: S1: Obtain the location information and resource status information of all picture instances; wherein, the picture instance represents a specific picture object loaded into the memory in the application program; It can be understood that the location information includes the location data of the picture instance, such as the picture storage address and picture name in the picture instance, etc., which is mainly used to record the picture source corresponding to the picture instance, facilitating the positioning and tracking of the picture instance source; the resource status information includes the status data of the picture instance, such as whether the picture instance has been decoded, whether it has been used, etc., and the resource status information is mainly used to record the application status of the picture instance in the application program.
[0033] In order to effectively solve the problem that it is difficult to track the picture instances loaded into the memory, this embodiment can use Hook to track the picture instances.
[0034] Specifically, Hook is a programming mechanism for an application. Through the Hook, developers are allowed to intercept, modify, or extend the system, methods, libraries, or default behavior events of the application during the compilation process. Its core content is to call the Hook program to "hook" at key nodes (such as events, function calls, message passing, etc.) and insert custom logic code to achieve monitoring, modification, or extension of the program behavior.
[0035] Among them, it mainly includes the following types: Function Hook: Intercept the call of a specific function, modify its parameters or return value, and is often used to modify the function behavior or insert additional logic.
[0036] Message Hook: Intercept system messages, modify the way of message passing or processing, and is often used to customize user interface behavior.
[0037] API Hook: Intercept the call of API functions, monitor or modify the behavior of the API, and is often used for debugging or extending system functions.
[0038] Event Hook: Intercept events in the application or framework, insert custom processing logic, and is often used for extending functions or modifying the response process. Specifically, in this embodiment, as Figure 3 shown, step S1 can specifically include the following steps: S11: Initialize the position information and resource status information of the picture instance; S12: Capture the picture instance creation method through Hook; S13: When creating the picture instance through the picture instance creation method, intercept the created picture instance through Hook, and obtain the position data and status data of the created picture instance; S14: Update the position information according to the position data, and update the resource status information according to the status data.
[0039] In one implementation manner of this embodiment, the initialization of the position information and resource status information in step S11 can specifically be to create a classification of the picture instance, define and declare the position information and the resource status information of the picture instance in the classification of the picture instance, and set corresponding acquisition methods; furthermore, in step S12, the picture instance creation method is captured through Hook. When the picture instance is created, Hook intercepts the picture instance creation method so that it can create the classification of the picture instance described above, which is equivalent to expanding and adding the position information and the resource status information in the picture instance; at the same time, in step S13, after using Hook to implement the creation of the classification of the picture instance, the specific position data and status data of the picture instance are obtained by using the acquisition methods of the position information and the resource status information; furthermore, in step S14, the obtained position data and status data are updated into the position information and the resource status information, and finally the binding of information such as the picture source and the picture application status to the picture instance is realized.
[0040] Specifically, in this embodiment, Hook is used to capture the picture instance creation method. By capturing the picture instance creation method, in any scenario, as long as the picture instance creation method is called, the creation event of the picture instance can be obtained by using Hook, and then the unified setting of all the picture instances can be realized. There is no need to add additional code at the call position of each picture instance creation method, which reduces the workload and can also avoid omissions, achieving the effect of adding the position information and the resource status information to all the picture instances. At the same time, adding the position information and the resource status information to all the picture instances can facilitate the subsequent determination of the application status of the picture instance and the tracking and positioning of the picture corresponding to the picture instance.
[0041] It should be noted that the above only lists a relatively general implementation manner and generally describes the implementation content of each step. In different compilation environments, the specific use of Hook may be somewhat different. Therefore, for some steps, or more specific implementations of the steps, such as the specific setting of the code, there may be differences and need to be specifically set according to the actual compilation environment. However, the overall implementation idea is the same as the steps of S11 - S14 above, so it will not be further elaborated.
[0042] S2: When setting the picture instance in the picture view, update the resource status information of the set picture instance; Specifically, in this embodiment, the picture view is a view container of the picture instance, mainly used to display the picture instance set therein.
[0043] In this embodiment, as Figure 4 described, step S2 may specifically include the following steps: S21: Capture the picture setting method of the picture view through Hook; S22: When setting a picture instance in the picture view through the picture setting method, intercept the status data of the set picture instance through Hook; S23: Update the corresponding resource status information according to the status data of the set picture instance.
[0044] Similar to the above step S1, in this embodiment, by hooking the picture setting method of the picture view, when it is necessary to set the picture instance in the picture view for display, first call the creation method of the picture view to create and initialize a picture view to accommodate the picture instance to be displayed, and then call the picture setting method of the picture view on this basis to set the picture instance to be displayed in the picture view. At this time, the setting event of the corresponding picture view can be intercepted through Hook, and then the picture instance set in the picture view can be determined through this setting event.
[0045] Meanwhile, it can be considered that when the picture instance is set in the picture view, the picture instance has been decoded and is about to be used, indicating that the application state of the picture instance has changed at this time. Therefore, in order to effectively monitor the application state of the picture instance, after intercepting the setting event, obtain the status data of the picture instance corresponding to this setting event, and update the resource status information of the picture instance through the status data to ensure that the resource status information of the picture instance is consistent with the actual application state of the picture instance.
[0046] S3: Obtain the picture parameter information of the picture instance, and use the preset method for obtaining view attribute information to obtain the view attribute information of the corresponding picture view according to the picture parameter information of the picture instance; In this embodiment, the picture parameter information includes at least the specific parameters of the picture instance, such as picture size and picture dimension, etc.; and the view attribute information mainly includes the attribute status after the picture instance is set in the picture view, such as the size ratio between the picture instance and the picture view, the visibility of the picture view, the decoding memory size of the picture instance, etc., which need to be calculated based on the specifically set picture instance.
[0047] In this embodiment, the setting of the view attribute information may refer to part of the descriptions in the above steps S11 - S14. Specifically, create a classification of the picture view, and define and declare the view attribute information of the picture view and the acquisition method of the view attribute information in the classification of the picture view.
[0048] Then in step S3, the corresponding view attribute information can be obtained through the acquisition method of the view attribute information in the classification of the picture view. Specifically, in one embodiment, the picture view can be obtained through Hook interception, and then according to the acquisition method of the view attribute information, using the picture parameter information of the corresponding picture instance, the view attribute information of the picture view to be detected can be obtained.
[0049] S4: According to the preset detection rules, obtain the status of the picture instance based on the resource status information of the picture instance and the view attribute information of the picture view; In this embodiment, the detection rules may include a selection strategy and a detection strategy; It can be understood that the selection strategy is mainly used to select the picture instances to be detected and the corresponding picture views to be detected from all the picture instances; the detection strategy is mainly used to guide the acquisition of the status of the picture instance.
[0050] Specifically, as Figure 5 shown, step S4 may specifically include the following steps: S41: According to the selection strategy in the detection rules, select the specified picture instances from all the picture instances as the picture instances to be detected, and use the picture views corresponding to the picture instances to be detected as the picture views to be detected; S42: According to the detection strategy in the detection rules, obtain the status of the picture instance to be detected based on the resource status information of the picture instance to be detected and the view attribute information of the picture view to be detected.
[0051] Further, in this embodiment, if the selection strategy is global selection or page selection, then step S41 is specifically: When the selection strategy is global selection, all the picture instances are used as the picture instances to be detected, and the picture views corresponding to the picture instances to be detected are used as the picture views to be detected; When the selection strategy is page selection, the picture instances included in the specified page are used as the picture instances to be detected, and the picture views corresponding to the picture instances to be detected are used as the picture views to be detected.
[0052] It is understandable that the global selection mainly selects all the picture instances loaded into the memory, obtains the states of all the picture instances in the memory, combines the position information of the picture instances, locates the sources of all the picture instances in the memory, and thus can obtain the detailed information of each picture instance in the memory; the page selection mainly selects all the picture instances in the specified page, and the specified page is usually the currently displayed page. After obtaining the picture instances in the specified page, the application states of the picture instances in the specified page can be determined, and thus it can be determined whether the settings of the picture instances in the specified page are reasonable.
[0053] In one implementation, the corresponding selection strategy can be used regularly to obtain the to-be-detected picture instance and the to-be-detected picture view. The regular time interval can be set according to the data volume of the picture instance to ensure that the detection of the to-be-detected picture instance and the to-be-detected picture view can be completed within the regular time interval.
[0054] Specifically, in this embodiment, the view attribute information may include attributes such as the size ratio between the picture instance and the picture view, the visibility of the picture view, and the decoded memory size of the picture instance. The resource status information may include status data such as the instance usage status, the instance decoding status, the loading thread, and the loading time consumption. It is understandable that for different view attribute information and different resource status information, the states of the picture instance and the picture view that can be represented are also different. Therefore, in step S42, corresponding view attributes need to be selected from the view attribute information of the to-be-detected picture view, and corresponding status data need to be selected from the resource status information of the to-be-detected picture instance according to the specific detection strategy to obtain the state of the corresponding to-be-detected picture instance.
[0055] Specifically, in this embodiment, the detection strategy may be one or a combination of a visibility detection strategy, a memory detection strategy, a main thread detection strategy, a time consumption detection strategy, and a size detection strategy; then the state acquisition of the to-be-detected picture instance may include the following: For the visibility detection strategy, the state of the to-be-detected picture instance is obtained according to the instance usage status of the to-be-detected picture instance and the visibility of the picture view of the corresponding to-be-detected picture view. Exemplarily, when the visibility of the picture view of the to-be-detected picture view is invisible, and the instance decoding status of the corresponding to-be-detected picture instance is decoded, it indicates that the state of the corresponding to-be-detected picture instance is a visibility exception state. It can be understood that when the visibility of the to-be-detected picture view is invisible, it means that the to-be-detected picture view is invisible at this time, and the instance decoding state of the corresponding to-be-detected picture instance is decoded, which means that the to-be-detected picture instance needs to be displayed. Then, the contradiction between the instance decoding state and the visibility of the to-be-detected picture view may be because the to-be-detected picture instance is not located within the current display window of the application, but is located on the current display page of the application, which means that the state of the to-be-detected picture instance is a visibility exception state. In the actual application process, it can be considered to temporarily remove the to-be-detected picture instance from the memory to optimize the use of memory.
[0056] For the memory detection strategy, obtain the state of the corresponding to-be-detected picture instance according to the decoded memory size of the picture instance of the to-be-detected picture view; Exemplarily, at preset time intervals, count the decoded memory sizes of each picture instance within each time interval to obtain the total memory occupancy. If the difference between the total memory occupancies within two consecutive time intervals exceeds a preset difference threshold, it means that the corresponding to-be-detected picture instance is in an abnormal memory growth state; It can be understood that if the difference in the total memory occupancy is greater than the preset threshold, it means that within the corresponding time, the growth situation of the memory occupied by the picture instance in the memory has become abnormal, which may lead to memory overflow. Therefore, by paying attention to the growth situation of the memory occupied by the to-be-detected picture instance, when the growth situation of the memory becomes abnormal, determine which creations of the to-be-detected picture instances cause the abnormality, and then be able to optimize the creation of the to-be-detected picture instances to avoid the occurrence of memory overflow.
[0057] For the main thread detection strategy, obtain the state of the to-be-detected picture instance according to the loading thread of the to-be-detected picture instance; Exemplarily, if the loading thread of the to-be-detected picture instance is the main thread, it means that the state of the corresponding to-be-detected picture instance is an abnormal main thread loading state; It can be understood that the main thread can only process one task at a time. If the picture instance is loaded on the main thread, then other tasks that need to be executed on the main thread must wait, which will reduce the efficiency of the application. Therefore, it is necessary to avoid loading the picture instance on the main thread, determine the picture instances that will be loaded on the main thread, and then avoid loading them onto the main thread again.
[0058] For the time-consuming detection strategy, obtain the state of the to-be-detected picture instance according to the loading time-consuming of the to-be-detected picture instance; Exemplarily, obtain the actual value of the loading time of the to-be-detected picture instance. If the actual value of the loading time exceeds a preset time threshold, it indicates that the corresponding to-be-detected picture instance is in an over-time loading state; It can be understood that if the picture instance is loaded in a thread, it will occupy the resources of that thread. If the picture instance is loaded for a long time in the thread, it will cause the thread to not be released for a long time to process other tasks, thereby reducing the efficiency of the application program. Therefore, it is necessary to process the picture instance with an overly long thread time-consuming to reduce its processing time in the thread and improve the efficiency of the application program.
[0059] For the size detection strategy, obtain the state of the corresponding to-be-detected picture instance according to the size ratio of the picture instance of the to-be-detected picture view to the picture view; Exemplarily, obtain the actual value of the size ratio of the picture instance of the to-be-detected picture instance to the picture view. If the actual value of the size ratio of the picture instance to the picture view is greater than a preset ratio, it indicates that the corresponding to-be-detected picture instance is in a size abnormal state; wherein, the preset ratio can be set to a value not exceeding 1. Preferably, the preset ratio is set to 1.
[0060] It can be understood that if the actual value of the size ratio of the picture instance to the picture view is greater than 1, it indicates that the size of the to-be-detected picture instance exceeds the size of the to-be-detected picture view, resulting in the picture corresponding to the to-be-detected picture instance exceeding the predetermined setting range when displayed on the page, affecting the visual experience of the page. Therefore, it is necessary to obtain the to-be-detected picture instance with the size ratio of the picture instance to the picture view greater than 1 and readjust the size of the picture corresponding to the to-be-detected picture instance.
[0061] In an alternative embodiment, the monitoring method may further include: Count the total number of the picture instances that have no association relationship with the picture view, and judge the state of the picture instance according to the total number.
[0062] It can be understood that usually, when the picture view is created, the corresponding picture instances are set therein at the same time. Therefore, if the picture instances are not associated with the picture view, it means that although these picture instances are loaded into the memory, they are not set into the picture view. Therefore, it means that these picture instances that occupy memory resources but are not set to be displayed in the picture view are in an idle state. If the picture instances are in an idle state for a long time, it can be considered to first move the picture instances in the idle state out of the memory, thereby reducing the memory pressure.
[0063] In an alternative embodiment, the monitoring method may further include: Obtain the status of the picture instance according to the picture parameter information of the picture instance; Exemplarily, such as detecting whether the memory after decoding the picture instance exceeds a preset memory threshold, checking whether the picture instance is byte-aligned, checking whether the number of frames of the picture instance exceeds a preset frame number threshold, etc.
[0064] S5: Locate the picture instances in an abnormal state according to the location information of the picture instances.
[0065] In this embodiment, step S5 can specifically be: Determine whether the status of the picture instance is an abnormal state. If the status of the picture instance is an abnormal state, locate the picture instances in an abnormal state according to the location information of the picture instance.
[0066] In this embodiment, the abnormal state may include the above-mentioned visibility abnormal state, memory growth abnormal state, main thread loading abnormal state, timeout loading state, size abnormal state, etc.
[0067] The location information of the picture instance includes the picture storage address and picture name of the picture corresponding to the picture instance. Therefore, when the to-be-detected picture instance or picture instances in the abnormal state are obtained, the picture source of the to-be-detected picture instance or picture instances can be quickly obtained according to the corresponding location information, and then the specific picture with problems can be located. Combining the abnormal state, the specific picture can be adjusted to effectively implement the monitoring of pictures.
[0068] As Figure 6 shown, an embodiment of the present application further provides a picture monitoring device. Optionally, the monitoring device may include a debugging attribute acquisition module 11, configured to acquire the location information and resource status information of all picture instances; In this embodiment, the debugging attribute acquisition module 11 can be used to execute Figure 2 the step S1 shown. The specific description of the debugging attribute acquisition module 11 can refer to the description of the step S1.
[0069] a debugging attribute update module 12, configured to update the resource status information of the set picture instance when setting the picture instance in the picture view; In this embodiment, the debugging attribute update module 12 can be used to execute Figure 2 the step S2 shown. The specific description of the debugging attribute update module 12 can refer to the description of the step S2.
[0070] A view property acquisition module 13, configured to acquire picture parameter information of the picture instance, and utilize a preset method for acquiring view property information to acquire view property information corresponding to the picture view according to the picture parameter information of the picture instance; In this embodiment, the view property acquisition module 13 can be used to execute Figure 2 step S3 shown. For a specific description of the view property acquisition module 13, reference can be made to the description of step S3.
[0071] A status acquisition module 14, configured to acquire the status of the picture instance according to the resource status information of the picture instance and the view property information of the picture view according to a preset detection rule; In this embodiment, the status acquisition module 14 can be used to execute Figure 2 step S4 shown. For a specific description of the status acquisition module 14, reference can be made to the description of step S4.
[0072] A picture positioning module 15, configured to position the picture instance in an abnormal state according to the position information of the picture instance; In this embodiment, the picture positioning module 15 can be used to execute Figure 2 step S5 shown. For a specific description of the picture positioning module 15, reference can be made to the description of step S5.
[0073] In an alternative embodiment, the picture monitoring device may further include a picture storage module 16, and the picture storage module is configured to store all the picture instances in the memory; The picture monitoring device may further include a timing module 17, configured to set a time interval for acquiring the to-be-detected picture instance, and the status acquisition module 14 can acquire the to-be-detected picture instance from the picture storage module 16 at the time interval set by the timing module 17.
[0074] In another alternative embodiment, a plurality of status acquisition units (not shown in the figure) may be provided in the status acquisition module 14, and each status acquisition unit can be specifically configured to execute one of the detection strategies, and can be correspondingly set according to the types of detection strategies set in this embodiment.
[0075] It can be understood that the above-mentioned device embodiment and the above-mentioned method embodiment can correspond to each other, and similar descriptions of the device embodiment can refer to the method embodiment. To avoid repetition, it will not be repeated here. A picture monitoring device provided in an embodiment of the present application can execute a picture monitoring method provided in any embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method. The functional modules of the picture monitoring device can be implemented in the form of hardware, can be implemented by instructions in the form of software, and can also be implemented by a combination of hardware and software modules.
[0076] Specifically, each step of the method embodiment of the present application can be completed by the hardware integrated logic circuit and / or software instructions in the processor. The steps of the picture monitoring method in combination with the embodiment of the present application can be directly embodied as a hardware encoding processor, or a combination of hardware and software modules in the encoding processor. Optionally, the software module can be located in a random access memory, a read-only memory, a programmable read-only memory, a flash memory, an electrically erasable programmable memory, a register, and other storage media. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in combination with its hardware.
[0077] The present application embodiment provides an electronic device, the structure of which is as follows: Figure 7 The electronic device may be Figure 1 The server 100 or the terminal 200 is shown.
[0078] like Figure 7 As shown, the electronic device includes a memory 21, a processor 22, a communication module 23 and an input / output interface 24, etc. Optionally, the memory 21, the processor 22, the communication module 23 and the input / output interface 24 can be connected and communicated through a bus 25.
[0079] The memory 21 is used to store one or more computer programs and transmit the code of the computer program to the processor 22; when the one or more computer programs are executed by the processor 22, the image monitoring method in the embodiment of the present application is implemented.
[0080] Optionally, the electronic device can be connected to a network via a communication module 23 to communicate with other devices, such as a terminal or a server, through the network to achieve data interaction. The electronic device can be various forms of digital computers, such as desktop computers, servers, workstations, mainframe computers or other types of computers. The electronic device can also be various forms of mobile terminals, such as smart phones, tablet computers, wearable devices (such as helmets, glasses, watches, etc.) and other similar mobile terminals.
[0081] Optionally, the electronic device may be connected to required input / output devices, such as a keyboard, a display device, etc., through the input / output interface 24. The electronic device itself may have a display device, and may also externally connect other display devices through the input / output interface 24. Optionally, a storage device, such as a hard disk, etc., may also be connected through the input / output interface 24, so that data in the electronic device can be stored in the storage device, or data in the storage device can be read, and data in the storage device can also be stored in the memory 21. It can be understood that the input / output interface 24 may be a wired interface or a wireless interface. According to different actual application scenarios, the device connected to the input / output interface 24 may be a component of the electronic device or an external device connected to the electronic device when needed.
[0082] Optionally, the memory 21 may be a volatile memory and / or a non-volatile memory. The volatile memory may be a random access memory, etc., and the non-volatile memory may be a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, or a flash memory, etc.
[0083] Optionally, the computer program stored in the processor 22 may be divided into one or more modules. The one or more modules are stored in the memory 21 and executed by the processor 22 to complete the method provided by the present embodiment itself. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the computer program instruction segments are used to describe the execution process of the computer program in the electronic device.
[0084] Optionally, the processor 22 may be various general-purpose and / or dedicated processing components with processing and computing capabilities. Some examples of the processor 22 include, but are not limited to, a central processing unit, a graphics processing unit, a digital signal processor, various dedicated artificial intelligence computing chips, various processors running machine learning model algorithms, and may also be any suitable controller, microcontroller, processor, etc. The processor 22 executes each method and process of the present embodiment. Exemplarily, such as a picture monitoring method of an embodiment of the present application.
[0085] Optionally, the bus 25 may include a path for transmitting information. The bus 25 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. According to different functions, the bus 25 may be divided into an address bus, a data bus, a control bus, etc.
[0086] In an alternative implementation, an embodiment of the present application further provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a computer, the computer can execute the method of the above method embodiment. Part or all of the computer program can be loaded and / or installed on the memory 21 of the electronic device. When the computer program is executed by the processor 22, one or more steps of a picture monitoring method according to an embodiment of the present application can be executed.
[0087] Optionally, the computer-readable storage medium may be a random access memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, etc.
[0088] Obviously, the above embodiments of the present application are merely examples for clearly illustrating the technical solutions of the present application, rather than limitations on the specific implementation manners of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the claims of the present application shall be included in the protection scope of the claims of the present application.
Claims
1. A method for picture monitoring, characterized in that, The monitoring method includes: Obtaining the location information and resource status information of all picture instances; When setting the picture instances in the picture view, updating the resource status information of the set picture instances; Obtaining the picture parameter information of the picture instances, and using a preset method for obtaining view attribute information to obtain the view attribute information corresponding to the picture view according to the picture parameter information of the picture instances; According to a preset detection rule, obtaining the status of the picture instances based on the resource status information and the view attribute information of the picture view of the picture instances; Locating the picture instances in an abnormal state according to the location information of the picture instances.
2. The picture monitoring method according to claim 1, characterized in that, The obtaining of the location information and resource status information of all picture instances specifically includes: Initializing the location information and resource status information of the picture instances; Capturing the picture instance creation method through Hook; When creating the picture instances through the picture instance creation method, intercepting the created picture instances through Hook and obtaining the location data and status data of the created picture instances; Updating the location information according to the location data and updating the resource status information according to the status data.
3. A method for picture monitoring according to claim 1, characterized in that, The updating of the resource status information of the set picture instances specifically includes: Capturing the picture setting method of the picture view through Hook; When setting a picture instance in the picture view through the picture setting method, intercepting the status data of the set picture instance through Hook; Updating the corresponding resource status information according to the status data of the set picture instance.
4. A method for picture monitoring according to any one of claims 1-3, characterized in that, The detection rule includes a selection strategy and a detection strategy; The obtaining of the status of the picture instances according to a preset detection rule based on the resource status information and the view attribute information of the picture view of the picture instances specifically includes: According to the selection strategy in the detection rule, selecting specified picture instances from all the picture instances as the picture instances to be detected, and using the picture view corresponding to the picture instances to be detected as the picture view to be detected; According to the detection strategy in the detection rule, obtaining the status of the picture instances to be detected based on the resource status information of the picture instances to be detected and the view attribute information of the picture view to be detected.
5. A method for picture monitoring according to claim 4, characterized in that, The selection strategy is global selection or page selection; The selecting of specified picture instances from all the picture instances as the picture instances to be detected according to the selection strategy in the detection rule, and using the picture view corresponding to the picture instances to be detected as the picture view to be detected specifically includes: When the selection strategy is global selection, using all the picture instances as the picture instances to be detected and using the picture view corresponding to the picture instances to be detected as the picture view to be detected; When the selection strategy is page selection, using the picture instances included in the specified page as the picture instances to be detected and using the picture view corresponding to the picture instances to be detected as the picture view to be detected.
6. A picture monitoring method according to claim 4, characterized in that, The view attribute information includes the size ratio between the picture instance and the picture view, the visibility of the picture view, and the decoded memory size of the picture instance; The resource status information includes the instance usage status, the instance decoding status, the loading thread, and the loading time consumption.
7. A picture monitoring method according to claim 6, wherein The detection strategy includes one or a combination of a visibility detection strategy, a memory detection strategy, a main thread detection strategy, a time consumption detection strategy, and a size detection strategy; Obtaining the status of the picture instance to be detected according to the resource status information of the picture instance to be detected and the view attribute information of the picture view to be detected according to the detection strategy in the detection rule specifically includes: For the visibility detection strategy, obtaining the status of the picture instance to be detected according to the instance usage status of the picture instance to be detected and the visibility of the corresponding picture view of the picture view to be detected; For the memory detection strategy, obtaining the status of the corresponding picture instance to be detected according to the decoded memory size of the picture instance of the picture view to be detected; For the main thread detection strategy, obtaining the status of the picture instance to be detected according to the loading thread of the picture instance to be detected; For the time consumption detection strategy, obtaining the status of the picture instance to be detected according to the loading time consumption of the picture instance to be detected; For the size detection strategy, obtaining the status of the corresponding picture instance to be detected according to the size ratio between the picture instance and the picture view of the picture view to be detected.
8. An image monitoring device, characterized in that, The monitoring device includes: A debugging attribute acquisition module for acquiring the location information and resource status information of all picture instances; A debugging attribute update module for updating the resource status information of the set picture instance when setting the picture instance in the picture view; A view attribute acquisition module for acquiring the picture parameter information of the picture instance, and using a preset method for acquiring view attribute information to acquire the view attribute information of the corresponding picture view according to the picture parameter information of the picture instance; A status acquisition module for obtaining the status of the picture instance according to the resource status information of the picture instance and the view attribute information of the picture view according to a preset detection rule; A picture positioning module for positioning the picture instance in an abnormal state according to the location information of the picture instance.
9. An electronic device, characterized in that, including: A memory for storing one or more computer programs; A processor, when the one or more computer programs are executed by the processor, implementing a picture monitoring method according to any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to implement a picture monitoring method according to any one of claims 1-7 when executed.