Device memory monitoring system and method, electronic device, and storage medium

By setting up the first memory monitoring module and the second memory monitoring module in the device memory monitoring, data is obtained directly from the kernel file, which solves the problem of performance degradation and poor accuracy caused by system service process dependence, and realizes high-frequency memory monitoring, which is suitable for Accurate monitoring of complex scenes.

WO2024179338A1PCT designated stage expired Publication Date: 2024-09-06VIVO MOBILE COMM CO LTD

Patent Information

Application Number
PCT/CN2024/077883
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-27
Filing Date
2024-02-21
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The existing technology relies on system service processes in device memory monitoring, resulting in overall performance degradation, is not suitable for high-frequency memory parameter collection, and cannot accurately monitor memory conditions that are not mapped to process space.

Method used

By setting up the first memory monitoring module and the second memory monitoring module, the acquisition of memory monitoring data is decoupled from the system service process. The memory monitoring data is obtained directly from the kernel file, which avoids poor accuracy caused by memory leaks and supports high-frequency memory. Data collection.

Benefits of technology

It achieves more accurate memory monitoring, meets high-frequency collection requirements, and is suitable for memory monitoring in complex scenes such as photography and game scenes, avoiding additional occupation of system resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024077883_06092024_PF_FP
    Figure CN2024077883_06092024_PF_FP
Patent Text Reader

Abstract

Provided are a device memory monitoring system and method, an electronic device, and a storage medium. The device memory monitoring system comprises: a first memory monitoring module (101) and a second memory monitoring module (102). The device memory monitoring method comprises: a first memory monitoring module (101) acquires configuration information issued by a configuration module (103), and forwards the configuration information to a second memory monitoring module (102); the second memory monitoring module (102) acquires, from a kernel file, memory monitoring data corresponding to the configuration information, and sends the memory monitoring data to the first memory monitoring module (101); and upon receiving the memory monitoring data, the first memory monitoring module (101) encapsulates the memory monitoring data, and sends same to the configuration module (103) for displaying the memory monitoring data by the configuration module (103).
Need to check novelty before this filing date? Find Prior Art

Description

System, method, electronic device and storage medium for monitoring device memory

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202310184004.9 filed in China on February 27, 2023, the entire contents of which are incorporated herein by reference. Technical Field

[0003] The present application belongs to the field of computer technology, and specifically relates to a system, method, electronic device, and storage medium for monitoring device memory. Background Art

[0004] As hardware performance improves, more and more applications are installed on these devices, and the functions they perform are becoming increasingly complex. Whether in product design and development or in actual use, memory monitoring is crucial.

[0005] When monitoring device memory, due to the large number of memory categories, some memory may not even be mapped to the process space, making it very difficult to fully count a process's memory usage. In related technologies, when using the operating system's built-in tools to monitor memory, it is necessary to collect memory parameters through the native system service process. However, the system service process is the most core and relatively busy process in the operating system, which makes it impossible for other services to call the system service process. Furthermore, the above method is even less applicable to scenarios where the frequency of memory parameter collection must be increased to obtain accurate memory monitoring data.

[0006] Summary of the Invention

[0007] The purpose of the embodiments of the present application is to provide a system, method, electronic device and storage medium for monitoring device memory, to solve the problem in related technologies that memory data monitoring through system service processes causes a decline in overall device performance and is not suitable for scenarios with high-frequency memory parameter collection, to achieve decoupling of the memory monitoring process from the system service process, and to achieve more accurate memory monitoring.

[0008] In a first aspect, an embodiment of the present application provides a system for monitoring device memory, characterized by comprising: a first memory monitoring module, a second memory monitoring module;

[0009] The first memory monitoring module obtains configuration information sent by the configuration module and forwards the configuration information to the second memory monitoring module;

[0010] The second memory monitoring module obtains memory monitoring data corresponding to the configuration information in the kernel file and sends the data to the first memory monitoring module;

[0011] When the first memory monitoring module receives the memory monitoring data, it encapsulates the memory monitoring data and sends the data to the configuration module for display by the configuration module.

[0012] In a second aspect, an embodiment of the present application provides a method for monitoring device memory, characterized by comprising:

[0013] Obtaining configuration information issued by the configuration module through the first memory monitoring module, and forwarding the configuration information to the second memory monitoring module;

[0014] Obtaining memory monitoring data corresponding to the configuration information from a kernel file through the second memory monitoring module, and sending the data to the first memory monitoring module;

[0015] When the first memory monitoring module receives the memory monitoring data, the first memory monitoring module encapsulates the memory monitoring data and sends the data to the configuration module for display by the configuration module.

[0016] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method described in the second aspect are implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the second aspect are implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the method described in the second aspect.

[0019] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the second aspect.

[0020] In an embodiment of the present application, the first memory monitoring module obtains the configuration information sent by the configuration module, forwards the configuration information to the second memory monitoring module, the second memory monitoring module obtains the memory monitoring data corresponding to the configuration information in the kernel file, and sends it to the first memory monitoring module, the first memory monitoring module encapsulates the memory monitoring data, and sends it to the configuration module for the configuration module to display. In this solution, the acquisition of device memory monitoring data is achieved by setting the first memory monitoring module and the second memory monitoring module, and the decoupling of the memory monitoring process from the system service process is achieved. At the same time, the configuration information is sent by the configuration module, and the corresponding memory monitoring data is obtained in the kernel file based on the configuration information, thereby achieving refined memory monitoring. At the same time, since the acquired memory monitoring data is directly derived from the kernel file, the problem of poor memory monitoring accuracy due to memory leaks is avoided. In addition, since the acquisition of device memory monitoring data is achieved by setting the first memory monitoring module and the second memory monitoring module, there is no need to occupy additional system resources, and high-frequency memory data collection can be achieved to meet the memory monitoring needs in special scenarios such as photo scenes and game scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] FIG1 is a block diagram of a system for monitoring device memory provided by an embodiment of the present application;

[0022] FIG2 is a schematic diagram of the architecture of a system for monitoring device memory provided in an embodiment of the present application;

[0023] FIG3 is a flowchart of a method for monitoring device memory provided by an embodiment of the present application;

[0024] FIG4 is a flowchart of another method for monitoring device memory provided by an embodiment of the present application;

[0025] FIG5 is a flowchart of another method for monitoring device memory provided by an embodiment of the present application;

[0026] FIG6 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0027] FIG7 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. DETAILED DESCRIPTION

[0028] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.

[0029] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0030] The following describes in detail the method for monitoring device memory provided by the embodiment of the present application through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0031] FIG1 is a block diagram of a system for monitoring device memory provided by an embodiment of the present invention. As shown in FIG1 , the system includes a first memory monitoring module 101 and a second memory monitoring module 102 .

[0032] The first memory monitoring module 101 obtains the configuration information sent by the configuration module, and forwards the configuration information to the second memory monitoring module 102 .

[0033] In one embodiment, the first memory monitoring module 101 can communicate with the configuration module. The first memory monitoring module 101 is a module that is configured to communicate with the configuration module and other modules. The functions performed by the first memory monitoring module 101 can be implemented through a corresponding process created by the system, such as a Java process created by the system to perform the functions of the first memory monitoring module. The configuration module can be a device with a graphic display function, such as a host computer, a PC or other computing device, or it can be another credit module or a unit module with configuration and display functions divided by itself. The user can edit the configuration information through the configuration module and send it to the first memory monitoring module through the configuration module. The configuration information may include the ID of the process that needs to be memory monitored, the type of monitored memory, etc. The type of monitored memory is exemplary, such as the total system memory, currently available memory, buffer memory, cache memory, etc.

[0034] Optionally, after obtaining the configuration information sent by the configuration module, the first memory monitoring module 101 may parse the configuration information accordingly and forward the parsed configuration information to the second memory monitoring module 102. The parsing process is performed according to a pre-set protocol, which defines multiple different fields and the meaning of each field.

[0035] In one embodiment, the second memory monitoring module 102 can communicate with the first memory monitoring module 101 to receive configuration information. Optionally, the functions performed by the second memory monitoring module 102 can be implemented by a corresponding process created by the system. For example, in the Android system, a native daemon process can be created to perform the functions of the second memory monitoring module 102.

[0036] In one embodiment, data is transmitted between the configuration module and the first memory monitoring module 101 and the second memory monitoring module 102 in the system for monitoring the device memory based on the Socket communication mechanism. Data transmission through this communication mechanism only needs to comply with the defined content protocol format to achieve interactive communication of data, and has strong portability and expansion.

[0037] In the system, the second memory monitoring module 102 obtains memory monitoring data corresponding to the configuration information in the kernel file and sends the data to the first memory monitoring module 101 .

[0038] In one embodiment, after receiving the configuration information, the second memory monitoring module 102 obtains the corresponding memory monitoring data in the kernel file based on the configuration information and sends it to the first memory monitoring module 101. Optionally, the kernel file records various types of memory information, and the second memory monitoring module 102 obtains the memory monitoring data corresponding to the configuration information by parsing the recorded memory information line by line. For example, the kernel file records the original memory indicators through different nodes, and the nodes can be exemplarily: " / proc / meminfo", " / proc / <pid> / smaps"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_mapped"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_unmapped", " / proc / meminfo_quick", etc. Take the configuration information record of the process ID that needs to be monitored as an example, by parsing the node information of the corresponding pid " / proc / <pid> / smaps" to obtain the raw memory data corresponding to the process ID.

[0039] In one embodiment, after the second memory monitoring module 102 obtains the complete memory monitoring data, it sends it to the first memory monitoring module 101 for packaging and then transmitting to the configuration module for display.

[0040] In one embodiment, when the first memory monitoring module 101 encapsulates the memory monitoring data, the first memory monitoring module 101 further includes: encapsulating the acquired basic information and event information with the memory monitoring data, wherein the basic information includes timestamp information, and the event information is reported to the first memory monitoring module 101 by other modules. Optionally, by encapsulating the timestamp information with the memory monitoring data, the corresponding timestamp information can be displayed when the configuration module displays the graphical interface, facilitating memory monitoring and enabling intuitive and efficient understanding of memory status at different time points.

[0041] When the first memory monitoring module 101 receives the memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display by the configuration module.

[0042] In one embodiment, after the first memory monitoring module 101 receives the memory monitoring data sent by the second memory monitoring module 102, it encapsulates the data. The encapsulation process is to process the memory monitoring data using a defined protocol format to obtain a data packet with a fixed field format that can be parsed by the configuration module.

[0043] In one embodiment, after receiving the encapsulated data sent by the first memory monitoring module 101 , the configuration module performs corresponding analysis and displays the data in a graphical interface.

[0044] As can be seen from the above, the first memory monitoring module obtains the configuration information sent by the configuration module and forwards the configuration information to the second memory monitoring module. The second memory monitoring module obtains the memory monitoring data corresponding to the configuration information in the kernel file and sends it to the first memory monitoring module. The first memory monitoring module encapsulates the memory monitoring data and sends it to the configuration module for the configuration module to display. In this solution, the acquisition of device memory monitoring data is achieved by setting up the first memory monitoring module and the second memory monitoring module, thereby achieving decoupling from the system service process during the memory monitoring process. At the same time, the configuration information is sent down by the configuration module, and the corresponding memory monitoring data is obtained in the kernel file based on the configuration information, thereby achieving refined memory monitoring. At the same time, since the acquired memory monitoring data is directly derived from the kernel file, the problem of poor memory monitoring accuracy due to memory leaks is avoided. In addition, since the acquisition of device memory monitoring data is achieved by setting up the first memory monitoring module and the second memory monitoring module, there is no need to occupy additional system resources, and high-frequency memory data collection can be achieved to meet the memory monitoring needs in special scenarios such as photo scenes and game scenes.

[0045] In one embodiment, the first memory monitoring module is further configured to receive event information reported by the system service module before encapsulating the acquired basic information and event information with the memory monitoring data. The first memory monitoring module and the system service module perform data transmission based on the AIDL communication mechanism. The first memory monitoring module may receive event information reported by the system service module. Exemplarily, the event information may include GC (Garbage Collection) events, process death events, and the like. Optionally, the first memory monitoring module and the system service module perform data transmission based on the AIDL communication mechanism. AIDL (Android Interface Definition Language) is a unique communication mechanism in the Android system that performs only a single memory copy and offers excellent performance. It should be noted that other operating systems, if equipped with built-in, efficient communication mechanisms, can also be used when transmitting data only between internal modules, and are not limited to the AIDL communication mechanism. Accordingly, the first memory monitoring module encapsulates the acquired basic information and event information with the memory monitoring data and transmits them to the configuration module for display by the configuration module.

[0046] In one embodiment, when encapsulating memory monitoring data, event information reported by other modules is also encapsulated, so that the relationship between changes in memory monitoring data and corresponding events can be more accurately grasped, which facilitates the analysis of memory monitoring data and enables timely detection of memory leaks.

[0047] In one embodiment, the first memory monitoring module is also used to upload the memory monitoring data to the log system. Among them, for scenarios where memory monitoring data needs to be uploaded, such as when performing online device memory monitoring, the memory monitoring data needs to be uploaded to the log system for display and analysis after downloading. Among them, the upload method includes data transmission based on the AIDL communication mechanism and / or the HTTPS communication mechanism. Optionally, in the case where the log system has an open API, the memory monitoring data is directly reported to the log system via HTTPS; if there is an App that reports memory monitoring data, the memory monitoring data is stored in a specific directory, and the reporting App is notified through the AIDL interface to report the memory monitoring data to the server where the log system is located. The above method of reporting memory monitoring data to the log system can realize online monitoring of memory monitoring data, support a variety of different scenarios, and support memory backtracking functions.

[0048] FIG2 is a schematic diagram of the architecture of a system for monitoring device memory provided by an embodiment of the present application. Based on the above technical solution, the system provides a connection relationship between a configuration module 103, a first memory monitoring module 101, a second memory monitoring module 102, a system service module 104, a log system 105, a kernel 106, and other trusted modules 107. As shown in FIG2 , the configuration module 103 can send configuration information to the first memory monitoring module 101. The first memory monitoring module 101 forwards the configuration information to the second memory monitoring module 102. The second memory monitoring module 102 obtains memory monitoring data corresponding to the configuration information from the kernel file of the kernel 106 and sends it to the first memory monitoring module 101. The first memory monitoring module 101 encapsulates the memory monitoring data and sends it to the configuration module 103 for display by the configuration module 103. When a reporting event is triggered, the system service module 104 reports the event information to the first memory monitoring module 101. The first memory monitoring module 101 is also used to upload the memory monitoring data to the log system 105. As a result, the memory monitoring process is decoupled from the system service process, enabling more accurate memory monitoring.

[0049] As can be seen from the above scheme, the first memory monitoring module obtains the configuration information sent by the configuration module and forwards the configuration information to the second memory monitoring module. The second memory monitoring module obtains the memory monitoring data corresponding to the configuration information in the kernel file and sends it to the first memory monitoring module. The first memory monitoring module encapsulates the memory monitoring data and sends it to the configuration module for the configuration module to display. In this scheme, the acquisition of device memory monitoring data is achieved by setting up the first memory monitoring module and the second memory monitoring module, thereby achieving decoupling from the system service process during the memory monitoring process. At the same time, the configuration information is sent down by the configuration module, and the corresponding memory monitoring data is obtained in the kernel file based on the configuration information, thereby achieving refined memory monitoring. At the same time, since the acquired memory monitoring data is directly derived from the kernel file, the problem of poor memory monitoring accuracy due to memory leaks is avoided. In addition, since the acquisition of device memory monitoring data is achieved by setting up the first memory monitoring module and the second memory monitoring module, there is no need to occupy additional system resources, and high-frequency memory data collection can be achieved to meet the memory monitoring needs in special scenarios such as photo scenes and game scenes.

[0050] The system for monitoring device memory in the embodiment of the present application can be integrated into an electronic device, or it can be a component of the electronic device, such as an integrated circuit or chip. The electronic device can be a terminal, or it can be other devices other than a terminal. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a mobile Internet device (MID), an augmented reality (AR) / virtual reality (VR) device, a robot, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.

[0051] The system for monitoring device memory in the embodiment of the present application may be integrated with an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0052] The system for monitoring device memory provided in the embodiment of the present application can implement each process implemented in the above embodiment. To avoid repetition, it will not be described here.

[0053] Optionally, an embodiment of the present application further provides a method for monitoring device memory, as shown in FIG3 , which is a flow chart of a method for monitoring device memory provided by an embodiment of the present application, specifically comprising the following steps:

[0054] Step S101: Obtain configuration information sent by a configuration module through a first memory monitoring module, and forward the configuration information to a second memory monitoring module.

[0055] In one embodiment, the first memory monitoring module can communicate with the configuration module. The first memory monitoring module is a module that is set to communicate with the configuration module and other modules. The functions performed by the first memory monitoring module can be implemented through the corresponding process created by the system, such as a java process created by the system to execute the functions of the first memory monitoring module. Exemplarily, the configuration module can be a device with a graphic display function, such as a host computer, a PC or other computing device. The user can edit the configuration information through the configuration module and send it to the first memory monitoring module through the configuration module. The configuration information may include the ID of the process that needs to be memory monitored, the type of monitored memory, etc. Exemplarily, the type of monitored memory may include the total system memory, currently available memory, buffer memory, cache memory, etc.

[0056] Optionally, after receiving the configuration information sent by the configuration module, the first memory monitoring module may parse the configuration information accordingly and forward the parsed configuration information to the second memory monitoring module. The parsing process is performed according to a pre-defined protocol, which defines multiple different fields and the meaning of each field.

[0057] In one embodiment, the second memory monitoring module can communicate with the first memory monitoring module to receive configuration information. Optionally, the functions performed by the second memory monitoring module can be implemented by a corresponding process created by the system. For example, in the Android system, a native daemon process can be created to perform the functions of the second memory monitoring module.

[0058] In one embodiment, data is transmitted between the configuration module, the first memory monitoring module and the second memory monitoring module based on the Socket communication mechanism. By using this communication mechanism, data interaction can be achieved by only complying with the defined content protocol format, and the portability and expansion are strong.

[0059] Step S102: Obtain memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send the data to the first memory monitoring module.

[0060] In one embodiment, after receiving the configuration information, the second memory monitoring module obtains the corresponding memory monitoring data in the kernel file based on the configuration information and sends it to the first memory monitoring module. Optionally, the kernel file records various types of memory information, and the second memory monitoring module obtains the memory monitoring data corresponding to the configuration information by parsing the recorded memory information line by line. Exemplarily, the kernel file records the original memory indicators through different nodes, and the nodes may be: " / proc / meminfo", " / proc / <pid> / smaps"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_

[0061] mapped"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_unmapped", " / proc / meminfo_quick", etc. Take the configuration information record of the process ID that needs to be monitored as an example, by parsing the node information of the corresponding pid " / proc / <pid> / smaps" to obtain the raw memory data corresponding to the process ID.

[0062] In one embodiment, after the second memory monitoring module obtains the complete memory monitoring data, it sends it to the first memory monitoring module for packaging and then transmitting to the configuration module for display.

[0063] In one embodiment, when the first memory monitoring module encapsulates memory monitoring data, the first memory monitoring module also encapsulates acquired basic information and event information with the memory monitoring data, wherein the basic information includes timestamp information, and the event information is reported to the first memory monitoring module by other modules. Optionally, by encapsulating the timestamp information with the memory monitoring data, the corresponding timestamp information can be displayed when the configuration module displays the graphical interface, facilitating memory monitoring and enabling intuitive and efficient understanding of memory status at different time points.

[0064] Step S103: Encapsulate the memory monitoring data through the first memory monitoring module and send it to the configuration module for display.

[0065] In one embodiment, after receiving the memory monitoring data sent by the second memory monitoring module, the first memory monitoring module encapsulates the memory monitoring data. The encapsulation process is to process the memory monitoring data using a defined protocol format to obtain a data packet with a fixed field format that can be parsed by the configuration module.

[0066] In one embodiment, after receiving the encapsulated data sent by the first memory monitoring module, the configuration module performs corresponding analysis and displays it in a graphical interface.

[0067] As can be seen from the above, the configuration information sent by the configuration module is obtained through the first memory monitoring module, and the configuration information is forwarded to the second memory monitoring module. The memory monitoring data corresponding to the configuration information is obtained from the kernel file through the second memory monitoring module and sent to the first memory monitoring module. The memory monitoring data is encapsulated by the first memory monitoring module and sent to the configuration module for display by the configuration module. In this solution, the acquisition of device memory monitoring data is achieved through the provision of the first memory monitoring module and the second memory monitoring module, thereby achieving decoupling from the system service process during the memory monitoring process. At the same time, the configuration information is issued by the configuration module, and the corresponding memory monitoring data is obtained from the kernel file based on the configuration information, thereby achieving refined memory monitoring. At the same time, since the memory monitoring data obtained is directly derived from the kernel file, the problem of poor memory monitoring accuracy due to memory leaks is avoided. In addition, since the acquisition of device memory monitoring data is achieved through the provision of the first memory monitoring module and the second memory monitoring module, there is no need to occupy additional system resources, and high-frequency memory data collection can be achieved, meeting the memory monitoring needs in special scenarios such as photo scenes and game scenes.

[0068] FIG4 is a flow chart of another method for monitoring device memory provided by an embodiment of the present application. As shown in FIG4 , the method specifically includes the following steps:

[0069] Step S201: Obtain configuration information sent by the configuration module through the first memory monitoring module, and forward the configuration information to the second memory monitoring module.

[0070] Step S202: Obtain memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send the data to the first memory monitoring module.

[0071] Step S203: Receive event information reported by the system service module through the first memory monitoring module.

[0072] In one embodiment, the first memory monitoring module can receive event information reported by the system service module. For example, the event information can be a GC (Garbage Collection) event, a process death event, etc. Optionally, the first memory monitoring module and the system service module transmit data based on the AIDL communication mechanism. Among them, AIDL (Android interface define language) is a unique communication mechanism in the Android system, which only performs one memory copy and has good performance. It should be noted that for other operating systems, if there is a built-in efficient communication mechanism in the system, it can also be used when only transmission between internal modules of the system is performed, and it is not limited to the AIDL communication mechanism.

[0073] Step S204: The first memory monitoring module encapsulates the acquired basic information, event information and the memory monitoring data, and sends the encapsulated information to the configuration module for display by the configuration module.

[0074] In one embodiment, when encapsulating memory monitoring data, event information reported by other modules is also encapsulated. This allows for more accurate understanding of the relationship between changes in memory monitoring data and corresponding events, facilitates analysis of memory monitoring data, and enables timely detection of memory leaks.

[0075] FIG5 is a flowchart of another method for monitoring device memory provided by an embodiment of the present application. As shown in FIG5 , the method specifically includes the following steps:

[0076] Step S301: Obtain configuration information issued by the configuration module through the first memory monitoring module, and forward the configuration information to the second memory monitoring module;

[0077] Step S302: Obtain memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send the data to the first memory monitoring module;

[0078] Step S303: Encapsulate the memory monitoring data through the first memory monitoring module and send it to the configuration module for display by the configuration module.

[0079] Step S304: Upload the memory monitoring data to a log system through the first memory monitoring module.

[0080] In one possible embodiment, for scenarios where memory monitoring data needs to be uploaded, such as when performing online device memory monitoring, the memory monitoring data needs to be uploaded to the log system for display and analysis after downloading. The upload method includes data transmission based on the AIDL communication mechanism and / or the HTTPS communication mechanism. Optionally, in the case where the log system has an open API, the memory monitoring data is directly reported to the log system via HTTPS; if there is an App that reports memory monitoring data, the memory monitoring data is stored in a specific directory, and the reporting App is notified through the AIDL interface to report the memory monitoring data to the server where the log system is located. The above method of reporting memory monitoring data to the log system can realize online monitoring of memory monitoring data, support a variety of different scenarios, and support memory backtracking functions.

[0081] The method for monitoring device memory provided in the embodiment of the present application can be executed by a system that monitors the device memory.

[0082] Optionally, an embodiment of the present application further provides an electronic device, as shown in FIG6 , which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 200 includes a processor 201, a memory 202, and a program or instruction stored in the memory 202 and executable on the processor 201. When executed by the processor 201, the program or instruction implements the various processes of the aforementioned embodiment of the method for monitoring device memory, and can achieve the same technical effects. To avoid repetition, these processes are not described here.

[0083] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0084] Figure 7 is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present application. As shown in the figure, the electronic device 300 includes, but is not limited to, components such as a radio frequency unit 301, a network module 302, an audio output unit 303, an input unit 304, a sensor 305, a display unit 306, a user input unit 307, an interface unit 308, a memory 309, and a processor 310.

[0085] Those skilled in the art will appreciate that the electronic device 300 may further include a power source (e.g., a battery) to power various components. The power source may be logically connected to the processor 310 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The electronic device structure shown in FIG7 does not limit the electronic device. The electronic device may include more or fewer components than shown, or may combine certain components or arrange the components differently, which will not be described in detail here.

[0086] Among them, the processor 310 is used to obtain the configuration information issued by the configuration module through the first memory monitoring module, forward the configuration information to the second memory monitoring module, obtain the memory monitoring data corresponding to the configuration information in the kernel file through the second memory monitoring module, and send it to the first memory monitoring module, encapsulate the memory monitoring data through the first memory monitoring module, and send it to the configuration module for display by the configuration module.

[0087] Optionally, the processor 310 is specifically configured to:

[0088] The first memory monitoring module encapsulates the acquired basic information, event information and the memory monitoring data, wherein the basic information includes timestamp information and the event information is reported to the first memory monitoring module by other modules.

[0089] Optionally, the processor 310 is also used to: before the first memory monitoring module encapsulates the acquired basic information and event information with the memory monitoring data, receive the event information reported by the system service module through the first memory monitoring module, and the first memory monitoring module and the system service module transmit data based on the AIDL communication mechanism.

[0090] Optionally, the processor 310 is further used to: upload the memory monitoring data to the log system through the first memory monitoring module, wherein the uploading method includes data transmission based on the AIDL communication mechanism and / or the HTTPS communication mechanism.

[0091] Optionally, data is transmitted between the configuration module, the first memory monitoring module, and the second memory monitoring module based on a Socket communication mechanism.

[0092] It should be understood that in an embodiment of the present application, the input unit 304 may include a graphics processing unit (GPU) 3041 and a microphone 3042, and the graphics processor 3041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 306 may include a display panel 3061, and the display panel 3061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 307 includes a touch panel 3071 and at least one of other input devices 3072. The touch panel 3071 is also called a touch screen. The touch panel 3071 may include two parts: a touch detection device and a touch controller. Other input devices 3072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0093] The memory 309 can be used to store software programs and various data. The memory 309 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 309 may include a volatile memory or a non-volatile memory, or the memory 309 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 309 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0094] Processor 310 may include one or more processing units. Optionally, processor 310 integrates an application processor and a modem processor. The application processor primarily handles operations related to the operating system, user interface, and application programs, while the modem processor primarily processes wireless communication signals, such as a baseband processor. It is understood that the modem processor may not be integrated into processor 310.

[0095] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned method embodiment for monitoring device memory are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0096] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.

[0097] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment for monitoring device memory, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0098] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0099] The embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the various processes of the above-mentioned method embodiment for monitoring device memory, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0100] It should be noted that, in this document, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising 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, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, but may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0102] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.< / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid>

Claims

1. A system for monitoring device memory, comprising: A first memory monitoring module, a second memory monitoring module; The first memory monitoring module obtains configuration information sent by the configuration module, and forwards the configuration information to the second memory monitoring module; The second memory monitoring module obtains memory monitoring data corresponding to the configuration information in the kernel file, and sends the data to the first memory monitoring module; When the first memory monitoring module receives the memory monitoring data, the memory monitoring data is packaged and sent to the configuration module for display by the configuration module.

2. The system for monitoring device memory according to claim 1, wherein: The first memory monitoring module is specifically used to: The acquired basic information, event information and the memory monitoring data are encapsulated, the basic information includes timestamp information, and the event information is reported to the first memory monitoring module by other modules.

3. The system for monitoring device memory according to claim 2, wherein: The first memory monitoring module is further used for: Before encapsulating the acquired basic information, event information and the memory monitoring data, event information reported by the system service module is received, and the first memory monitoring module and the system service module perform data transmission based on the AIDL communication mechanism.

4. The system for monitoring device memory according to any one of claims 1 to 3, wherein: The first memory monitoring module is further used for: The memory monitoring data is uploaded to a log system, wherein the uploading method includes data transmission based on an AIDL communication mechanism and / or an HTTPS communication mechanism.

5. The system for monitoring device memory according to any one of claims 1 to 3, wherein: The configuration module, the first memory monitoring module and the second memory monitoring module perform data transmission based on a Socket communication mechanism.

6. A method for monitoring device memory, comprising: The first memory monitoring module obtains the configuration information sent by the configuration module, and converts the configuration information into Send to the second memory monitoring module; Obtaining memory monitoring data corresponding to the configuration information in the kernel file through the second memory monitoring module, and sending the data to the first memory monitoring module; When the first memory monitoring module receives the memory monitoring data, the memory monitoring data is encapsulated by the first memory monitoring module and sent to the configuration module for display by the configuration module.

7. The method for monitoring device memory according to claim 6, wherein: The first memory monitoring module encapsulates the memory monitoring data, including: The first memory monitoring module encapsulates the acquired basic information, event information and the memory monitoring data, the basic information includes timestamp information, and the event information is reported to the first memory monitoring module by other modules.

8. The method for monitoring device memory according to claim 7, wherein: Before the first memory monitoring module encapsulates the acquired basic information, event information and the memory monitoring data, it also includes: The event information reported by the system service module is received through the first memory monitoring module, and the first memory monitoring module and the system service module perform data transmission based on the AIDL communication mechanism.

9. An electronic device, comprising a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method for monitoring device memory as described in any one of claims 6 to 8 are implemented.

10. A readable storage medium storing a program or instruction, wherein the program or instruction, when executed by a processor, implements the steps of the method for monitoring device memory according to any one of claims 6 to 8.

11. An electronic device, configured to implement the method for monitoring device memory as described in any one of claims 6-8.

12. A chip comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method for monitoring device memory as described in any one of claims 6 to 8.

13. A computer program product, wherein when instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for monitoring device memory as described in any one of claims 6 to 8.

Citation Information

Patent Citations

  • Physical memory information monitoring system of Linux platform

    CN101221527A

  • Display method and display device of terminal memory

    CN106484598A

  • Computer operation monitoring method and device

    CN107133130A

  • AR application performance and user behavior monitoring method of Android system

    CN110334025A

  • Memory analysis method and device, equipment and medium

    CN115114071A

Cited By

  • Dynamic memory use monitoring method based on service and process

    CN121050975A