Memory visualization method and device, electronic equipment and storage medium
By inserting visual memory code into the program, real-time memory data is obtained and memory visualization files are generated, which solves the problem of insufficient certainty of program running status in the existing technology, enables accurate tracking of program running status and exception repair, and improves code efficiency. stability and robustness.
Patent Information
- Application Number
- CN202410866468.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-30
- Publication Date
- 2024-09-20
AI Technical Summary
When recording the running status of a program, it is difficult to accurately locate abnormal points with the existing technology, resulting in insufficient certainty in the running status of the program.
By inserting visual memory code into the original program code, real-time memory data is obtained, and memory visualization files are generated to locate and repair exceptions to improve the accuracy of program running status.
It improves the accuracy of program running status, records the status and processing logic during code running in real time, tracks code variables, locates and repairs exceptions, and enhances the stability and robustness of the code.
Smart Images

Figure CN118672867A
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and more specifically, to a visual memory method, device, electronic device, and storage medium. Background Art
[0002] With the development of centralized storage systems, more and more functions and features of centralized storage are required. As centralized storage develops rapidly, the code is also rapidly developed and iterated. In the process of development and iteration, the stability and robustness of the code face great challenges. In related technologies, the program running status is determined by recording logs, and then the abnormal points in the program running process are determined. However, due to the different levels of understanding of the code by each engineer, the program running status recorded in the log is uneven, and the method of recording logs may not be able to accurately locate the abnormal point when the code runs abnormally.
[0003] Therefore, how to improve the accuracy of determining the program running status is a technical problem that technical personnel in this field need to solve. Summary of the invention
[0004] The purpose of this application is to provide a method, device, electronic device, and storage medium for visualizing memory, which improves the accuracy of determining the running status of a program.
[0005] To achieve the above objectives, the present application provides a method for visualizing memory, including:
[0006] Obtaining a visual memory code; wherein the visual memory code is used to obtain memory data, and determine the true value of the keyword in the original program code according to the type of the keyword in the memory data;
[0007] Inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code;
[0008] When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data.
[0009] The byte length of the keyword of the target type in the visual memory code is greater than or equal to the byte length of the keyword of the target type in the original program code.
[0010] When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data, including:
[0011] When a memory visualization request is received through the input interface, a memory visualization file is generated based on the acquired real-time memory data.
[0012] When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data, including:
[0013] When storage is abnormal, a memory visualization file is generated based on the acquired real-time memory data.
[0014] After the memory visualization file is generated based on the acquired real-time memory data, the following steps are also included:
[0015] Memory abnormalities are located according to the memory visualization file, and a patch program is introduced into the target program code according to the located abnormalities to repair the memory abnormalities.
[0016] Wherein, when a memory visualization request is received, before a memory visualization file is generated based on the acquired real-time memory data, the method further includes:
[0017] Initialize the kernel module and create a memory page table;
[0018] The memory is divided into multiple memory areas according to the memory design model; different memory areas are used to store different types of content;
[0019] Calculate the number of memory pages required in each memory area at each operation stage of each functional module, and create a memory device; wherein the functional module includes any one or a combination of any several of a redundant array of independent disks module, a cache module, a front-end port module, a back-end port module, and a communication module;
[0020] Start a daemon process, and use the daemon process to map memory pages in each memory area to each functional module through virtualization according to the calculation result, so that each functional module can apply for a memory page to record its own operating status;
[0021] Accordingly, a memory visualization file is generated based on the acquired real-time memory data, including:
[0022] Creating a memory visualization file, and writing different types of content in the acquired real-time memory data into corresponding positions of the memory visualization file according to the memory design model;
[0023] The memory visualization file is compressed and the compressed memory visualization file is output.
[0024] The memory area includes any one or a combination of any one of a memory page index area, a memory logical page number area, a data area, a global area, and a code area;
[0025] The memory page index area is used to store memory page indexes, the memory logical page number area is used to store memory logical page numbers, the data area is used to store data during the execution of the target program code, the global area is used to store shared data and / or status information, and the code area is used to store the original program code.
[0026] To achieve the above objectives, the present application provides a visual memory device, comprising:
[0027] An acquisition module, used to acquire a visual memory code; wherein the visual memory code is used to acquire memory data, and determine the true value of the keyword in the original program code according to the type of the keyword in the memory data;
[0028] An insertion module, used for inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code;
[0029] The generation module is used to generate a memory visualization file based on the acquired real-time memory data when a visualization memory request is received.
[0030] To achieve the above objectives, the present application provides an electronic device, including:
[0031] Memory for storing computer programs;
[0032] A processor is used to implement the steps of the above-mentioned memory visualization method when executing the computer program.
[0033] To achieve the above objectives, the present application provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned visual memory method are implemented.
[0034] To achieve the above objectives, the present application provides a computer program product, including a computer program, which implements the steps of the above-mentioned memory visualization method when executed by a processor.
[0035] It can be seen from the above scheme that a visual memory method provided by the present application includes: obtaining a visual memory code; wherein the visual memory code is used to obtain memory data, and determine the true value of the keyword in the original program code according to the type of the keyword in the memory data; inserting the visual memory code into the original program code to obtain a target program code, and in the process of running the target program code, obtaining real-time memory data by running the visual memory code; when a visual memory request is received, generating a memory visualization file based on the obtained real-time memory data.
[0036] The visualization memory method provided by the present application inserts the visualization memory code into the original program code. When the program is running, in addition to running the original program code, the visualization memory code is also loaded at the same time. The real-time memory data is obtained through the visualization memory code, the real-time memory data is visualized, the status and processing logic of the code running process are recorded in real time, and the code variables are tracked in real time. After obtaining the real-time memory data, the visualization memory code replaces the current value of the keyword with the real value, thereby improving the accuracy of determining the program running status. The present application also discloses a visualization memory device, an electronic device, a non-volatile storage medium and a computer program product, which can also achieve the above-mentioned technical effects.
[0037] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific implementation methods, they are used to explain the present disclosure, but do not constitute a limitation to the present disclosure. In the drawings:
[0039] Figure 1 The present invention is a flowchart of a method for visualizing memory according to an exemplary embodiment;
[0040] Figure 2 is a flowchart of another method for visualizing memory according to an exemplary embodiment;
[0041] Figure 3 It is a schematic diagram showing a method of writing real-time memory data into a memory visualization file according to an exemplary embodiment;
[0042] Figure 4 is a structural diagram of a visual memory device according to an exemplary embodiment;
[0043] Figure 5 The figure is a structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0044] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0045] The embodiment of the present application discloses a method for visualizing memory, which improves the accuracy of determining the running status of a program.
[0046] See also Figure 1 , according to an exemplary embodiment, a flowchart of a method for visualizing memory is shown, such as Figure 1 As shown, including:
[0047] S101: Obtaining a visual memory code; wherein the visual memory code is used to obtain memory data, and determine the real value of the keyword in the original program code according to the type of the keyword in the memory data;
[0048] In a specific implementation, the language implemented in the original program code is redefined to construct a visual memory code, which is used to obtain real-time memory data, determine the true value of the keyword in the original program code according to the type of the keyword in the memory data, and replace the current value of the keyword with the true value.
[0049] As a feasible implementation manner, the byte length of the keyword of the target type in the visual memory code is greater than or equal to the byte length of the keyword of the target type in the original program code.
[0050] In a specific implementation, the keywords in the visual memory code and the keywords in the original program code are byte-aligned, that is, the byte length of the keywords in the visual memory code is greater than or equal to the byte length of the keywords of the corresponding type in the original program code.
[0051] For example, the following code defines a code structure code_struct:
[0052] struct code_struct
[0053] {
[0054] bool8 recond_needed; / / Boolean variable, occupies 1 byte of space;
[0055] uint8 perc_charged; / / Unsigned byte variable, occupies 1 byte space;
[0056] bool8 exists_in_enclosure; / / Boolean variable, occupies 1 byte of space;
[0057] bool8 at_e_o_l; / / Boolean variable, occupies 1 byte of space;
[0058] uint8 spare; / / Unsigned byte, here is to reserve 1 byte;
[0059] bool8 cond_in_progress; / / Boolean variable, occupies 1 byte of space;
[0060] StructString fru_part_num; / / Structure variable, the specific size is subject to the structure size;
[0061] StructString fru_id; / / Structure variable, same as above;
[0062] StructString fw; / / same as above;
[0063] uint8 do_not_remove; / / Unsigned byte, here is to reserve 1 byte;
[0064] uint8 removal_requested; / / Unsigned byte, here is to reserve 1 byte;
[0065] uint32 current_event_id; / / Unsigned double word, here is to reserve 4 bytes;
[0066] uint32 current_error_seq; / / same as above;
[0067] uint32 cond_start_seq; / / same as above;
[0068] };
[0069] The memory locations of the keywords in the above code are defined using a visual language as follows:
[0070] def code_struct
[0071] {
[0072] n8 map bool "recond_needed" / / 4-byte alignment;
[0073] n8 dec "perc_charged" / / same as above;
[0074] n8 map bool "exists" / / same as above;
[0075] n8 map bool "at_EOL" / / same as above;
[0076] at .+1 / / Reserve space as above;
[0077] n8 map bool "condInProgress" / / same as above;
[0078] StructString "fru_part_num" / / This is defined according to the structure, similar to this structure definition;
[0079] / / Define the structure and align it internally according to the byte alignment method;
[0080] StructString "fru_id" / / Same as above;
[0081] StructString "fw" / / Same as above;
[0082] n8 map DoNotRemove "doNotRemove" / / The variable name displayed in the visual language here is doNotRemove instead of do_not_remove;
[0083] n8 map RemovalRequested "removalRequested" / / Same principle as above, the displayed content is defined here;
[0084] align 4 / / The following data keeps 4-byte alignment;
[0085] n32 map Ss_eid "currentEventId" / / 4-byte currentEventId variable;
[0086] n32 dec "currentErrorSeq" / / same as above;
[0087] n32 hex "condStartSeq" / / same as above;
[0088] } / / The total size of the structure is the content displayed in the visual language, similar to ordinary variables, or other structures have been defined in this way to ensure the uniqueness of the entire system code.
[0089] S102: inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the process of running the target program code;
[0090] In the specific implementation, the visual memory code is inserted into the original program code to obtain the target program code. In the process of compiling the target program code, not only the original program code is compiled, but also the visual memory code is compiled at the same time. When the target program code is running, the visual memory code will be loaded at the same time, and the visual memory code can obtain real-time memory data.
[0091] S103: When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data.
[0092] In the specific implementation, when the daemon process needs to obtain memory data, a memory visualization file is generated based on the memory data obtained in real time by the visualization memory code. The generated memory visualization file is compressed according to the space occupancy to save storage system space, and then the compressed memory visualization file can be exported to the outside of the storage system through the WEB interface method.
[0093] As a feasible implementation, when a visualized memory request is received, a memory visualization file is generated based on the acquired real-time memory data, including: when a visualized memory request is received through an input interface, a memory visualization file is generated based on the acquired real-time memory data. In a specific implementation, a user can manually trigger the generation of a memory visualization file, that is, send a visualized memory request to the storage system through an input interface to manually trigger the visualization of memory data.
[0094] As another feasible implementation, when a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data, including: when storage is abnormal, a memory visualization file is generated based on the acquired real-time memory data. In a specific implementation, when a storage system has a storage abnormality at certain points during operation, such as a hardware abnormality or a software logic abnormality, the storage system automatically triggers the generation of a memory visualization file.
[0095] As an optional implementation, the visual memory code is also used to monitor and analyze memory usage and detect potential memory leaks, abnormal access or other performance bottlenecks. When abnormal memory usage is detected or reaches a preset threshold, the generation of a memory visualization file is automatically triggered and an alarm is issued. When abnormal memory usage is detected, the system can automatically adjust the memory allocation strategy, such as reallocating memory resources, optimizing memory usage, or triggering a garbage collection mechanism when necessary. At the same time, users are allowed to define their own memory usage rules and thresholds according to specific needs, making the system more flexible and adaptable to the needs of different scenarios.
[0096] As an optional implementation, after generating a memory visualization file based on the acquired real-time memory data, it also includes: locating memory exceptions according to the memory visualization file, and importing a patch program into the target program code according to the located exceptions to repair the memory exceptions.
[0097] In the specific implementation, the running status or abnormal logic of the program is determined according to the content displayed in the memory visualization file. The abnormality of the memory running status of each module is located and repaired through the main program. The patch program is imported into the storage system through the GUI (Graphical User Interface). The patch program is manually started, and the daemon loads the memory of the patch program and compares it with the original memory status. The abnormal memory data is repaired and the cluster is finally restored.
[0098] For example, the content of the memory visualization file is:
[0099] type: APU COALESCE;
[0100] events:QrlQw;
[0101] arrayid:47;
[0102] seq_num: (0x8a323e18);
[0103] strip_pages: 0x0040;
[0104] q_strip_pages: 0x0044;
[0105] token: {0x00000000000304d9};
[0106] non coalesce: (Apu_noncoalesce ctx);
[0107] coalesce: (Apu coalesce ctx);
[0108] lrc:0x8a0f195c;
[0109] ptrs: 0x00007f40f5d9d3e0->Apu_context_ptrs;
[0110] next:++ 0x00007f40f5c3a7b0->Apu_context;
[0111] pad: 0x00000000;
[0112] index: (2048);
[0113] sw_count: 0;
[0114] pending_free: FALSE;
[0115] state:APU NQ READY;
[0116] buffers supplied: 0x00000000;
[0117] pinned_state:APU PINNED STATE PINNED;
[0118] pinned_contexts: 0;
[0119] pinned_pages: 1;
[0120] client_word: (0x00000000).
[0121] Through the above content, it can be determined that the problem is triggered by some kind of Raid logic exception. The triggered events time is the read and write time of the queue, which occurs inside the Raid with Raid 47. The current strip memory page is 0x40 (decimal 64), and the exception is caused by the APU (Accelerated Processing Unit) logic context exception. By determining the above information, the program exception point can be clearly identified.
[0122] The visual memory method provided in the embodiment of the present application inserts the visual memory code into the original program code. When the program is running, in addition to running the original program code, the visual memory code is also loaded at the same time. The real-time memory data is obtained through the visual memory code, the real-time memory data is visualized, the state and processing logic of the code running process are recorded in real time, and the code variables are tracked in real time. After obtaining the real-time memory data, the visual memory code replaces the current value of the keyword with the real value, thereby improving the accuracy of determining the program running status.
[0123] The embodiment of the present application discloses a method for visualizing memory. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically:
[0124] See also Figure 2 , a flowchart of another method for visualizing memory according to an exemplary embodiment is shown, as Figure 2 As shown, including:
[0125] S201: Initialize the kernel module and create a memory page table;
[0126] S202: Divide the memory into a plurality of memory areas according to the memory design model; wherein different memory areas are used to store different types of content;
[0127] In a specific implementation, the kernel module is initialized, a memory page table is established, and the entire memory is divided into multiple memory areas according to a pre-designed memory design model. Different memory areas are used to store different types of content. The memory area may include a memory page index (PD) area, a memory logical page number (FPS) area, a data (DATA) area, a global (GA) area, a code (CODE) area, etc. The memory page index area is used to store the memory page index, the memory logical page number area is used to store the memory logical page number, the data area is used to store the data during the running of the target program code, the global area is used to store shared data and / or status information, and the code area is used to store the original program code.
[0128] S203: Calculate the number of memory pages required in each memory area at each operation stage of each functional module, and create a memory device; wherein the functional module includes any one or a combination of any several of a redundant array of independent disks module, a cache module, a front-end port module, a back-end port module, and a communication module;
[0129] In the specific implementation, the number of memory pages required in each memory area at each operation stage of each functional module is calculated according to the actual memory pages. The functional modules may include redundant array of independent disks (Raid) modules, cache modules, front-end port modules, back-end port modules, communication modules, etc. Then the memory device / dev / memview is created, and the memory model is created.
[0130] S204: starting a daemon process, and using the daemon process to map memory pages in each memory area to each functional module through virtualization according to the calculation result, so that each functional module applies for a memory page to record its own operating status;
[0131] In the specific implementation, the storage system starts the daemon process, which opens the memory device and maps the various functional modules allocated by the kernel to the specified user functional modules through virtualization. The user-state program applies for the memory it needs in the visual memory page according to the rules set by each functional module in accordance with the memory to establish the operating status of each functional module.
[0132] S205: Obtaining a visual memory code; wherein the visual memory code is used to obtain memory data, and determine the real value of the keyword in the original program code according to the type of the keyword in the memory data;
[0133] S206: inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code;
[0134] S207: when a memory visualization request is received, a memory visualization file is created, and different types of content in the acquired real-time memory data are written into corresponding positions of the memory visualization file according to the memory design model;
[0135] S208: compressing the memory visualization file, and outputting the compressed memory visualization file.
[0136] In the specific implementation, when a memory visualization request is received, a memory visualization file ViewFile is created, the memory visualization file ViewFile is opened, a header is written according to the file format, and different types of content in the acquired real-time memory data are written to corresponding locations according to the memory design model, such as Figure 3 As shown, the memory visualization file is then compressed and exported.
[0137] A visual memory device provided in an embodiment of the present application is introduced below. The visual memory device described below and the visual memory method described above can be referenced to each other.
[0138] See also Figure 4 , a structural diagram of a visual memory device according to an exemplary embodiment is shown, Figure 4 As shown, including:
[0139] The acquisition module 401 is used to acquire a visual memory code, wherein the visual memory code is used to acquire memory data and determine the real value of the keyword in the original program code according to the type of the keyword in the memory data;
[0140] Insertion module 402, used for inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code;
[0141] The generating module 403 is used to generate a memory visualization file based on the acquired real-time memory data when receiving a memory visualization request.
[0142] The visual memory device provided in the embodiment of the present application inserts the visual memory code into the original program code. When the program is running, in addition to running the original program code, the visual memory code is also loaded at the same time. The real-time memory data is obtained through the visual memory code, the real-time memory data is visualized, the state and processing logic of the code running process are recorded in real time, and the code variables are tracked in real time. After obtaining the real-time memory data, the visual memory code replaces the current value of the keyword with the real value, thereby improving the accuracy of determining the program running status.
[0143] Based on the above embodiment, as a preferred implementation manner, the byte length of the keyword of the target type in the visual memory code is greater than or equal to the byte length of the keyword of the target type in the original program code.
[0144] Based on the above embodiment, as a preferred implementation mode, the generation module 403 is specifically used for: when a visualization memory request is received through the input interface, generating a memory visualization file based on the acquired real-time memory data.
[0145] Based on the above embodiment, as a preferred implementation mode, the generation module 403 is specifically used to: when storage is abnormal, generate a memory visualization file based on the acquired real-time memory data.
[0146] Based on the above embodiment, as a preferred implementation, it also includes:
[0147] The exception locating module is used to locate the memory exception according to the memory visualization file, and import the patch program into the target program code according to the located exception to repair the memory exception.
[0148] Based on the above embodiment, as a preferred implementation, it also includes:
[0149] Create a module to initialize the kernel module and create a memory page table;
[0150] A partitioning module, used to divide the memory into a plurality of memory areas according to the memory design model; wherein different memory areas are used to store different types of content;
[0151] A calculation module, used to calculate the number of memory pages required in each memory area at each operation stage of each functional module, and create a memory device; wherein the functional module includes any one or a combination of any several of a redundant array of independent disks module, a cache module, a front-end port module, a back-end port module, and a communication module;
[0152] A mapping module is used to start a daemon process and use the daemon process to map memory pages in each memory area to each functional module through virtualization according to the calculation results, so that each functional module can apply for a memory page to record its own operating status;
[0153] Accordingly, the generating module 403 is specifically used to: create a memory visualization file, and write different types of content in the acquired real-time memory data into corresponding positions of the memory visualization file according to the memory design model;
[0154] The memory visualization file is compressed and the compressed memory visualization file is output.
[0155] Based on the above embodiment, as a preferred implementation mode, the memory area includes any one or a combination of any one of a memory page index area, a memory logical page number area, a data area, a global area, and a code area;
[0156] The memory page index area is used to store memory page indexes, the memory logical page number area is used to store memory logical page numbers, the data area is used to store data during the execution of the target program code, the global area is used to store shared data and / or status information, and the code area is used to store the original program code.
[0157] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0158] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device, Figure 5 FIG. 1 is a structural diagram of an electronic device according to an exemplary embodiment. Figure 5 As shown, the electronic equipment includes:
[0159] Communication interface 1, capable of exchanging information with other devices such as network devices;
[0160] The processor 2 is connected to the communication interface 1 to implement information exchange with other devices, and is used to execute the visualization memory method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 3.
[0161] Of course, in actual application, the various components in the electronic device are coupled together through the bus system 4. It can be understood that the bus system 4 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 5 Various buses are labeled as bus system 4.
[0162] The memory 3 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program used to operate on the electronic device.
[0163] It can be understood that the memory 3 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can 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), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), 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, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 3 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0164] The method disclosed in the above embodiment of the present application can be applied to the processor 2, or implemented by the processor 2. The processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 2 or the instruction in the form of software. The above processor 2 may be a general-purpose processor, a DSP, or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 3, and the processor 2 reads the program in the memory 3 and completes the steps of the above method in combination with its hardware.
[0165] When the processor 2 executes the program, the corresponding processes in the various methods of the embodiments of the present application are implemented, which will not be repeated here for the sake of brevity.
[0166] In an exemplary embodiment, the embodiment of the present application further provides a non-volatile storage medium storing a computer program, which can be executed by the processor 2 to complete the steps of the aforementioned method.
[0167] In an exemplary embodiment, the present application also provides a computer program product, including a computer program, which is executed by the processor 2 to complete the steps of the aforementioned method.
[0168] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to computer program instructions, and the aforementioned computer program can be stored in a non-volatile storage medium. When the computer program is executed, it executes the steps of the above-mentioned method embodiment. Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product, which is stored in a non-volatile storage medium and includes a number of instructions for an electronic device (which can be a personal computer, a server, a network device, etc.) to execute all or part of the methods described in each embodiment of the present application.
[0169] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A memory visualization method, characterized in that: include: Obtaining a visual memory code; wherein the visual memory code is used to obtain memory data, and determine the true value of the keyword in the original program code according to the type of the keyword in the memory data; Inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code; When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data.
2. The method for visualizing memory according to claim 1, characterized in that: The byte length of the keyword of the target type in the visual memory code is greater than or equal to the byte length of the keyword of the target type in the original program code.
3. The method for visualizing memory according to claim 1, characterized in that: When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data, including: When a visualization memory request is received through the input interface, a memory visualization file is generated based on the acquired real-time memory data.
4. The method for visualizing memory according to claim 1, characterized in that: When a memory visualization request is received, a memory visualization file is generated based on the acquired real-time memory data, including: When storage is abnormal, a memory visualization file is generated based on the acquired real-time memory data.
5. The method for visualizing memory according to claim 4, characterized in that: After generating a memory visualization file based on the acquired real-time memory data, it also includes: Memory abnormalities are located according to the memory visualization file, and a patch program is introduced into the target program code according to the located abnormalities to repair the memory abnormalities.
6. The method for visualizing memory according to claim 1, characterized in that: When a memory visualization request is received, before a memory visualization file is generated based on the acquired real-time memory data, the following steps are also included: Initialize the kernel module and create a memory page table; The memory is divided into multiple memory areas according to the memory design model; different memory areas are used to store different types of content; Calculate the number of memory pages required in each memory area at each operation stage of each functional module, and create a memory device; wherein the functional module includes any one or a combination of any several of a redundant array of independent disks module, a cache module, a front-end port module, a back-end port module, and a communication module; Start a daemon process, and use the daemon process to map memory pages in each memory area to each functional module through virtualization according to the calculation result, so that each functional module can apply for a memory page to record its own operating status; Accordingly, a memory visualization file is generated based on the acquired real-time memory data, including: Creating a memory visualization file, and writing different types of content in the acquired real-time memory data into corresponding positions of the memory visualization file according to the memory design model; The memory visualization file is compressed and the compressed memory visualization file is output.
7. The method for visualizing memory according to claim 6, characterized in that: The memory area includes any one or a combination of any one of a memory page index area, a memory logical page number area, a data area, a global area, and a code area; The memory page index area is used to store memory page indexes, the memory logical page number area is used to store memory logical page numbers, the data area is used to store data during the execution of the target program code, the global area is used to store shared data and / or status information, and the code area is used to store the original program code.
8. A visual memory device, characterized in that: include: An acquisition module, used to acquire a visual memory code; wherein the visual memory code is used to acquire memory data, and determine the true value of the keyword in the original program code according to the type of the keyword in the memory data; An insertion module, used for inserting the visual memory code into the original program code to obtain a target program code, and obtaining real-time memory data by running the visual memory code during the running of the target program code; The generation module is used to generate a memory visualization file based on the acquired real-time memory data when a visualization memory request is received.
9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the memory visualization method according to any one of claims 1 to 7 when executing the computer program.
10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed, the steps of the visual memory method according to any one of claims 1 to 7 are implemented.
