Real-time monitoring system for memory bandwidth and application thereof

By designing a real-time memory bandwidth monitoring system that does not rely on hardware counters, the problem of difficult memory bandwidth monitoring in ordinary computer systems is solved. It enables real-time monitoring under low load and software anomaly analysis, and is applicable to various computer systems.

CN121387675APending Publication Date: 2026-01-23EASY THINKING HANGZHOU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511893355.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-16
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

Existing technologies cannot effectively monitor the memory bandwidth usage of ordinary computer systems, especially models that lack hardware counter support, making software anomaly analysis difficult.

Method used

Design a real-time monitoring system that does not rely on a memory hardware counter. Monitor memory bandwidth in real time through an application layer interface, including modules for initialization, data reading and writing, time consumption statistics, and bandwidth calculation. Utilize SIMD uncached read and write technology to avoid impacting system performance.

Benefits of technology

It enables real-time monitoring of memory bandwidth usage without increasing hardware costs, provides intuitive analysis of software anomalies, operates with low load, does not affect CPU cache, and is suitable for various computer systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387675A_ABST
    Figure CN121387675A_ABST
Patent Text Reader

Abstract

The invention provides a real-time monitoring system for memory bandwidth. The real-time monitoring system comprises an initialization module and a monitoring module, the initialization module is used for loading configuration information and performing initialization: creating a cache space I and a cache space II, and creating a timer; the timer periodically awakens the monitoring module according to the sampling time interval t; when the monitoring module is awakened, the data read-write module reads the data from the cache space I and writes the data into the cache space II; the time consumption statistics module counts the time required for writing all the data into the cache space II as test time; the bandwidth calculation module calculates the memory bandwidth occupied by the transmission data volume s and records the memory bandwidth as the monitoring bandwidth, and the difference value between the total bandwidth and the monitoring bandwidth is recorded as the real-time memory bandwidth; the recording module correspondingly stores and / or displays the monitoring time and the real-time memory bandwidth; according to the method, the memory bandwidth consumption conditions of the system at different moments can be conveniently analyzed; the hardware cost does not need to be increased, and the real-time bandwidth occupation conditions of various types of computers can be monitored.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of memory bandwidth analysis, in particular to a real-time monitoring system for memory bandwidth and application thereof. BACKGROUND

[0002] The computer memory bandwidth is limited, such as the DDR4-2667 dual-channel physical bandwidth limit of 42.5GB / s. Limited by the operating system, memory controller and other limitations, the actual available memory bandwidth of the application program is lower, such as 20GB / s. Under the condition of limited memory bandwidth, the computer is equipped with different hardware devices, and the occupancy of the memory bandwidth is different, such as: equipped with a 1920x1080x60Hz display and a 1280x720x30Hz display, the memory bandwidth has obvious difference.

[0003] And when the software runs in the computer, a large number of multi-channel parallel data transmission will interfere with each other and occupy the memory bandwidth. When the memory bandwidth is too large, the software may be stuck, slow response and other abnormalities. For example, when the visual detection software is running, it involves a large number of high-speed acquisition, caching, transmission and calculation (point cloud stitching, reconstruction, etc.) of pictures, which requires a large amount of memory data access, and the memory overhead is large. During the algorithm occupies the memory, the visual detection software will be significantly slower in receiving pictures and other memory copy operations from the camera SDK, affecting the picture receiving efficiency, and even inducing picture loss due to untimely receiving. Therefore, the memory bandwidth occupancy at different times is determined to further analyze the influence of memory bandwidth on data transmission.

[0004] The existing memory bandwidth occupancy detection method is based on memory hardware counters. For Intel platform, only relatively high-end / top models, such as i7 / i9 series CPU + Z / X series motherboard, have hardware counters to obtain memory bandwidth occupancy, and can obtain memory bandwidth occupancy rate through PCM, WPA (Windows Performance Analyzer). However, for most entry-level or mainstream models, there is no hardware memory counter, such as i5 / i3 processor + B / H series motherboard. Due to the lack of hardware counter support, it is impossible to analyze the memory bandwidth occupancy. SUMMARY

[0005] In order to solve the above technical problems, the application provides a real-time memory bandwidth monitoring system and application thereof. The method does not rely on memory hardware counters, but is based on an application layer interface. During normal operation of the system, real-time memory bandwidth monitoring is performed. By storing and displaying real-time memory bandwidth, memory bandwidth consumption at different times can be analyzed, and software abnormal problems caused by excessive memory bandwidth occupation can be intuitively analyzed. Without increasing hardware costs, real-time bandwidth occupation of various types of computers can be monitored, and the method is suitable for abnormal analysis of various types of software.

[0006] The technical scheme is as follows:

[0007] A real-time memory bandwidth monitoring system comprises an initialization module and a monitoring module connected in sequence.

[0008] The initialization module is used for loading configuration information and performing initialization.

[0009] The configuration information comprises total bandwidth, cache data volume s, and sampling time interval t.

[0010] The initialization comprises: creating cache space I and cache space II with a size of s according to the cache data volume s, and storing data in the cache space I and the cache space II; and creating a timer according to the sampling time interval t.

[0011] The timer periodically wakes up the monitoring module according to the sampling time interval t.

[0012] The monitoring module comprises a data reading and writing module, a time consumption statistical module, a bandwidth calculation module, and a recording module connected in sequence.

[0013] When the monitoring module is woken up, the data reading and writing module reads data from the cache space I and writes the data into the cache space II.

[0014] At the same time, the time consumption statistical module counts a time required for writing all data into the cache space II, and the time is recorded as a test time.

[0015] The bandwidth calculation module calculates a memory bandwidth occupied by the transmission data volume s according to the test time, and the memory bandwidth is recorded as a monitoring bandwidth. A difference between the total bandwidth and the monitoring bandwidth is recorded as a real-time memory bandwidth.

[0016] The recording module stores and / or displays the current monitoring time and the real-time memory bandwidth.

[0017] Preferably, the cache data volume s=the clock accuracy of the operating system×k×the total bandwidth, k is a preset accuracy coefficient, and the value of k is proportional to a monitoring error.

[0018] Preferably, the real-time monitoring system and the software to be analyzed run on the same CPU, and during the running of the software to be analyzed, the timer periodically wakes up the monitoring module.

[0019] Further, the real-time monitoring system analyzes the cause of the abnormality of the software, and the steps are as follows:

[0020] When the software to be analyzed is stuck, the real-time memory bandwidth calculated by the real-time monitoring system is checked at the time when the software is stuck.

[0021] Further, the monitoring bandwidth is calculated as follows: .

[0022] Preferably, the current monitoring time and the real-time memory bandwidth are stored in the program log of the real-time monitoring system.

[0023] Preferably, the ratio of the real-time memory bandwidth to the total bandwidth is stored and / or displayed as the bandwidth ratio.

[0024] Preferably, the read / write instructions in the data read / write module are based on the non-cached read / write technology of SIMD.

[0025] The method has the following characteristics:

[0026] ①Independent of memory hardware counters, no need to increase hardware cost.

[0027] ②Intuitive analysis: can record / display the memory bandwidth occupation at different times in real time, which is convenient for intuitive analysis and positioning of the cause of software abnormality.

[0028] The real-time monitoring system and the software to be analyzed (such as visual inspection software) run on the same CPU, and through the program log of the software, the time stamp of the software abnormality can be checked. According to the time stamp, it can be quickly determined whether the memory bandwidth occupation is too high at that time, and then the cause of the abnormality is determined.

[0029] ③Low running load: by setting the value of the cache data s, the running load of the real-time monitoring system can be guaranteed not to affect the normal running of the software. Taking s=20MB and the timer sampling period of 10Hz as an example, the CPU single-core occupancy rate of the real-time monitoring system is less than 1%, and the memory occupancy is less than 50MB.

[0030] ④Not affect the CPU cache at all levels: the default memory copy will pass through the CPU cache at all levels (L1, L2, L3), and frequent read-write to the same memory location may be accelerated by the cache, interfering with the test results of memory bandwidth occupation. Moreover, the copying of a large amount of data will pollute the CPU cache, causing cache invalidation and performance degradation of other programs. Therefore, the read-write instructions in the data read-write module are based on the non-cache read-write technology of SIMD, such as _mm256_stream, which uses direct memory read-write to avoid the influence of cache fluctuations. BRIEF DESCRIPTION OF DRAWINGS

[0031] Figure 1 The structure block diagram of the real-time monitoring system. DETAILED DESCRIPTION

[0032] The technical solutions of the present application will be described in detail below in combination with the drawings and specific embodiments.

[0033] A real-time monitoring system of memory bandwidth, such as Figure 1 The real-time monitoring system comprises an initialization module and a monitoring module connected in sequence.

[0034] The initialization module is used for loading configuration information and performing initialization.

[0035] The configuration information comprises total bandwidth, cache data volume s, and sampling time interval t.

[0036] The initialization comprises: creating cache space I and cache space II with a size of s according to the cache data volume s, and storing data in the cache space I and the cache space II; and creating a timer according to the sampling time interval t.

[0037] The timer periodically wakes up the monitoring module according to the sampling time interval t.

[0038] The monitoring module comprises a data read-write module, a time consumption statistical module, a bandwidth calculation module, and a recording module connected in sequence.

[0039] When the monitoring module is woken up, the data read-write module reads data from the cache space I and writes the data into the cache space II in sequence.

[0040] At the same time, the time consumption statistical module counts the time required for writing all the data into the cache space II, which is recorded as test time.

[0041] The bandwidth calculation module calculates the memory bandwidth occupied by the transmission data volume s according to the test time, which is recorded as monitoring bandwidth, and records the difference between the total bandwidth and the monitoring bandwidth as real-time memory bandwidth.

[0042] The recording module stores and / or displays the current monitoring time corresponding to the real-time memory bandwidth.

[0043] In order to ensure that the operation load of the real-time monitoring system does not affect the normal operation of the software, the cache data amount s is set as the clock precision of the operating system multiplied by k multiplied by the total bandwidth, k is a preset precision coefficient, and the value of k is proportional to the monitoring error.

[0044] In specific implementation, k is 100-1000, when k=100, the monitoring error is not more than 1%, and when k=1000, the monitoring error is not more than 1‰. Taking s=20MB and the timer sampling period of 10Hz as an example, the CPU single-core occupation rate of the real-time monitoring system is less than 1%, and the memory occupation is less than 50MB.

[0045] The clock precision of the operating system is obtained through an interface such as QueryPerformanceCounter (QPC), and the typical precision is 1μs.

[0046] In this embodiment, the total bandwidth is a theoretical value, or the total bandwidth is obtained in the following manner: when the system is completely idle, the monitoring module is run, and the obtained real-time memory bandwidth is recorded as the total bandwidth. The sampling time interval t is 50ms-300ms.

[0047] In order to avoid the time consumption of dynamic application / release of memory, the cache space I and the cache space II are not repeatedly applied and released during the running of the monitoring module.

[0048] The test time is obtained in the following manner:

[0049] The time stamp Tstart when the data reading and writing module starts to read data from the cache space I and the time stamp Tend when the data reading and writing module writes the last data into the cache space II are recorded by the time consumption statistical module.

[0050] The test time is Tend-Tstart.

[0051] The real-time memory bandwidth is the total bandwidth- .

[0052] In order to avoid the pollution of a large amount of data to the CPU cache, which causes the cache invalidation and performance decline of other programs. In specific implementation, the read and write instructions in the data reading and writing module are based on the non-cache reading and writing technology of SIMD. For example, the _mm256_stream instruction.

[0053] In order to more intuitively analyze the memory bandwidth at different times, in this embodiment, the monitoring time and the real-time memory bandwidth are stored in the program log of the real-time monitoring system by the recording module. The ratio of the real-time memory bandwidth to the total bandwidth is also stored and / or displayed as the bandwidth proportion. The following table is part of the program log:

[0054]

[0055] From the table, it can be seen that the memory bandwidth occupation at different times can be directly displayed through the program log, so as to facilitate positioning and analyzing the memory bandwidth problem.

[0056] As an application of the real-time monitoring system:

[0057] The real-time monitoring system and the software to be analyzed are run on the same CPU, and the timer periodically wakes up the monitoring module during the running of the software to be analyzed.

[0058] The real-time monitoring system is used to analyze the cause of the abnormal software, and the steps are as follows:

[0059] When the software to be analyzed is stuck, the time when the software is stuck is checked, the real-time memory bandwidth calculated by the real-time monitoring system is checked, and whether the memory bandwidth is too high is analyzed.

[0060] The system stores and displays the real-time memory bandwidth, so as to analyze the memory bandwidth consumption of the system at different times, and directly analyze the software abnormal problem caused by too high memory bandwidth occupation.

[0061] The foregoing description of specific exemplary embodiments presenting the application is for illustrative and descriptive purposes. The foregoing description is not intended to be all-inclusive or to be limited to the precise form disclosed, and obviously many modifications and variations are possible in light of the above teachings. The exemplary embodiments are chosen and described so that others skilled in the art can best understand the particular principles of the application and its practical application to and uses thereof, and so that others skilled in the art can best utilize the application in its various embodiments and with various modifications as are suited to the particular use contemplated. The scope of the application is to be defined by the following claims and their equivalents.

Claims

1. A real-time memory bandwidth monitoring system, characterized in that, The real-time monitoring system includes an initialization module and a monitoring module connected together; The initialization module is used to load configuration information and perform initialization. The configuration information includes total bandwidth, cached data volume s, and sampling time interval t; The initialization includes: creating cache space I and cache space II with a storage space of size s according to the cached data volume s, and filling cache space I and cache space II with data; creating a timer according to the sampling time interval t; The timer periodically wakes up the monitoring module according to the sampling time interval t; The monitoring module includes a data read / write module, a time consumption statistics module, a bandwidth calculation module, and a recording module connected in sequence. When the monitoring module is woken up, the data read / write module reads data from cache space I and writes it into cache space II in sequence; Meanwhile, the time required for the time consumption statistics module to write all the statistical data into the cache space II is recorded as the test time; The bandwidth calculation module calculates the memory bandwidth occupied by the amount of transmitted data s based on the test time, and records it as the monitoring bandwidth. The difference between the total bandwidth and the monitoring bandwidth is recorded as the real-time memory bandwidth. The recording module obtains the current monitoring time and stores and / or displays the current monitoring time in relation to the real-time memory bandwidth.

2. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: The cached data volume s = operating system clock precision × k × total bandwidth, where k is a preset precision coefficient, and its value is proportional to the monitoring error.

3. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: The real-time monitoring system and the software to be analyzed run on the same CPU. During the operation of the software to be analyzed, the timer periodically wakes up the monitoring module.

4. The real-time memory bandwidth monitoring system as described in claim 3, characterized in that: The steps for analyzing the causes of software anomalies using the real-time monitoring system are as follows: When the software being analyzed experiences a lag, check the real-time memory bandwidth calculated by the real-time monitoring system based on the time of the lag; analyze whether the memory bandwidth usage is too high.

5. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: Monitoring bandwidth = .

6. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: The current monitoring time and corresponding real-time memory bandwidth are stored in the program log of the real-time monitoring system.

7. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: The ratio of real-time memory bandwidth to total bandwidth is used as the bandwidth percentage for storage and / or display.

8. The real-time memory bandwidth monitoring system as described in claim 1, characterized in that: The read and write commands in the data read and write module are based on SIMD's unbuffered read and write technology.