Log data sending method and device and electronic equipment
By utilizing the remaining processing power of the IP packet accelerator in the communication processor, log data is filled into the area of the preset buffer excluding the fixed-length space and then transparently transmitted to the target device. This solves the problem of log data loss in the prior art and improves the reliability of log data acquisition and the efficiency of communication system debugging.
Patent Information
- Application Number
- CN202511554177.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-01-13
AI Technical Summary
In existing technologies, when test equipment sends log data through inter-core communication (such as SIPC), the limited bandwidth of the SIPC channel leads to frequent log data loss, low reliability of log data acquisition, and ineffective transmission.
By filling the area of the preset buffer excluding the fixed-length space with the log data to be sent, the remaining processing power of the IP packet accelerator in the communication processor is used to transmit IP data packets to the target device.
It improves the reliability of log data acquisition, avoids data loss, and enhances the efficiency and accuracy of communication system debugging and analysis.
Smart Images

Figure CN121333973A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, and in particular to a log data sending method and device and electronic equipment. BACKGROUND
[0002] After debugging a communication system, a developer needs to acquire log data of a test device in real time to analyze problems existing in the communication system after debugging.
[0003] In the prior art, log data of a test device can be sent to a target device through inter-core communication (for example, SIPC). The bandwidth of an SIPC channel is limited, and as the complexity of a communication protocol increases, log data significantly increases, and the problem of log data loss occurs frequently, which makes the reliability of acquiring log data low. SUMMARY
[0004] Embodiments of the present application provide a log data sending method, device and electronic equipment to improve the reliability of acquiring log data.
[0005] In a first aspect, an embodiment of the present application provides a log data sending method, comprising:
[0006] acquiring log data to be sent, the log data to be sent being log data generated by a test device for testing a communication system when debugging the communication system;
[0007] filling the log data to be sent into a region other than a fixed length space in a preset buffer to obtain an Internet Protocol (IP) data packet, the fixed length space being used to store IP protocol header information and User Datagram Protocol (UDP) protocol header information;
[0008] sending the IP data packet to a target device through remaining processing capacity of an IP packet accelerator in a communication processor.
[0009] In a possible implementation, sending the IP data packet to the target device through the remaining processing capacity of the IP packet accelerator in the communication processor comprises:
[0010] sending the IP data packet to the IP packet accelerator through a data exchange manager in the communication processor;
[0011] sending the IP data packet to the target device through the IP packet accelerator.
[0012] In a possible implementation, the fixed length space comprises an IP protocol header space and a UDP protocol header space; and filling the log data to be sent into the region other than the fixed length space in the preset buffer to obtain the IP data packet comprises:
[0013] determining IP protocol header information and UDP protocol header information corresponding to the target device;
[0014] filling the UDP protocol header information into the UDP protocol header space, filling the IP protocol header information into the IP protocol header space, and filling the to-be-sent log data into a region other than the fixed length space, to obtain the IP data packet.
[0015] In a possible implementation, the IP protocol header information includes a preset priority field; and determining the IP protocol header information corresponding to the target device includes:
[0016] determining a priority identifier corresponding to the to-be-sent log data;
[0017] updating the preset priority field as the priority identifier, to obtain the IP protocol header information.
[0018] In a possible implementation, sending, by the IP packet accelerator, the IP data packet to the target device includes:
[0019] obtaining the priority identifier in the IP data packet;
[0020] buffering the IP data packet to a target buffer queue corresponding to the priority identifier;
[0021] transmitting, according to the target buffer queue, the IP data packet to the target device.
[0022] In a possible implementation, filling the to-be-sent log data into a region other than the fixed length space includes:
[0023] determining a compression ratio of the to-be-sent log data according to a decompression capability of the target device, to reduce a sending data amount of the IP data packet;
[0024] performing compression processing on the to-be-sent log data according to the compression ratio, to obtain compressed log data;
[0025] filling the compressed log data into a region other than the fixed length space.
[0026] In a possible implementation, the method further includes:
[0027] determining a target byte occupied by the preset buffer area according to a generation rate of the log data, the target byte being greater than an occupied byte corresponding to the fixed length space;
[0028] adjusting the occupied byte corresponding to the preset buffer area as the target byte.
[0029] In a second aspect, the embodiments of the present application provide a log data sending device, comprising an obtaining module, a filling module and a sending module:
[0030] The obtaining module is configured to obtain to-be-sent log data, wherein the to-be-sent log data is log data generated by a test device for testing a communication system when the communication system is debugged;
[0031] The filling module is configured to fill the to-be-sent log data into a region other than a fixed length space in a preset buffer area to obtain an Internet Protocol (IP) data packet, wherein the fixed length space is used to store IP protocol header information and User Datagram Protocol (UDP) protocol header information;
[0032] The sending module is configured to send the IP data packet to a target device through a remaining processing capability of an IP packet accelerator in a communication processor.
[0033] In a possible implementation, the sending module is specifically configured to:
[0034] send the IP data packet to the IP packet accelerator through a data exchange manager in the communication processor;
[0035] send the IP data packet to the target device through the IP packet accelerator.
[0036] In a possible implementation, the fixed length space comprises an IP protocol header space and a UDP protocol header space; and the filling module is specifically configured to:
[0037] determine IP protocol header information and UDP protocol header information corresponding to the target device;
[0038] fill the UDP protocol header information into the UDP protocol header space, fill the IP protocol header information into the IP protocol header space, and fill the to-be-sent log data into the region other than the fixed length space to obtain the IP data packet.
[0039] In a possible implementation, the IP protocol header information comprises a preset priority field; and the filling module is specifically configured to:
[0040] determine a priority identifier corresponding to the to-be-sent log data;
[0041] update the preset priority field as the priority identifier to obtain the IP protocol header information.
[0042] In a possible implementation, the filling module is specifically configured to:
[0043] acquire the priority identifier in the IP packet;
[0044] cache the IP packet to a target cache queue corresponding to the priority identifier;
[0045] transmit the IP packet to the target device according to the target cache queue.
[0046] In a possible implementation, the filling module is specifically configured to:
[0047] determine a compression ratio of the to-be-sent log data according to a decompression capability of the target device, so as to reduce a sending data amount of the IP packet;
[0048] perform compression processing on the to-be-sent log data according to the compression ratio, to obtain compressed log data;
[0049] fill the compressed log data to a region other than the fixed-length space.
[0050] In a possible implementation, the apparatus further includes a determining module and an adjusting module:
[0051] The determining module is configured to determine a target byte occupied by the preset buffer area according to a generation rate of the log data, the target byte being greater than an occupied byte corresponding to the fixed-length space;
[0052] The adjusting module is configured to adjust the occupied byte corresponding to the preset buffer area to the target byte.
[0053] In a third aspect, an embodiment of the present application provides a chip, which includes an instruction processor, the processor being configured to execute computer execution instructions to implement the first aspect and / or various possible implementation manners of the first aspect.
[0054] In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor.
[0055] The memory stores computer execution instructions.
[0056] The processor executes the computer execution instructions stored in the memory, so that the processor executes the first aspect and / or various possible implementation manners of the first aspect.
[0057] In a fifth aspect, an embodiment of the present application provides a computer readable storage medium, which stores computer execution instructions, the computer execution instructions being configured to be executed by a processor to implement the first aspect and / or various possible implementation manners of the first aspect.
[0058] In a sixth aspect, an embodiment of the present application provides a computer program product, comprising a computer program which, when executed by a processor, implements the first aspect and / or various possible implementation manners of the first aspect.
[0059] The log data sending method, device and electronic equipment provided by the embodiments of the present application can obtain the log data to be sent, fill the log data to be sent into a region other than the fixed length space in the preset buffer area, obtain an IP data packet, and transmit the IP data packet to a target device through the remaining processing capacity of the IP packet accelerator in the communication processor. The log data is transmitted through the IP data packet, and the reliability of obtaining the log data can be improved. BRIEF DESCRIPTION OF DRAWINGS
[0060] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0061] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application is shown in the following figure.
[0062] Figure 2 A flowchart of a log data sending method provided by an embodiment of the present application is shown in the following figure.
[0063] Figure 3 An architecture diagram of a log data sending method provided by an embodiment of the present application is shown in the following figure.
[0064] Figure 4 A flowchart of a log data sending method provided by an embodiment of the present application is shown in the following figure.
[0065] Figure 5 An architecture diagram of a log data sending method provided by an embodiment of the present application is shown in the following figure.
[0066] Figure 6 A structure diagram of a log data sending device provided by an embodiment of the present application is shown in the following figure.
[0067] Figure 7 A structure diagram of an electronic device provided by an embodiment of the present application is shown in the following figure.
[0068] The above figures have shown the specific embodiments of the present application, and the following will have a more detailed description. These figures and textual descriptions are not intended to limit the scope of the concept of the present application by any means, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0069] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is only exemplary and is not intended to limit the scope, applicability or configuration of the application. Rather, the following description is intended to describe some exemplary embodiments consistent with the application and is not intended to limit the scope, applicability or configuration of the application. Rather, the exemplary embodiments are intended to be illustrative so that the application can be understood.
[0070] First, the terms involved in the present application are explained:
[0071] Internet Protocol (IP): is the core protocol of the network layer, used to realize the routing and sending of data between different network devices.
[0072] IP Packet Accelerator (IPA): is a hardware acceleration module integrated in the Communication Processor (CP), mainly used to improve the processing efficiency of IP packets.
[0073] Communication Processor (CP): also known as baseband processor, is a core chip component that focuses on processing communication protocols and underlying data transmission.
[0074] User Datagram Protocol (UDP): is a connectionless protocol at the sending layer, providing simple end-to-end data transmission services.
[0075] Shared Memory Inter-Processor Communication (SIPC): is a shared memory-based inter-processor communication mechanism, mainly used for data exchange between different processors (such as Application Processor AP and Communication Processor CP) in the same device.
[0076] Figure 1 The schematic diagram of the application scenario provided by the embodiments of the present application. Please refer to Figure 1 , the specific application scenario of the present application can include a test device 101 and a target device 102.
[0077] After debugging the communication system, the developer can test the debugged communication system through the test device 101. The communication system being tested will generate a large amount of log data during the test process, and the target device 102 needs to obtain the complete log data in real time to analyze the problems existing in the debugged communication system.
[0078] The test device 101 can send the log data to the target device 102 through the inter-core communication (for example, SIPC) by using the communication processor. The test device 101 and the target device 102 can be terminal devices such as mobile terminals, desktop computers, and notebook computers.
[0079] In the prior art, the log data of the test device can be sent to the target device through the inter-core communication (for example, SIPC). The bandwidth of the SIPC channel is limited. As the complexity of the communication protocol increases, the log data increases significantly, and the problem of log data loss occurs frequently, so that the reliability of obtaining the log data is low.
[0080] The sending method of the log data provided by the embodiments of the present application can obtain the log data to be sent, fill the log data to be sent into the area other than the fixed length space in the preset buffer area, obtain the IP data packet, and transmit the IP data packet to the target device through the remaining processing capacity of the IP packet accelerator in the communication processor. By sending the log data through the IP data packet, the reliability of obtaining the log data can be improved.
[0081] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail in the specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
[0082] Figure 2 A flowchart of a sending method of log data provided by an embodiment of the present application is shown. Please refer to Figure 2 The method can include:
[0083] S201, obtaining log data to be sent.
[0084] The execution subject of the embodiments of the present application can be a test device or a chip of the test device, or a log data sending device arranged in the test device or the chip of the test device. The log data sending device can be realized by software, or realized by the combination of software and hardware.
[0085] The log data to be sent can be log data generated during the running of the communication system being tested and collected by the test device during the debugging of the communication system.
[0086] The communication system can be a mobile communication system, such as a 4G communication system, a 5G communication system, or a 6G communication system.
[0087] During the test process, the test device can obtain the log data in real time and continuously until the test is completed.
[0088] When the log data reaches a certain amount or meets a preset triggering condition (such as a timing trigger or an abnormal event trigger), the log data to be sent can be obtained.
[0089] In S202, the log data to be sent is filled into a region other than the fixed-length space in the preset buffer to obtain an IP data packet.
[0090] The preset buffer can be a piece of memory applied for from a data path controller (DPC). For example, the preset buffer can be 4096 bytes.
[0091] The data path controller can be responsible for managing a data sending link, scheduling resource allocation, and coordinating data interaction timing between modules. For example, when the log data to be sent needs to be stored, an application is initiated to the DPC. The DPC allocates a preset size of buffer according to the system memory usage, and ensures the continuity and availability of the buffer, to provide storage space for subsequent data encapsulation (filling IP / UDP header and log data).
[0092] The fixed-length space can be used to store IP protocol header information and UDP protocol header information. The fixed-length space includes IP protocol header space and UDP protocol header space.
[0093] The IP protocol header information and the UDP protocol header information corresponding to the target device can be obtained; the UDP protocol header information is filled into the UDP protocol header space, the IP protocol header information is filled into the IP protocol header space, and the log data to be sent is filled into a region other than the fixed-length space to obtain an IP data packet.
[0094] The log data can be directly written into the preset buffer, without data copying operation throughout the process, to realize 0-copy transmission and reduce CPU overhead and delay.
[0095] For example, the fixed-length space occupies 28 bytes, of which the IP protocol header space occupies 20 bytes (in line with the IPv4 standard header length), and the UDP protocol header space occupies 8 bytes (in line with the UDP standard header length).
[0096] In some embodiments, the target bytes occupied by the preset buffer can be determined according to the generation rate of the log data, the target bytes being greater than the occupied bytes corresponding to the fixed-length space; and the occupied bytes corresponding to the preset buffer are adjusted to the target bytes.
[0097] The generation rate of the log data refers to the amount of log data generated by the tested communication system per unit time (such as 500 KB per second or 20 MB per minute), reflecting the output strength of the log data.
[0098] The generation rate of log data can be the core basis for dynamically adjusting the buffer size, ensuring that the buffer can adapt to the amount of log data in different scenarios, and avoiding buffer overflow (data loss) due to too high generation rate or waste of buffer resources due to too low generation rate.
[0099] The target bytes of the preset buffer occupancy refer to the optimal memory size (in bytes) that the buffer should allocate according to the log data generation rate.
[0100] For example, when the generation rate is 1MB per second, the target bytes can be set to 4096 bytes (4KB); when the rate increases to 5MB per second, the target bytes can be adjusted to 8192 bytes (8KB).
[0101] By presetting the target bytes of the buffer occupancy, it can be ensured that the buffer has enough space to temporarily store the log data (including IP / UDP header and log content) to be transmitted, while avoiding the invalid occupation of memory resources.
[0102] The fixed length space corresponds to the occupied bytes, which refers to the fixed memory size (such as 28 bytes, of which the IP header is 20 bytes and the UDP header is 8 bytes) reserved for the IP protocol header and the UDP protocol header in the buffer. The size of this space is determined by the protocol specification and does not change with the amount of log data.
[0103] The target bytes must be greater than the occupied bytes corresponding to the fixed length space, so that the remaining space can accommodate log data (whether it is original data or compressed data).
[0104] The amount of log data generated per unit time can be calculated in real time. For example: by using a timer to record the total number of bytes of log generated in 1 second, the current generation rate (such as 300KB / s) is obtained.
[0105] The target bytes can be calculated according to the monitored generation rate, which can be referred to as follows:
[0106]
[0107] Where A is the fixed length space byte, is the target byte, is the generation rate, is the safety factor, is the transmission delay estimate,
[0108] The safety factor (such as 1.2~1.5) can be used to cope with the sudden increase in generation rate and avoid buffer overflow.
[0109] The transmission delay estimation can refer to an average time consumption (e.g., 50 ms) from when the log data enters the buffer to when the IP packet accelerator completes the transmission, so as to ensure that the log generated in the time period can be accommodated by the buffer.
[0110] For example, the fixed length space is 28 bytes, the current generation rate is 1 MB / s (1024000 bytes / s), the safety factor is 1.2, and the transmission delay estimation is 10 ms (0.01 s). The amount of log data to be accommodated = 1024000*1.2*0.01 = 12288 bytes, and thus the target bytes = 28+12288 = 12316 bytes (about 12 KB).
[0111] The occupied bytes of the preset buffer can be adjusted to the target bytes by a data path controller (DPC).
[0112] If the memory is sufficient, the data path controller can release the original buffer (e.g., 4096 bytes), reallocate a memory block with the target bytes as a new buffer, and ensure the continuity of the new buffer (to meet the IP packet encapsulation requirement).
[0113] If the memory is insufficient, the data path controller can ensure that the target bytes are not less than the sum of the fixed length space and the minimum log accommodation amount (e.g., 28+1024 = 1052 bytes), to avoid that the buffer cannot be used, and trigger the memory resource scheduling (e.g., release the memory of a low-priority task).
[0114] In the present application, the buffer size can be dynamically adjusted, so that the buffer can provide sufficient space (to avoid data overflow and loss) when the log generation rate is high, and reduce the memory occupation (to improve the resource utilization) when the rate is low. In combination with the 0-copy transmission technology, the data processing delay and resource consumption are further reduced, and the reliability and real-time performance of the log data transmission are enhanced.
[0115] S203, sending the IP data packet to the target device by using the remaining processing capacity of the IP packet accelerator in the communication processor.
[0116] The IP packet accelerator can process the IP packet forwarding and protocol acceleration of the conventional communication data, and the remaining processing capacity of the IP packet accelerator refers to the hardware processing resources and bandwidth resources of the IP packet accelerator that are not fully utilized after the IP packet accelerator processes the core tasks.
[0117] IP packet accelerator is a hardware module in a communication processor (CP) responsible for accelerating IP packet processing. Its main responsibility is to process core data generated during normal communication of mobile devices (such as mobile phones), such as user data flow and signaling packets related to calls. These core tasks will occupy part of the performance of the IP packet accelerator, but in most scenarios (such as when the device is in a non-full load communication state), the processing capacity of the IP packet accelerator will not be completely exhausted, and there will be some free resources (such as hardware logic units, data buffers, and transmission bandwidth).
[0118] In this application, the remaining processing capacity of the IP packet accelerator is used to additionally process the IP packet encapsulation assistance, forwarding acceleration, and other CP-side log data, so that the log data can be sent without loss without affecting the normal communication function of the device.
[0119] IP data packets can be sent to the target device through PAM_USB. PAM_USB is a hardware link or protocol interface inside the mobile device used to connect the communication processor (CP) and the external interface, which is the full name of "Peripheral Access Module over USB".
[0120] The internal communication channel of the test device realized through the USB bus is connected to the IP packet accelerator (IPA) in the communication processor (CP) at one end and can be extended to the external USB interface (such as the USB port connected to the target device) at the other end. IP data packets corresponding to the log data to be sent can be provided with a high-speed and stable physical transmission path, supporting data transmission between the internal modules of the test device and the external target device.
[0121] Transparency refers to IP data packets sent from the test device to the target device without any analysis or modification.
[0122] The log data sending method provided by the embodiments of the present application can obtain log data to be sent, fill the log data to be sent into a region other than a fixed length space in a preset buffer, obtain an IP data packet, and send the IP data packet to a target device through the remaining processing capacity of the IP packet accelerator in the communication processor. By sending log data through IP data packets, the reliability of obtaining log data can be improved.
[0123] Figure 3 An architecture diagram of a log data sending method provided by an embodiment of the present application is provided. Please refer to Figure 3In the test device, the log data to be sent is encapsulated into an IP data packet. After receiving the encapsulated IP data packet, an IP packet accelerator (IPA) can transmit it directly to the PAM USB through a hardware link. The IP data packet transmitted by the IPA is transmitted through the USB bus protocol and finally reaches the target device. The target device can receive the IP data packet from the PAM USB through an external AP (access point, which can be understood as a USB interface or a network access module), thereby obtaining complete log data for analyzing the running state or problems of the communication system.
[0124] Figure 4 A flowchart of a log data sending method provided by an embodiment of the present application is shown. Please refer to Figure 4 The method can include:
[0125] S401, obtaining log data to be sent.
[0126] S402, determining IP protocol header information and UDP protocol header information corresponding to the target device.
[0127] The IP protocol header information can include a source IP address, a destination IP address, a protocol type, a time to live (TTL), a header length, a total length, etc. The UDP protocol header information can include a source port number, a destination port number, a datagram length (total length of the UDP header and data part), etc.
[0128] In some embodiments, the IP protocol header information further includes a preset priority field. A priority identifier corresponding to the log data to be sent can be determined; and the preset priority field is updated to the priority identifier to obtain the IP protocol header information.
[0129] When the log data is encapsulated, the priority field can be marked for log data of different priorities (such as error logs and normal logs), and the IP packet accelerator adjusts the transmission order of the IP data packet according to the priority.
[0130] The priority identifier can be embedded in the "Type of Service (ToS) field" or "Differentiated Services Code Point (DSCP) field" of the IP header.
[0131] Taking IPv4 as an example, the "Type of Service (ToS)" field in the first byte (8 bits) of the IP header, the first 3 bits are "priority (Precedence)", which can be directly used to mark the priority of the log data (0~7 levels, the higher the value, the higher the priority).
[0132] Since the log data is encapsulated into IP packets, the priority identifier is written into a standard field of the IP header, and the IP packet accelerator can identify the priority of the IP packet from the corresponding position of the priority identifier without occupying additional buffer space or destroying the IP protocol structure.
[0133] In the present application, high-priority log information (such as error information) can be ensured to be transmitted first, the debugging efficiency is improved, critical problems are not overwhelmed by low-priority log information, and the reliability of log information transmission is improved.
[0134] S403, filling the UDP protocol header information into the UDP protocol header space, filling the IP protocol header information into the IP protocol header space, and filling the to-be-sent log data into the area other than the fixed length space to obtain an IP packet.
[0135] In some embodiments, when filling the to-be-sent log data into the area other than the fixed length space, the compression ratio of the to-be-sent log data can be determined according to the decompression capability of the target device to reduce the transmission data volume of the IP packet; the to-be-sent log data is compressed according to the compression ratio to obtain compressed log data; and the compressed log data is filled into the area other than the fixed length space.
[0136] The decompression capability of the target device refers to the decompression processing capability of the target device receiving the log data per unit time. It mainly depends on the CPU performance, decompression algorithm support, and hardware acceleration capability (such as whether a hardware decompression engine is supported) of the target device.
[0137] The decompression capability of the target device can be used as a core basis for determining the compression ratio to avoid too long decompression time of the target device due to too high compression ratio, or too low data volume reduction due to too low compression ratio.
[0138] The compression ratio can refer to the volume ratio of the to-be-sent log data before and after compression (compression ratio = data volume before compression / data volume after compression), for example, a compression ratio of 10:1 means that 10MB of original log data is compressed to 1MB.
[0139] The compression ratio can balance the data volume reduction effect and the decompression pressure of the target device, maximize the reduction of the transmission volume of the IP packet under the premise of ensuring efficient decompression of the target device.
[0140] The compressed log data can reduce the effective data volume carried by a single IP packet, reduce the bandwidth occupation of the transmission link, reduce the data transmission delay and loss probability, and adapt to the transmission demand when the log data volume is large.
[0141] After the test device establishes a communication connection with the target device, the test device obtains the decompression capability parameters of the target device through a preset capability negotiation mechanism. The capability negotiation mechanism can be active inquiry or preset configuration.
[0142] The test device sends a query instruction to the target device to obtain information such as a supported decompression algorithm (such as LZ4, Deflate, Snappy, etc.) and a maximum decompression rate (such as 100 MB / s) of the target device.
[0143] The decompression capability threshold of the target device can also be preset in the test device according to the known performance of the target device (such as the CPU model and configuration parameters of the target device), for example, a high compression ratio is preset for a high-performance PC, and a low compression ratio is preset for a low-performance device.
[0144] According to the obtained decompression capability of the target device, the optimal compression ratio is determined in combination with the type of the log data to be sent (for example, text logs have a large compression potential, and binary logs have a small compression potential).
[0145] For example, if the target device is a high-performance PC (supports the LZ4 algorithm and has a decompression rate of 500 MB / s), and the log to be sent is a text error log (has a large compression potential), a high compression ratio (such as 8:1) is determined. If the target device is a low-performance terminal (only supports the basic Deflate algorithm and has a decompression rate of 50 MB / s), and the log to be sent is a mixed type log, a low compression ratio (such as 3:1) is determined to avoid long decompression time.
[0146] The log data transmission device calls a preset compression algorithm (matched with the decompression algorithm of the target device, such as the LZ4 algorithm if the target device supports the LZ4 algorithm), and compresses the log data to be sent according to the determined compression ratio.
[0147] During the compression process, the algorithm reduces the data volume by deleting data redundancy (such as repeated timestamps and fixed field prefixes in text logs) and encoding optimization, and finally generates compressed log data.
[0148] The IP protocol header information and the UDP protocol header information can be filled into the corresponding areas of the fixed length space first; then the compressed log data is filled into the remaining areas of the buffer except the fixed length space, and finally the complete IP data packet is encapsulated and waits for subsequent transmission to the target device through the IP packet accelerator.
[0149] In the present application, by means of on-demand adaptive compression ratio, the amount of data transmission is effectively reduced by data compression, the bandwidth pressure of the transmission link is alleviated, and the risk of log data loss is reduced; by matching the decompression capability of the target device, the decompression delay caused by excessive compression is avoided, ensuring that the target device can timely analyze and display the log data, and the transmission efficiency and data processing fluency are taken into account.
[0150] S404, sending the IP data packet to the IP packet accelerator through the data exchange manager in the communication processor.
[0151] S405, sending the IP data packet to the target device through the IP packet accelerator.
[0152] In some embodiments, the priority identifier is obtained in the IP data packet; the IP data packet is cached to the target cache queue corresponding to the priority identifier; and the IP data packet is transparently transmitted to the target device according to the target cache queue.
[0153] The priority identifier is used to distinguish the importance of log data (such as marking error logs as high priority and ordinary state logs as low priority), which can be used as a basis for IP packet accelerator scheduling to ensure that critical data is transmitted first.
[0154] The target cache queue is a special cache queue allocated by the IP packet accelerator for different priority data (such as high priority queue, medium priority queue, and low priority queue).
[0155] Each special cache queue corresponds to a specific priority identifier and is used to temporarily store IP data packets to be transmitted. Differentiated scheduling can be achieved by isolating special cache queues to avoid high-priority data being blocked by low-priority data.
[0156] When the IP data packet (containing log data) is forwarded to the IP packet accelerator by the data exchange manager, the IP packet accelerator first parses the header information of the IP data packet and locates the field where the priority identifier is located (such as the first 3 bits of the ToS field of IPv4).
[0157] For example, if the first 3 bits of the ToS field of the IP header are "111" (corresponding to level 7, the highest priority), the data packet is identified as high-priority log (such as system crash error log).
[0158] The IP packet accelerator has a cache queue corresponding to the priority identifier (such as "high priority queue" for level 7, "medium priority queue" for level 3, and "low priority queue" for level 0) preset inside.
[0159] According to the priority identifier, the IP packet accelerator stores the IP data packet into the corresponding target cache queue. For example, the high-priority log data packet enters the "high-priority queue", and the low-priority log data packet enters the "low-priority queue", so as to realize the classified temporary storage of data.
[0160] The IP packet accelerator can adopt a priority preemption scheduling strategy: the data packet in the high-priority queue is preferentially processed, and only when the high-priority queue is empty, the data packet in the low-priority queue is processed.
[0161] Specifically, the IP packet accelerator reads the IP data packet from the target cache queue in order and transmits it to the target device through the PAM_USB physical interface. For example, if there is a data packet in the high-priority queue, even if there is a data accumulation in the low-priority queue, the IP packet accelerator will first transmit the content of the high-priority queue until it is empty, and then process the low-priority queue.
[0162] In this application, through the above process, it is ensured that the high-priority log data (such as critical error information) can be transmitted preferentially by queuing, avoiding being blocked by a large number of low-priority logs (such as regular state records), so that the developer can obtain critical information preferentially when debugging, improve the problem positioning efficiency, and further enhance the reliability and practicality of log transmission.
[0163] The log data sending method provided by the embodiment of the application can encapsulate log data by using a standard IP / UDP protocol, and complete efficient transmission by means of the remaining processing capacity of the IP packet accelerator, thereby avoiding the bandwidth limitation and data loss risk of traditional inter-core communication (such as SIPC), improving the integrity, real-time performance and reliability of log data transmission, and at the same time, being compatible with general network protocols and transmission links, reducing the interfacing complexity of the test device and the target device, and further improving the efficiency and accuracy of communication system debugging and analysis.
[0164] The target device can construct a socket to receive data. For the out-of-order problem, the target device can solve it by sorting. After the target device receives the IP data packet, the target device can parse the IP data packet to obtain complete log data.
[0165] The target device can sort the out-of-order IP data packets based on the sequence number in the UDP header of the received IP data packet or the timestamp carried in the log data, to restore the time sequence integrity of the log data. In the sorting process, the time sequence of the IP data packet marked with high priority can be preferentially restored, to ensure that the critical log information is preferentially presented in the original order.
[0166] Figure 5 An architecture diagram of a log data sending method provided by an embodiment of the application is shown. Please refer to Figure 5The target device can inform the TCP / IP module of the test device of the IP address and the UDP port number of the target device through an attention (AT) instruction, so as to deliver the IP address and the UDP port number for subsequent encapsulation and transmission of log data.
[0167] The TCP / IP module of the test device saves the received IP address and UDP port number locally and configures the IP address and the UDP port number into a global variable, so as to provide target address information for subsequent log encapsulation. The TCP / IP module can provide a special interface logbyip_encapip for filling an IP / UDP header in front of log data.
[0168] The test device can call an interface provided by a data path controller (DPC) to apply for a preset buffer (such as 4096 bytes) and store log data to be transmitted in the preset buffer.
[0169] The test device transmits the buffer for storing log data to the logbyip_encapip interface of the TCP / IP module, and the TCP / IP module fills IP protocol header information (source IP, destination IP, etc.) and UDP protocol header information (source port, destination port, etc.) in a fixed length space (such as 28 bytes, including 20 bytes of an IP header and 8 bytes of a UDP header) at the head of the buffer, so as to complete encapsulation of an IP packet.
[0170] The test device calls an interface provided by a data switch manager (DSM) to send the encapsulated IP packet to an IP packet accelerator (IPA) and transmits the IP packet to the target device by using the remaining processing capacity of the IPA.
[0171] Figure 6 A structure diagram of a log data sending device provided by an embodiment of the present application is shown in FIG. 6. Figure 6 The log data sending device 600 can include an acquisition module 601, a filling module 602, and a sending module 603.
[0172] The acquisition module 601 is configured to acquire log data to be sent. The log data to be sent is log data generated by a test device for testing a communication system when the communication system is debugged.
[0173] The filling module 602 is configured to fill the log data to be sent into a region of a preset buffer except a fixed length space, so as to obtain an internet protocol (IP) packet. The fixed length space is used to store IP protocol header information and user datagram protocol (UDP) protocol header information.
[0174] The sending module 603 is configured to send the IP packet to a target device by using the remaining processing capacity of an IP packet accelerator in a communication processor.
[0175] In a possible implementation, the sending module 603 is specifically configured to include the following steps.
[0176] sending the IP data packet to the IP packet accelerator through a data exchange manager in the communication processor;
[0177] sending the IP data packet to the target device through the IP packet accelerator.
[0178] In a possible implementation, the fixed-length space includes an IP protocol header space and a UDP protocol header space; and the filling module 602 is specifically configured to include the following steps.
[0179] determining IP protocol header information and UDP protocol header information corresponding to the target device;
[0180] filling the UDP protocol header information into the UDP protocol header space, filling the IP protocol header information into the IP protocol header space, and filling the log data to be sent into a region other than the fixed-length space, to obtain the IP data packet.
[0181] In a possible implementation, the IP protocol header information includes a preset priority field; and the filling module 602 is specifically configured to include the following steps.
[0182] determining a priority identifier corresponding to the log data to be sent;
[0183] updating the preset priority field as the priority identifier to obtain the IP protocol header information.
[0184] In a possible implementation, the filling module 602 is specifically configured to include the following steps.
[0185] obtaining the priority identifier in the IP data packet;
[0186] caching the IP data packet to a target cache queue corresponding to the priority identifier;
[0187] transmitting the IP data packet to the target device in a transparent manner according to the target cache queue.
[0188] In a possible implementation, the filling module 602 is specifically configured to include the following steps.
[0189] determining a compression ratio of the log data to be sent according to a decompression capability of the target device, to reduce a sending data amount of the IP data packet;
[0190] performing compression processing on the log data to be sent according to the compression ratio, to obtain compressed log data;
[0191] filling the compressed log data into a region other than the fixed-length space.
[0192] In a possible implementation, the apparatus further includes a determining module and an adjusting module:
[0193] The determining module is configured to determine a target byte occupied by the preset buffer according to a generation rate of the log data, the target byte being greater than the occupied byte corresponding to the fixed-length space.
[0194] The adjusting module is configured to adjust the occupied byte corresponding to the preset buffer to the target byte.
[0195] The sending device of log data provided in the embodiment can execute the method provided by the processing device in the above embodiment, and has similar implementation principles and technical effects. Therefore, the embodiment will not be described here.
[0196] Figure 7 A structural schematic diagram of an electronic device is provided in the embodiment. Please refer to Figure 7 The electronic device 700 can include a processor 701 and a memory 702. The processor 701, the memory 702, and the parts are connected to each other through a bus 703.
[0197] The memory 702 stores computer execution instructions.
[0198] The processor 701 executes the computer execution instructions stored in the memory 702, so that the processor 701 executes the sending method of log data as shown in the above embodiment.
[0199] The electronic device can be a chip, a module, an integrated development environment (IDE), or the like.
[0200] Correspondingly, the embodiment of the present application provides a chip, which includes at least one processor, and the processor is configured to execute computer execution instructions to implement the sending method of log data in the above method embodiment.
[0201] Correspondingly, the embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions, and the computer execution instructions are configured to implement the sending method of log data in the above method embodiment when executed by the processor.
[0202] Correspondingly, the embodiment of the present application can also provide a computer program product, which includes a computer program, and the computer program can implement the sending method of log data as shown in the above method embodiment when executed by the processor.
[0203] The computer readable storage medium and the computer program product of the embodiment of the present application can execute the method provided by the above embodiment, and the specific implementation process and beneficial effects are described above, and will not be described here.
[0204] All or part of the steps of the above-mentioned embodiments can be accomplished by program instruction related hardware. The aforementioned program can be stored in a readable memory. The program, when executed, performs steps including the above-mentioned embodiments; and the aforementioned memory (storage medium) includes: a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk, a solid state disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof.
[0205] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and a combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to produce a machine, so that the instructions executed by the computer or other programmable data processing devices generate a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0206] These computer program instructions can also be stored in a computer readable memory that can direct the computer or other programmable data processing devices to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including instruction apparatus, which implements the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0207] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer implemented process, so that the instructions executed on the computer or other programmable device provide a process for implementing the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow(s) or block(s).
[0208] Obviously, those skilled in the art can make various modifications and variations to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A log data transmission method characterized by comprising: The method comprises: obtaining to-be-sent log data, the to-be-sent log data being log data generated by a test device for testing a communication system when the communication system is debugged; filling the to-be-sent log data into a region other than a fixed length space in a preset buffer to obtain an Internet Protocol (IP) data packet, the fixed length space being used for storing IP protocol header information and User Datagram Protocol (UDP) protocol header information; sending the IP data packet to a target device through remaining processing capacity of an IP packet accelerator in a communication processor.
2. The method of claim 1, wherein, The method of sending the IP data packet to the target device through the remaining processing capacity of the IP packet accelerator in the communication processor comprises: sending the IP data packet to the IP packet accelerator through a data exchange manager in the communication processor; sending the IP data packet to the target device through the IP packet accelerator.
3. The method according to claim 1 or 2, characterized in that, The fixed length space comprises an IP protocol header space and a UDP protocol header space; and the filling of the to-be-sent log data into the region other than the fixed length space in the preset buffer to obtain the IP data packet comprises: determining IP protocol header information and UDP protocol header information corresponding to the target device; filling the UDP protocol header information into the UDP protocol header space, filling the IP protocol header information into the IP protocol header space, and filling the to-be-sent log data into the region other than the fixed length space to obtain the IP data packet.
4. The method of claim 3, wherein, The IP protocol header information comprises a preset priority field. The determination of the IP protocol header information corresponding to the target device comprises: determining a priority identifier corresponding to the to-be-sent log data; updating the preset priority field as the priority identifier to obtain the IP protocol header information.
5. The method of claim 4, wherein, The sending of the IP data packet to the target device through the IP packet accelerator comprises: obtaining the priority identifier in the IP data packet; caching the IP data packet to a target cache queue corresponding to the priority identifier; and transmitting the IP data packet to the target device according to the target cache queue.
6. The method of claim 3, wherein, The filling of the to-be-sent log data into the region other than the fixed length space comprises: determining a compression ratio of the to-be-sent log data according to decompression capability of the target device, to reduce a sending data amount of the IP data packet; performing compression processing on the to-be-sent log data according to the compression ratio to obtain compressed log data; and filling the compressed log data into the region other than the fixed length space.
7. The method of claim 1, wherein, The method further comprises: determining a target byte occupied by the preset buffer according to a generation rate of the log data, the target byte being greater than an occupied byte corresponding to the fixed length space; and adjusting the occupied byte corresponding to the preset buffer as the target byte.
8. A log data transmitting apparatus characterized by comprising: The method comprises an obtaining module, a filling module, and a sending module: the obtaining module is configured to obtain to-be-sent log data, the to-be-sent log data being log data generated by a test device for testing a communication system when the communication system is debugged; The filling module is used for filling the to-be-sent log data into an area other than a fixed length space in a preset buffer to obtain an Internet Protocol (IP) data packet, and the fixed length space is used for storing IP protocol header information and User Datagram Protocol (UDP) protocol header information. The sending module is used for sending the IP data packet to a target device through remaining processing capacity of an IP packet accelerator in a communication processor.
9. A chip, characterized by The chip comprises at least one processor, and the processor is used for executing computer execution instructions to execute the log data sending method in any one of claims 1 to 7.
10. An electronic device, comprising: Comprise: a processor, a memory; The memory stores a computer program; The processor invokes the computer program stored in the memory, so that the electronic device executes the log data sending method in any one of claims 1 to 7.