Systems, methods, electronic devices, and storage media for monitoring device memory
By introducing a first memory monitoring module and a second memory monitoring module into the memory monitoring system, the system service processes are decoupled, and data is obtained directly from the kernel file. This solves the problems of poor accuracy and high-frequency data collection in existing technologies, and achieves accurate memory monitoring.
Patent Information
- Application Number
- CN202310184004.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2043-02-27
AI Technical Summary
Existing technologies that monitor memory through system service processes lead to a decline in overall device performance and are not suitable for high-frequency memory parameter acquisition, making it difficult to achieve accurate memory monitoring.
By setting up a first memory monitoring module and a second memory monitoring module, configuration information and memory monitoring data are obtained and encapsulated respectively, thereby decoupling the memory monitoring process from the system service process and directly obtaining memory monitoring data from the kernel file.
It achieves refined memory monitoring, avoiding the problem of poor monitoring accuracy caused by memory leaks, and can collect memory data at a high frequency to meet the needs of special scenarios such as photography and gaming.
Smart Images

Figure CN116302807B_ABST
Abstract
Description
Technical Field
[0001] This 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 Technology
[0002] As hardware performance improves, the number of applications installed on these devices is increasing, and the functions they perform are becoming more complex. Therefore, memory monitoring is crucial, both in product design and development and in actual use.
[0003] When monitoring device memory, the variety of memory types, including some memory not even mapped to process spaces, makes it extremely difficult to comprehensively analyze a process's memory usage. In related technologies, memory monitoring using built-in operating system tools requires collecting memory parameters through native system service processes. However, system service processes are among the most critical and relatively busy processes in the operating system, which can prevent other services from accessing them. Furthermore, this approach is unsuitable for scenarios requiring higher memory parameter collection frequencies to obtain accurate memory monitoring data. Summary of the Invention
[0004] The purpose of this application is to provide a system, method, electronic device, and storage medium for monitoring device memory, which solves the problem in related technologies that monitoring memory data through system service processes leads to a decrease in overall device performance and is not applicable to scenarios with high-frequency memory parameter acquisition. This application achieves decoupling of memory monitoring from system service processes, enabling more accurate memory monitoring.
[0005] In a first aspect, embodiments of this application provide a system for monitoring device memory, characterized in that it includes: a first memory monitoring module and a second memory monitoring module;
[0006] The first memory monitoring module obtains the configuration information issued by the configuration module and forwards the configuration information to the second memory monitoring module;
[0007] The second memory monitoring module obtains the memory monitoring data corresponding to the configuration information from the kernel file and sends it to the first memory monitoring module;
[0008] When the first memory monitoring module receives the memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display.
[0009] Secondly, embodiments of this application provide a method for monitoring device memory, characterized in that it includes:
[0010] The configuration information issued by the configuration module is obtained through the first memory monitoring module, and then the configuration information is forwarded to the second memory monitoring module.
[0011] The second memory monitoring module obtains the memory monitoring data corresponding to the configuration information from the kernel file and sends it to the first memory monitoring module.
[0012] When the first memory monitoring module receives the memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display.
[0013] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the method described in the second aspect.
[0014] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the second aspect.
[0015] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the second aspect.
[0016] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the second aspect.
[0017] In this embodiment, the first memory monitoring module obtains configuration information from the configuration module and forwards it to the second memory monitoring module. The second memory monitoring module retrieves the memory monitoring data corresponding to the configuration information from 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 display. This solution achieves device memory monitoring data acquisition through the establishment of a first and second memory monitoring module, decoupling the memory monitoring process from system service processes. Simultaneously, by issuing configuration information through the configuration module and retrieving corresponding memory monitoring data from the kernel file based on this information, fine-grained memory monitoring is achieved. Furthermore, since the acquired memory monitoring data directly originates 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 establishment of a first and second memory monitoring module, no additional system resources are required, enabling high-frequency memory data collection and meeting the memory monitoring needs of special scenarios such as photography and gaming. Attached Figure Description
[0018] Figure 1 This is a structural block diagram of a system for monitoring device memory provided in an embodiment of this application;
[0019] Figure 2 This is a schematic diagram of the architecture of a system for monitoring device memory provided in an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating a method for monitoring device memory provided in an embodiment of this application;
[0021] Figure 4 This is a flowchart of another method for monitoring device memory provided in an embodiment of this application;
[0022] Figure 5 This is a flowchart of another method for monitoring device memory provided in an embodiment of this application;
[0023] Figure 6 This is a schematic diagram of an electronic device structure provided in an embodiment of this application;
[0024] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application. Detailed Implementation
[0025] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0027] The method for monitoring device memory provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.
[0028] Figure 1 This is a structural block diagram of a system for monitoring device memory provided in an embodiment of this application. Figure 1 As shown, the system includes a first memory monitoring module 101 and a second memory monitoring module 102.
[0029] The first memory monitoring module 101 obtains the configuration information issued by the configuration module and forwards the configuration information to the second memory monitoring module 102.
[0030] In one embodiment, the first memory monitoring module 101 can communicate with the configuration module. The first memory monitoring module 101 is a module 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. The configuration module can be a device with graphical display capabilities, such as a host computer, PC, or other computing device, or it can be another authorized module or a unit module with configuration and display functions defined within the module itself. Users can edit configuration information through the configuration module and send it to the first memory monitoring module. This configuration information may include the ID of the process requiring memory monitoring, the type of memory to be monitored, etc. Examples of monitored memory types include total system memory, currently available memory, buffer memory, and cache memory.
[0031] Optionally, after the first memory monitoring module 101 receives the configuration information sent by the configuration module, it can parse the configuration information accordingly and forward the parsed configuration information to the second memory monitoring module 102. The parsing process is executed according to a pre-set protocol, which defines multiple different fields and the meaning of each field.
[0032] 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 through a corresponding process created by the system. Taking the Android system as an example, the functions of the second memory monitoring module 102 can be performed by a created native daemon process.
[0033] In one embodiment, the configuration module transmits data with the first memory monitoring module 101 and the second memory monitoring module 102 in the system that monitors the device memory based on the Socket communication mechanism. Data transmission through this communication mechanism can achieve data interaction as long as it conforms to the defined content protocol format, and it has strong portability and scalability.
[0034] In this system, the second memory monitoring module 102 obtains the memory monitoring data corresponding to the configuration information in the kernel file and sends it to the first memory monitoring module 101.
[0035] In one embodiment, after receiving configuration information, the second memory monitoring module 102 retrieves the corresponding memory monitoring data from 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 various raw memory metrics through different nodes, such as " / proc / meminfo", " / proc / <pid> / smaps"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_
[0036] mapped"、" / sys / class / kgsl / kgsl / proc / <pid>" / gpumem_unmapped", " / proc / meminfo_quick", etc. Taking the configuration information recording the IDs of processes that need to be monitored as an example, by parsing the node information corresponding to the PID in " / proc / <pid>Use " / smaps" to retrieve the raw memory data corresponding to the process ID.
[0037] In one embodiment, after the second memory monitoring module 102 obtains complete memory monitoring data, it sends it to the first memory monitoring module 101 for encapsulation and transmission to the configuration module for display.
[0038] In one embodiment, when the first memory monitoring module 101 encapsulates the memory monitoring data, it further includes: the first memory monitoring module 101 encapsulating the acquired basic information, event information, and memory monitoring data together. 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 together with the memory monitoring data, the corresponding timestamp information can be displayed when the configuration module displays the data in a graphical interface, facilitating memory monitoring and providing an intuitive and efficient understanding of the memory status at different points in time.
[0039] Specifically, when the first memory monitoring module 101 receives memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display.
[0040] In one embodiment, after receiving memory monitoring data sent by the second memory monitoring module 102, the first memory monitoring module 101 encapsulates it. 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 a configurable module.
[0041] In one embodiment, after receiving the encapsulated data sent by the first memory monitoring module 101, the configuration module performs corresponding parsing and displays the data in a graphical interface.
[0042] As described above, the first memory monitoring module obtains the configuration information from the configuration module and forwards it to the second memory monitoring module. The second memory monitoring module retrieves the memory monitoring data corresponding to the configuration information from 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 display. This solution achieves the acquisition of device memory monitoring data through the establishment of a first and second memory monitoring module, decoupling the memory monitoring process from system service processes. Simultaneously, by issuing configuration information through the configuration module and retrieving the corresponding memory monitoring data from the kernel file based on this information, fine-grained memory monitoring is achieved. Furthermore, since the acquired memory monitoring data comes directly 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 establishment of a first and second memory monitoring module, no additional system resources are required, enabling high-frequency memory data collection and meeting the memory monitoring needs of special scenarios such as photography and gaming.
[0043] 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, event information, and memory monitoring data; the first memory monitoring module and the system service module transmit data based on the AIDL communication mechanism. The first memory monitoring module can receive event information reported by the system service module; for example, this 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. AIDL (Android Interface Define Language) is a unique communication mechanism in the Android system that performs only one memory copy and has good performance. It should be noted that other operating systems with built-in efficient communication mechanisms can also use this mechanism when only transmitting data between internal modules, and it is not limited to the AIDL communication mechanism. Correspondingly, the first memory monitoring module encapsulates the acquired basic information, event information, and memory monitoring data, and sends them to the configuration module for display.
[0044] In one embodiment, when encapsulating memory monitoring data, event information reported by other modules is also encapsulated. This allows for a more precise understanding of changes in memory monitoring data and the correlation between corresponding events, facilitating the analysis of memory monitoring data and enabling timely detection of memory leaks.
[0045] In one embodiment, the first memory monitoring module is further configured to upload the memory monitoring data to a log system. Specifically, for scenarios requiring memory monitoring data uploads, such as online device memory monitoring, the memory monitoring data needs to be uploaded to the log system for download, display, and analysis. The upload method includes data transmission based on AIDL communication mechanisms and / or HTTPS communication mechanisms. Optionally, if the log system has an open API, the memory monitoring data can be directly reported to the log system via HTTPS; if an app is reporting memory monitoring data, the memory monitoring data is stored in a specific directory, and the reporting app is notified via the AIDL interface to report the memory monitoring data to the server where the log system resides. This method of reporting memory monitoring data to the log system enables online monitoring of memory monitoring data, supports various scenarios, and also supports memory backtracking functionality.
[0046] Figure 2 This is a schematic diagram of the architecture of a system for monitoring device memory provided in an embodiment of this application. Based on the above technical solution, it illustrates the connection relationships between the configuration module 103, the first memory monitoring module 101, the second memory monitoring module 102, the system service module 104, the logging system 105, the kernel 106, and other trusted modules 107. Figure 2 As shown, configuration module 103 can send configuration information to first memory monitoring module 101. First memory monitoring module 101 forwards the configuration information to second memory monitoring module 102. Second memory monitoring module 102 obtains the memory monitoring data corresponding to the configuration information from the kernel file of kernel 106 and sends it to first memory monitoring module 101. First memory monitoring module 101 encapsulates the memory monitoring data and sends it to configuration module 103 for display. When system service module 104 triggers a reporting event, it reports the event information to first memory monitoring module 101. First memory monitoring module 101 also uploads memory monitoring data to log system 105. This decoupling of memory monitoring from system service processes enables more accurate memory monitoring.
[0047] As described above, the first memory monitoring module obtains the configuration information from the configuration module and forwards it to the second memory monitoring module. The second memory monitoring module retrieves the memory monitoring data corresponding to the configuration information from 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 display. This solution achieves device memory monitoring data acquisition through the establishment of a first and second memory monitoring module, decoupling the memory monitoring process from system service processes. Simultaneously, by issuing configuration information through the configuration module and retrieving the corresponding memory monitoring data from the kernel file based on this information, fine-grained memory monitoring is achieved. Furthermore, since the acquired memory monitoring data comes directly 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 establishment of a first and second memory monitoring module, no additional system resources are required, enabling high-frequency memory data collection and meeting the memory monitoring needs of special scenarios such as photography and gaming.
[0048] The system for monitoring device memory in this application embodiment can be integrated into the electronic device or a component within the electronic device, such as an integrated circuit or chip. The electronic device can be a terminal or other devices besides a terminal. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, mobile internet devices (MIDs), augmented reality (AR) / virtual reality (VR) devices, robots, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc. Non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.
[0049] The system for monitoring device memory in this application embodiment can integrate an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0050] The system for monitoring device memory provided in this application embodiment can implement the various processes implemented in the above embodiments, and will not be described again here to avoid repetition.
[0051] Optionally, embodiments of this application also provide a method for monitoring device memory, such as... Figure 3 As shown, Figure 3 This is a flowchart of a method for monitoring device memory provided in an embodiment of this application, which specifically includes the following steps:
[0052] Step S101: Obtain the configuration information issued by the configuration module through the first memory monitoring module, and forward the configuration information to the second memory monitoring module.
[0053] In one embodiment, the first memory monitoring module can communicate with the configuration module. This first memory monitoring module is configured to communicate with the configuration module and other modules. The functions performed by the first memory monitoring module can be implemented through a corresponding process created by the system, such as a Java process created by the system. For example, the configuration module can be a device with graphical display capabilities, such as a host computer, PC, or other computing device. Users can edit configuration information through this configuration module and send it to the first memory monitoring module. This configuration information may include the ID of the process requiring memory monitoring, the type of memory to be monitored, etc. Examples of memory monitoring types include total system memory, currently available memory, buffer memory, and cache memory.
[0054] Optionally, after receiving the configuration information sent by the configuration module, the first memory monitoring module can parse the configuration information accordingly and forward the parsed configuration information to the second memory monitoring module. The parsing process is executed according to a pre-set protocol, which defines several different fields and the meaning of each field.
[0055] 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 through a corresponding process created by the system. Taking the Android system as an example, the functions of the second memory monitoring module can be performed by a created native daemon process.
[0056] In one embodiment, the configuration module, the first memory monitoring module, and the second memory monitoring module transmit data based on a Socket communication mechanism. Data transmission via this communication mechanism can achieve data interaction as long as it conforms to the defined content protocol format, and it has strong portability and scalability.
[0057] Step S102: Obtain the memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send it to the first memory monitoring module.
[0058] In one embodiment, after receiving the configuration information, the second memory monitoring module retrieves the corresponding memory monitoring data from 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. For example, the kernel file records various raw memory metrics through different nodes, such as " / proc / meminfo", " / proc / <pid> / smaps"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_
[0059] mapped"、" / sys / class / kgsl / kgsl / proc / <pid> / gpumem_unmapped", " / proc / meminfo_
[0060] "quick", etc. Taking the configuration information recording the IDs of processes that need to be monitored as an example, the node information corresponding to the PID is parsed in " / proc / <pid>Use " / smaps" to retrieve the raw memory data corresponding to the process ID.
[0061] In one embodiment, after the second memory monitoring module obtains complete memory monitoring data, it sends it to the first memory monitoring module for encapsulation and transmission to the configuration module for display.
[0062] In one embodiment, when the first memory monitoring module encapsulates the memory monitoring data, it further includes: the first memory monitoring module encapsulating the acquired basic information, event information, and memory monitoring data together. 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 together with the memory monitoring data, the corresponding timestamp information can be displayed when the configuration module displays the data in a graphical interface, facilitating memory monitoring and providing an intuitive and efficient understanding of the memory status at different points in time.
[0063] Step S103: The memory monitoring data is encapsulated by the first memory monitoring module and sent to the configuration module for display.
[0064] In one embodiment, after receiving memory monitoring data sent by the second memory monitoring module, the first memory monitoring module encapsulates it. 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 a configurable module.
[0065] In one embodiment, after receiving the encapsulated data sent by the first memory monitoring module, the configuration module parses it accordingly and displays it in a graphical interface.
[0066] As described above, the first memory monitoring module obtains configuration information from the configuration module and forwards it to the second memory monitoring module. The second module then retrieves the corresponding memory monitoring data from the kernel file and sends it back to the first module. The first module encapsulates the memory monitoring data and sends it to the configuration module for display. This solution uses both the first and second memory monitoring modules to acquire device memory monitoring data, decoupling the memory monitoring process from system service processes. Furthermore, by issuing configuration information through the configuration module and retrieving corresponding memory monitoring data from the kernel file based on this information, fine-grained memory monitoring is achieved. Since the acquired memory monitoring data comes directly from the kernel file, the problem of poor memory monitoring accuracy due to memory leaks is avoided. In addition, since acquiring device memory monitoring data through the first and second memory monitoring modules does not require additional system resources, it enables high-frequency memory data collection, meeting the memory monitoring needs of special scenarios such as photography and gaming.
[0067] Figure 4 This is a flowchart illustrating another method for monitoring device memory provided in an embodiment of this application. For example... Figure 4 As shown, the specific steps include the following:
[0068] Step S201: Obtain the configuration information issued by the configuration module through the first memory monitoring module, and forward the configuration information to the second memory monitoring module.
[0069] Step S202: Obtain the memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send it to the first memory monitoring module.
[0070] Step S203: Receive event information reported by the system service module through the first memory monitoring module.
[0071] In one embodiment, the first memory monitoring module can receive event information reported by the system service module. For example, this event information may 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. AIDL (Android Interface Defined Language) is a unique communication mechanism in the Android system that performs only one memory copy and has good performance. It should be noted that other operating systems with built-in efficient communication mechanisms can also use these mechanisms for data transmission between internal modules, and are not limited to the AIDL communication mechanism.
[0072] Step S204: The first memory monitoring module encapsulates the acquired basic information, event information and memory monitoring data, and sends them to the configuration module for display.
[0073] In one embodiment, when encapsulating memory monitoring data, event information reported by other modules is also encapsulated. This allows for a more precise understanding of changes in memory monitoring data and the correlation between corresponding events, facilitating the analysis of memory monitoring data and enabling timely detection of memory leaks.
[0074] Figure 5 This is a flowchart illustrating another method for monitoring device memory provided in an embodiment of this application. For example... Figure 5 As shown, the specific steps include the following:
[0075] Step S301: Obtain the configuration information issued by the configuration module through the first memory monitoring module, and forward the configuration information to the second memory monitoring module;
[0076] Step S302: Obtain the memory monitoring data corresponding to the configuration information from the kernel file through the second memory monitoring module, and send it to the first memory monitoring module;
[0077] Step S303: The memory monitoring data is encapsulated by the first memory monitoring module and sent to the configuration module for display.
[0078] Step S304: Upload the memory monitoring data to the log system through the first memory monitoring module.
[0079] In one possible implementation, for scenarios requiring memory monitoring data uploads, such as online device memory monitoring, the memory monitoring data needs to be uploaded to a log system for download, display, and analysis. The upload method includes data transmission based on AIDL and / or HTTPS communication mechanisms. Optionally, if the log system has an open API, the memory monitoring data can be directly reported to the log system via HTTPS; if an app is reporting memory monitoring data, the data is stored in a specific directory, and the AIDL interface notifies the reporting app to report the memory monitoring data to the server where the log system resides. This method of reporting memory monitoring data to the log system enables online monitoring of memory data, supports various scenarios, and also supports memory backtracking functionality.
[0080] The method for monitoring device memory provided in this application embodiment can be executed by a system for monitoring device memory.
[0081] Optionally, embodiments of this application also provide an electronic device, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. The electronic device 200 includes a processor 201, a memory 202, and a program or instructions stored in the memory 202 and executable on the processor 201. When the program or instructions are executed by the processor 201, they implement the various processes of the above-described method embodiment for monitoring device memory and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0082] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0083] Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this 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.
[0084] Those skilled in the art will understand that the electronic device 300 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 310 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0085] The processor 310 is configured to obtain configuration information issued by the configuration module through the first memory monitoring module, forward the configuration information to the second memory monitoring module, obtain memory monitoring data corresponding to the configuration information from 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.
[0086] Optionally, the processor 310 is specifically used for:
[0087] The first memory monitoring module encapsulates the acquired basic information, event information, and memory monitoring data. The basic information includes timestamp information, and the event information is reported to the first memory monitoring module by other modules.
[0088] Optionally, the processor 310 is further configured to: receive event information reported by the system service module through the first memory monitoring module before the first memory monitoring module encapsulates the acquired basic information, event information and the memory monitoring data, wherein the first memory monitoring module and the system service module transmit data based on the AIDL communication mechanism.
[0089] Optionally, the processor 310 is further configured to: upload the memory monitoring data to the log system via the first memory monitoring module, wherein the uploading method includes data transmission based on AIDL communication mechanism and / or HTTPS communication mechanism.
[0090] Optionally, the configuration module, the first memory monitoring module, and the second memory monitoring module transmit data based on a Socket communication mechanism.
[0091] It should be understood that, in this embodiment, the input unit 304 may include a graphics processing unit (GPU) 3041 and a microphone 3042. The GPU 3041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 306 may include a display panel 3061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 307 includes at least one of a touch panel 3071 and other input devices 3072. The touch panel 3071 is also called a touch screen. The touch panel 3071 may include a touch detection device and a touch controller. Other input devices 3072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.
[0092] The memory 309 can be used to store software programs and various data. The memory 309 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 309 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can 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 memory bus RAM (DRRAM). The memory 309 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.
[0093] Processor 310 may include one or more processing units; optionally, processor 310 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 310.
[0094] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described method embodiment for monitoring device memory and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0095] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0096] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described method embodiment for monitoring device memory, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0097] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0098] This application provides a computer program product stored in a storage medium. The program product is executed by at least one processor to implement the various processes described in the above-described method embodiment for monitoring device memory, achieving the same technical effects. To avoid repetition, further details are omitted here.
[0099] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they 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 this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0101] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.< / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid> < / pid>
Claims
1. A system for monitoring device memory, characterized in that, include: The system includes a first memory monitoring module, a second memory monitoring module, and a configuration module. The configuration module is used to edit configuration information and send the edited configuration information to the first memory monitoring module. The configuration information includes the ID of the process performing memory monitoring and the type of memory being monitored. The first memory monitoring module obtains the configuration information issued 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 from the kernel file and sends it to the first memory monitoring module; When the first memory monitoring module receives the memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display. Specifically, the first memory monitoring module is used to encapsulate 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.
2. The system for monitoring device memory according to claim 1, characterized in that, The first memory monitoring module is also used for: Before encapsulating the acquired basic information, event information and memory monitoring data, the first memory monitoring module receives event information reported by the system service module, and the system service module transmits data based on the AIDL communication mechanism.
3. The system for monitoring device memory according to any one of claims 1-2, characterized in that, The first memory monitoring module is also used for: The memory monitoring data is uploaded to the log system, wherein the upload method includes data transmission based on AIDL communication mechanism and / or HTTPS communication mechanism.
4. The system for monitoring device memory according to any one of claims 1-2, characterized in that, The configuration module, the first memory monitoring module, and the second memory monitoring module transmit data based on the Socket communication mechanism.
5. A method for monitoring device memory, characterized in that, include: The configuration information is edited through the configuration module, and the edited configuration information is sent to the first memory monitoring module. The configuration information includes the ID of the process performing memory monitoring and the type of memory being monitored. The configuration information issued by the configuration module is obtained through the first memory monitoring module, and then the configuration information is forwarded to the second memory monitoring module. The second memory monitoring module obtains the memory monitoring data corresponding to the configuration information from the kernel file and sends it to the first memory monitoring module. When the first memory monitoring module receives the memory monitoring data, it encapsulates the memory monitoring data and sends it to the configuration module for display. The encapsulation of the memory monitoring data by the first memory monitoring module includes: the first memory monitoring module encapsulating the acquired basic information and event information with 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.
6. The method for monitoring device memory according to claim 5, characterized in that, Before the first memory monitoring module encapsulates the acquired basic information, event information, and memory monitoring data, it also includes: The first memory monitoring module receives event information reported by the system service module, and the first memory monitoring module and the system service module transmit data based on the AIDL communication mechanism.
7. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the method for monitoring device memory as described in any one of claims 5-6.
8. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the steps of the method for monitoring device memory as described in any one of claims 5-6.
Citation Information
Patent Citations
Method and device for processing request
CN111381965A
Design of KX operating system
CN111880985A
Method for data transmission, first box and second box
WO2021233158A1
