Method and system for adaptively selecting log output mode on basis of communication rate, and device
By adaptively selecting the LOG output method, the problem of mismatch between communication rate and LOG output rate in the existing technology is solved, thus improving the reliability of test results and communication efficiency.
Patent Information
- Application Number
- PCT/CN2025/100494
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-24
- Filing Date
- 2025-06-11
- Publication Date
- 2026-01-02
AI Technical Summary
In existing technologies, the output rate of communication logs cannot be flexibly selected and cannot be adaptively adjusted according to the communication rate, resulting in inconsistent test results and communication delays.
By reading the input data from the SPI communication test tool, including the communication rate parameters, the system adaptively selects the LOG output mode, and combines the initialization status and output frequency to choose the most suitable LOG output mode.
It achieves adaptive selection of LOG output mode based on communication rate, avoiding communication delay and ensuring the reliability and consistency of test results.
Smart Images

Figure CN2025100494_02012026_PF_FP_ABST
Abstract
Description
Method, system and device for adaptive selection of log output mode based on communication rate TECHNICAL FIELD
[0001] The present application relates to the technical field of LOG log output, and in particular to a method, system and device for adaptive selection of log output mode based on communication rate. BACKGROUND
[0002] In a multi-system or multi-device architecture, communication between systems and devices ensures stable, secure and efficient operation of the entire architecture. Therefore, communication testing between systems and devices is an essential step in the development process. Real-time viewing and detailed recording of LOG logs can help identify communication abnormalities and faults between systems and devices, so the consistency of the testing process with the actual situation and the completeness of the communication LOG logs become the focus of this process. The recording and output rate of LOG logs affects the quality and authenticity of communication testing. If the output rate of communication LOG logs does not meet the communication rate between systems and devices, it will cause communication delays and congestion, which does not match the actual situation, and the test results are no longer reliable.
[0003] The disadvantages of the existing output communication LOG log technical solution are as follows:
[0004] 1. There is only one output and save method for communication LOG logs at the same time, and the LOG log save or output mode cannot be flexibly selected.
[0005] In a complex architecture, the communication rates between systems and devices vary. Even between the same system or device, the communication rate may vary depending on the use scenario. In different rate scenarios, there are different requirements for the output or save rate of communication LOG logs. The rate of some LOG output modes cannot meet the communication rate between systems or devices, for example, the LOG output mode of serial output to the terminal cannot meet the requirement of high-speed communication. At this time, if the LOG save or output mode is changed, the tool needs to be recompiled or other test tools need to be replaced, which affects the testing efficiency.
[0006] 2. There is no evaluation of whether the communication rate and the LOG log save or output rate are synchronized. If the communication rate is higher than the LOG log save or output rate, it will cause communication delays.
[0007] In the communication between the test system and the device, the test personnel can only obtain the communication rate between the system and the device from the configuration file, but cannot obtain the saving or output rate of the test software LOG. In the subsequent test process, if the saving or output rate of the communication LOG is less than the communication rate, the communication interval time becomes longer, the communication delay is caused, the communication rate in the test condition is inconsistent with the communication rate in the actual operation, and the test result is unreliable and cannot reflect the running condition under the actual communication rate.
[0008] 3. The most suitable LOG log saving or output mode cannot be adaptively selected according to the communication rate;
[0009] In the test process, under different use conditions and environments, the user cannot predict whether the communication rate and the LOG output rate are matched most of the time, so the test personnel cannot select the appropriate LOG output mode with reference to the basis and standard. If the LOG output mode is selected incorrectly, the communication delay and congestion are caused, and the test personnel cannot know this problem in time. If the test software does not have other LOG output modes or cannot automatically switch to the LOG output mode with the matched rate, the test result is unreliable at this time, and the performance and quality of the product are affected. SUMMARY
[0010] Therefore, it is necessary to provide a method, system and device for adaptively selecting a LOG output mode based on a communication rate to solve the above technical problems.
[0011] In a first aspect, the application provides a method for adaptively selecting a LOG output mode based on a communication rate, which comprises the following steps.
[0012] reading input data of an SPI communication test tool; the input data of the SPI communication test tool at least comprises an SPI communication rate parameter;
[0013] adaptively selecting a matched LOG log output mode according to the SPI communication rate parameter and a pre-defined priority of selecting the LOG log output mode;
[0014] screening the selected LOG log output mode in combination with an initialization state and a LOG log output frequency of each LOG log output mode, and determining a LOG log output mode meeting the user demand;
[0015] receiving a requested instruction message from a user end, and performing a corresponding operation according to the content of the parsed instruction message.
[0016] Optionally, the reading of the input data of the SPI communication test tool comprises the following steps.
[0017] After the CSC vehicle machine system is powered on, the application system to be tested in the CSC vehicle machine system establishes SPI communication with the MCU microcontroller through the SPI communication interface;
[0018] The SPI communication link of the application system to be tested is initialized, and after the SPI communication link initialization is successful, the LOG log information generated in the SPI communication test process is collected, the SPI communication rate parameter between the application system to be tested and the MCU microcontroller is acquired, and the SPI communication test tool is input.
[0019] Optionally, the priority of the defined LOG log output mode includes:
[0020] The SPI communication rate parameter range is divided in combination with the historical input data of the SPI communication test tool;
[0021] A plurality of LOG log output modes adapted to different SPI communication rate parameter ranges are defined, and each LOG log output mode includes a LOG log output mode parameter and / or an output address parameter;
[0022] The LOG log output mode includes a first output mode, a second output mode and a third output mode; the first output mode is to output the LOG log in a terminal output mode; the second output mode is to output the LOG log in a file storage mode; and the third output mode is to output the LOG log in a network output mode;
[0023] The priority of the LOG log output mode is set; the priority of the second output mode is less than that of the first output mode and greater than that of the third output mode.
[0024] Optionally, the adaptive selection of the matching LOG log output mode according to the SPI communication rate parameter and the pre-defined priority of the LOG log output mode includes:
[0025] The SPI communication rate parameter is read;
[0026] According to the SPI communication rate parameter range corresponding to the SPI communication rate parameter, a plurality of LOG log output modes adapted to the SPI communication rate parameter range are selected;
[0027] According to the pre-defined priority of the LOG log output mode, the LOG log output mode is adaptively selected.
[0028] Optionally, the determination of the LOG log output mode meeting the user demand in combination with the SPI communication link initialization state and the LOG log output frequency under the selected LOG log output mode includes:
[0029] selecting the LOG log output mode in turn according to the LOG log output frequency from low to high and the LOG log output mode priority of the pre-defined second output mode which is less than the first output mode and greater than the third output mode;
[0030] after each selected LOG log output mode, judging the initialization state under the currently selected LOG log output mode; if the initialization is normal, outputting the LOG log through the current LOG log output mode; if the initialization is abnormal, repeating the initialization operation until a preset number of times, and if the initialization is still unsuccessful after the preset number of times, exiting the test flow;
[0031] when the first output mode is selected as the LOG log output mode, judging the initialization state under the currently selected LOG log output mode, if the initialization state is not abnormal, calculating the time for outputting the LOG log in the first output mode; calculating the communication interval by subtracting the LOG log output frequency in the unit time of the first output mode from the SPI communication rate, and judging whether the first output mode for outputting the LOG log meets the user demand; if the obtained communication interval does not exceed a preset communication interval threshold, using the first output mode to output the LOG log; otherwise, judging whether the second output mode meets the user demand;
[0032] when the second output mode is selected as the LOG log output mode, judging the initialization state under the currently selected LOG log output mode, if the initialization state is not abnormal, calculating the time for outputting the LOG log in the second output mode; calculating the communication interval by subtracting the LOG log output frequency in the unit time of the second output mode from the SPI communication rate, and judging whether the second output mode for outputting the LOG log meets the user demand; if the obtained communication interval does not exceed a preset communication interval threshold, using the second output mode to output the LOG log; otherwise, judging whether the third output mode meets the user demand; if yes, using the third output mode to output the LOG log.
[0033] Optionally, the judging whether the third output mode meets the user demand comprises: when the third output mode is selected as the LOG log output mode, judging the initialization state under the currently selected LOG log output mode; calculating the time for outputting the LOG log in the third output mode, and if the communication interval obtained by subtracting the LOG log output frequency in the unit time of the third output mode from the SPI communication rate does not exceed a communication interval threshold, using the third output mode to output the LOG log; otherwise, terminating the test.
[0034] Optionally, the time of outputting the LOG log comprises: obtaining the time required for outputting the LOG log by recording the start and end time stamps of the LOG log output.
[0035] Optionally, the executing corresponding operation according to the parsed instruction message content comprises: receiving the requested instruction message from the user end when the SPI communication test tool is started by the user end.
[0036] The LOG log output parameter specified based on the user demand in the instruction message is obtained, and the corresponding LOG log output mode is matched; the LOG log output parameter comprises a LOG log output mode parameter and / or an output address parameter.
[0037] In the SPI communication test process, the matched LOG log output mode is initialized; after the initialization is completed, the LOG log information generated in the SPI communication test process is output by using the LOG log output mode corresponding to the specified LOG log output parameter.
[0038] In a second aspect, the present application provides a system for adaptively selecting a LOG output mode based on a communication rate, comprising:
[0039] An SPI communication module is configured to read input data of an SPI communication test tool; the input data of the SPI communication test tool at least comprises an SPI communication rate parameter.
[0040] An output selection module is configured to adaptively select a matched LOG log output mode according to the SPI communication rate parameter and a pre-defined priority of selecting the LOG log output mode.
[0041] A verification module is configured to filter the selected LOG log output mode by combining the initialization state and the LOG log output frequency under each LOG log output mode, and determine a LOG log output mode meeting the user demand.
[0042] A LOG log output module is configured to receive a requested instruction message from a user end, and execute a corresponding operation according to the parsed content of the instruction message.
[0043] In a third aspect, the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to realize the steps of the method in any one of the first aspect.
[0044] The method, system and device for adaptively selecting a LOG output mode based on a communication rate proposed in the above solution is to adaptively select a LOG output mode based on a communication rate between systems. In the method, multiple LOG output modes can be provided for a test process, and each LOG output mode corresponds to a different SPI communication rate. Thus, a user can manually specify a LOG output mode during the test process, or the method can be used to calculate the output rate of a communication LOG between two systems according to the communication rate between the two systems, and then adaptively select a LOG output mode with a matching rate.
[0045] Using the method, a user can flexibly select a LOG log output mode that is most beneficial to testing, avoid a LOG log output mode that does not meet the testing requirements, and avoid communication delay caused by a LOG log output rate that is less than the communication rate between systems, so that the communication rate between systems in a testing environment matches the actual communication rate.
[0046] When a user cannot predict which rate between the communication rate between systems and the rate of a certain LOG log output mode is faster, the method can be used to adaptively select a LOG output mode with a matching rate, speed up the testing process, and avoid the adverse effects of a LOG log output on the test results of communication between systems. BRIEF DESCRIPTION OF DRAWINGS
[0047] In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the drawings needed in the specific embodiments or the prior art description will be briefly introduced below. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual proportions.
[0048] FIG. 1 is a flowchart of a method for adaptively selecting a LOG output mode based on a communication rate in an embodiment;
[0049] FIG. 2 is a system architecture diagram of adaptively selecting a LOG output mode in a communication test process between an entertainment system and a vehicle control system in a CSC vehicle machine in an embodiment;
[0050] FIG. 3 is a flowchart of adaptively selecting a LOG output mode based on a communication rate in an embodiment;
[0051] FIG. 4 is a system structure diagram of adaptively selecting a LOG output mode based on a communication rate in an embodiment;
[0052] FIG. 5 is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application is further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0054] The method, system and device for adaptively selecting a LOG output mode based on a communication rate provided by the embodiments of the present application are mainly applied to a car machine device. The method can be applied to a terminal, a server, a system comprising a terminal and a server, and is realized through the interaction of the terminal and the server. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and the like.
[0055] In one embodiment, as shown in FIG. 1, a method for adaptively selecting a LOG output mode based on a communication rate is provided, and the method comprises the following features:
[0056] S101 reads input data of an SPI communication test tool; the input data of the SPI communication test tool at least comprises an SPI communication rate parameter;
[0057] S102 adaptively selects a matching LOG log output mode according to the SPI communication rate parameter and a pre-defined priority of selecting the LOG log output mode;
[0058] S103 screens the selected LOG log output mode in combination with an initialization state and a LOG log output frequency under each LOG log output mode, and determines a LOG log output mode meeting user demand;
[0059] S104 receives a requested instruction message from a user end, and performs a corresponding operation according to the content of the parsed instruction message.
[0060] In the above embodiment, step S101 of reading input data of an SPI communication test tool comprises:
[0061] After the CSC car machine system is powered on, a to-be-tested application system in the CSC car machine system establishes an SPI communication with an MCU microcontroller through an SPI communication interface;
[0062] The SPI communication link of the to-be-tested application system is initialized, and after the SPI communication link initialization is successful, LOG log information generated in an SPI communication test process is collected, an SPI communication rate parameter between the to-be-tested application system and the MCU microcontroller is acquired, and the SPI communication test tool is input.
[0063] In the above embodiment, step S102 of defining a priority of selecting a LOG log output mode comprises:
[0064] dividing the SPI communication rate parameter range in combination with historical input data of the SPI communication test tool;
[0065] defining multiple LOG log output modes adapted to different SPI communication rate parameter ranges, each of the LOG log output modes comprising a LOG log output mode parameter and / or an output address parameter;
[0066] The LOG log output modes comprise a first output mode, a second output mode and a third output mode. The first output mode is to output the LOG log in a terminal output mode. The second output mode is to output the LOG log in a file storage mode. The third output mode is to output the LOG log in an Ethernet output mode.
[0067] A priority of selecting the LOG log output modes is set. The priority of the second output mode is lower than that of the first output mode and higher than that of the third output mode.
[0068] Further, in the above embodiment, the step S102 of adaptively selecting the matching LOG log output mode according to the SPI communication rate parameter and the pre-defined priority of selecting the LOG log output mode comprises:
[0069] reading the SPI communication rate parameter;
[0070] selecting, according to the SPI communication rate parameter range corresponding to the SPI communication rate parameter, multiple LOG log output modes adapted to the SPI communication rate parameter range;
[0071] adaptively selecting the LOG log output mode according to the pre-defined priority of selecting the LOG log output mode.
[0072] In the above embodiment, the step S103 of determining the LOG log output mode meeting the user demand in combination with the SPI communication link initialization state and the LOG log output frequency under the selected LOG log output mode comprises:
[0073] selecting the LOG log output mode in turn according to the order from low to high of the LOG log output frequency and the pre-defined LOG log output mode priority that the priority of the second output mode is lower than that of the first output mode and higher than that of the third output mode;
[0074] After each selected LOG log output mode, the initialization state under the currently selected LOG log output mode is judged. If the initialization is normal, the LOG log is output through the current LOG log output mode. If the initialization is abnormal, the initialization operation is repeated for a preset number of times. If the initialization is still unsuccessful after the preset number of times, the test process is exited.
[0075] When the first output mode is selected as the output mode of the LOG log, a current selected initialization state under the LOG log output mode is judged, and if the initialization state does not appear abnormal, a time for outputting the LOG log in the first output mode is calculated; a LOG log output frequency of the time for outputting the LOG log in the first output mode in a unit time is subtracted from an SPI communication rate to obtain a communication interval, and whether the first output mode for outputting the LOG log meets user demand is judged; if the obtained communication interval does not exceed a preset communication interval threshold, the first output mode is used to output the LOG log; otherwise, whether the second output mode meets user demand is judged;
[0076] When the second output mode is selected as the output mode of the LOG log, a current selected initialization state under the LOG log output mode is judged, and if the initialization state does not appear abnormal, a time for outputting the LOG log in the second output mode is calculated; a LOG log output frequency of the time for outputting the LOG log in the second output mode in a unit time is subtracted from an SPI communication rate to obtain a communication interval, and whether the second output mode for outputting the LOG log meets user demand is judged; if the obtained communication interval does not exceed a preset communication interval threshold, the second output mode is used to output the LOG log; otherwise, whether the third output mode meets user demand is judged; if yes, the third output mode is used to output the LOG log.
[0077] In the embodiment, whether the third output mode meets user demand includes: when the third output mode is selected as the output mode of the LOG log, a current selected initialization state under the LOG log output mode is judged; a time for outputting the LOG log in the third output mode is calculated, and a LOG log output frequency of the time for outputting the LOG log in the third output mode in a unit time is subtracted from a communication SPI communication rate to obtain a communication interval which does not exceed a communication interval threshold, and then the third output mode is used to output the LOG log; otherwise, the test is terminated.
[0078] In the embodiment, the time for outputting the LOG log includes: a start and end time stamp of the LOG log output is recorded to obtain the time required for outputting the LOG log.
[0079] In the above embodiment, the step S104 includes: when the SPI communication test tool is started by the user end, a requested instruction message is received from the user end according to the parsed instruction message content.
[0080] The LOG log output parameter specified based on user demand in the instruction message is obtained, and a corresponding LOG log output mode is matched; the LOG log output parameter includes a LOG log output mode parameter and / or an output address parameter.
[0081] In the SPI communication test process, the matched LOG log output mode is initialized; after the initialization is completed, the LOG log information generated in the SPI communication test process is output by using the LOG log output mode corresponding to the specified LOG log output parameter.
[0082] Optionally, based on the above content, specific embodiments are provided:
[0083] Taking the CSC vehicle machine system as an example, FIG. 2 is a system architecture diagram of the CSC vehicle machine in which the entertainment system and the vehicle control system are adaptively selected in a LOG log output mode according to a communication rate in a communication test process. In the entire architecture, the vehicle machine entertainment system and the vehicle control system communicate through SPI, and the LOG information generated in the communication process is transmitted to the LOG module. The LOG information in the LOG module is selected by the output selection module to select the LOG log output mode. In the output selection module, the output mode of the LOG log can be selected according to the parameters provided by the user when starting the system intercommunication test tool, or the output mode of the LOG log can be adaptively selected according to the system intercommunication rate and the LOG output rate.
[0084] In the method, multiple LOG log output modes can be provided according to different rate requirements and test needs. Three modes are provided in the diagram. The rates are as follows:
[0085] 1. The mode of outputting to a terminal screen and the like display device, which uses a serial port output, and the rate is about 10 KB / s.
[0086] 2. The mode of writing into a storage device, and the rate is about 300 MB / s.
[0087] 3. The mode of outputting to an external analysis device through Ethernet, and the rate is about 800 MB / s. The user can select the LOG log output mode according to needs, or the LOG log output mode can be adaptively selected through the output selection module.
[0088] Further, as shown in FIG. 3, according to the above content, the following specific working principle of the communication rate adaptively selecting the LOG log output mode is provided:
[0089] 1. When the vehicle machine system is powered on, the SPI communication link of the system to be tested is initialized, the parameter values input by the test tool are read after the communication link is successfully initialized, and the parameters of the system communication test tool at least include two: <1> SPI communication rate parameter. <2> LOG output mode parameter.
[0090] 2、First read the check SPI communication rate parameters, subsequent can be used as the standard adaptive selection of appropriate LOG output mode. Read, check SPI communication rate parameters, continue to obtain the user specified LOG output mode parameters, the user can specify the parameters, can omit the parameters.
[0091] 3、If the user specifies the LOG output mode parameters, according to the user input parameter value, select the corresponding LOG output mode, and perform the corresponding initialization operation, initialization is normal, use the way to output LOG in the test process, if the initialization is abnormal, repeat initialization 5 times, 5 times failed, exit the test;
[0092] 4、If the user does not specify the LOG output mode parameters, then according to the output rate from low to high order LOG output mode, first select the terminal output mode, and then perform the initialization operation required for terminal output, initialization is normal, use the terminal output mode to output LOG in the test process, if the initialization is abnormal, repeat initialization 5 times, 5 times failed, exit the test.
[0093] 5、Select the terminal output LOG mode, calculate the time required for LOG output, the calculation method is: record the start and end time stamp of a LOG output, get the time required for outputting a LOG, if the time required for outputting a LOG is less than the set communication interval, use the terminal output mode to output LOG, wait for the end of the test, otherwise, select the faster output frequency LOG output method.
[0094] 6、Select the file storage LOG mode, repeat the initialization, calculation of the time required for outputting LOG, comparison of the required time and communication interval process, if the file storage LOG mode meets the demand, use the file storage mode to output LOG, otherwise select the Ethernet output LOG mode;
[0095] 7、Select the Ethernet output LOG mode, repeat the initialization, calculation of the time required for outputting LOG, comparison of the required time and communication interval process, if the Ethernet output LOG mode meets the demand, use the Ethernet output LOG mode, otherwise terminate the test, exit the test process.
[0096] Based on the same inventive concept, the application further provides a system for implementing the above-mentioned method for adaptively selecting a LOG output mode based on a communication rate. The system provides a solution similar to the solution described in the above-mentioned method, and thus the specific limitations in one or more embodiments of the system for adaptively selecting a LOG output mode based on a communication rate can be found in the above-mentioned limitations of the method for adaptively selecting a LOG output mode based on a communication rate, which will not be described herein again.
[0097] In one embodiment, the application further provides a system for adaptively selecting a LOG output mode based on a communication rate, as shown in FIG. 4, which includes an SPI communication module 110, an output selection module 120, a verification module 130, and a control module 140; wherein:
[0098] The SPI communication module 110 is configured to read input data of an SPI communication test tool; the input data of the SPI communication test tool at least includes an SPI communication rate parameter;
[0099] The output selection module 120 is configured to adaptively select a matching LOG log output mode according to the SPI communication rate parameter and a pre-defined priority of the LOG log output mode;
[0100] The verification module 130 is configured to screen the selected LOG log output mode in combination with an initialization state and a LOG log output frequency under each LOG log output mode, and determine a LOG log output mode meeting a user demand;
[0101] The LOG log output module 140 is configured to receive a requested instruction message from a user end, and perform a corresponding operation according to a content of the parsed instruction message.
[0102] Meanwhile, the embodiment of the present application provides a computer device, which can be a terminal, and an internal structure diagram of the computer device can be as shown in FIG. 5. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for running the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer program is executed by the processor to implement a method for adaptively selecting a LOG output mode based on a communication rate. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0103] Those skilled in the art can understand that the structure shown in FIG. 5 is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. Specifically, the computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0104] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0105] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0106] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0107] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method for adaptively selecting a log output mode based on a communication rate, the method comprising: determining a communication rate; and selecting a log output mode based on the communication rate. The application relates to a method for adaptive selection of a LOG log output mode based on a SPI communication rate parameter. The input data of the SPI communication test tool comprises the following: After the CSC vehicle system is powered on, a to-be-tested application system in the CSC vehicle system establishes an SPI communication with an MCU microcontroller through an SPI communication interface; The SPI communication link of the to-be-tested application system is initialized, and after the SPI communication link initialization succeeds, LOG log information generated in an SPI communication test process is collected, SPI communication rate parameters between the to-be-tested application system and the MCU microcontroller are acquired, and the SPI communication test tool is input. The priority of the LOG log output mode is defined as follows: The SPI communication rate parameter range is divided in combination with historical input data of the SPI communication test tool; 2. The method of claim 1, wherein, A plurality of LOG log output modes adapted to different SPI communication rate parameter ranges are defined, and each LOG log output mode comprises LOG log output mode parameters and / or output address parameters; The LOG log output mode comprises a first output mode, a second output mode and a third output mode; the first output mode is a terminal output mode for outputting LOG logs; the second output mode is a file storage mode for outputting LOG logs; and the third output mode is an Ethernet output mode for outputting LOG logs; The priority of the LOG log output mode is set; the priority of the second output mode is smaller than that of the first output mode and larger than that of the third output mode.
3. The method of claim 1, wherein, The adaptive selection of the LOG log output mode in combination with the SPI communication link initialization state and the LOG log output frequency of the selected LOG log output mode comprises the following: The SPI communication rate parameter is read; A plurality of LOG log output modes adapted to the SPI communication rate parameter range corresponding to the SPI communication rate parameter are selected according to the SPI communication rate parameter range; The LOG log output mode is adaptively selected according to the priority of the LOG log output mode. The adaptive selection of the LOG log output mode in combination with the SPI communication link initialization state and the LOG log output frequency of the selected LOG log output mode comprises the following:
4. The method of claim 3, wherein, LOG log output modes are sequentially selected according to the order from low to high of the LOG log output frequency and the priority of the LOG log output mode, which is defined as the priority of the second output mode being smaller than that of the first output mode and larger than that of the third output mode. 5. The method of claim 4, wherein, After each selected LOG log output mode, the initialization state under the currently selected LOG log output mode is judged; if the initialization is normal, the LOG log is output through the current LOG log output mode; if the initialization is abnormal, the initialization operation is repeated to a preset number of times, and if the initialization is still unsuccessful when the preset number of times is reached, the test process is exited; When the first output mode is selected as the output mode of the LOG log, the initialization state under the currently selected LOG log output mode is judged, and if the initialization state does not appear abnormal, the time for outputting the LOG log in the first output mode is calculated; the LOG log output frequency in the unit time of the time for outputting the LOG log in the first output mode is subtracted from the SPI communication rate to obtain a communication interval, and it is judged whether the first output mode for outputting the LOG log meets the user demand; if the obtained communication interval does not exceed a preset communication interval threshold, the first output mode is used to output the LOG log; otherwise, it is judged whether the second output mode meets the user demand; When the second output mode is selected as the output mode of the LOG log, the initialization state under the currently selected LOG log output mode is judged, and if the initialization state does not appear abnormal, the time for outputting the LOG log in the second output mode is calculated; the LOG log output frequency in the unit time of the time for outputting the LOG log in the second output mode is subtracted from the SPI communication rate to obtain a communication interval, and it is judged whether the second output mode for outputting the LOG log meets the user demand; if the obtained communication interval does not exceed a preset communication interval threshold, the second output mode is used to output the LOG log; otherwise, it is judged whether the third output mode meets the user demand; if so, the third output mode is used to output the LOG log.
6. The method of claim 5, wherein, The judgment of whether the third output mode meets the user demand includes: when the third output mode is selected as the output mode of the LOG log, the initialization state under the currently selected LOG log output mode is judged; the time for outputting the LOG log in the third output mode is calculated, and the LOG log output frequency in the unit time of the time for outputting the LOG log in the third output mode is subtracted from the communication SPI communication rate to obtain a communication interval that does not exceed a communication interval threshold, and then the third output mode is used to output the LOG log; otherwise, the test is terminated.
7. The method of claim 6, wherein, The calculation of the time for outputting the LOG log includes: the start and end time stamps of the LOG log output are recorded to obtain the time required for outputting the LOG log.
8. The method of claim 1, wherein, The execution of the corresponding operation according to the parsed instruction message content includes: when the user end starts the SPI communication test tool, the requested instruction message is received from the user end; The LOG log output parameter specified based on the user demand is obtained from the instruction message, and the corresponding LOG log output mode is matched; the LOG log output parameter includes a LOG log output mode parameter and / or an output address parameter; The execution of the corresponding operation according to the parsed instruction message content includes: when the user end starts the SPI communication test tool, the requested instruction message is received from the user end; In the SPI communication test process, the matched LOG log output mode is initialized; after the initialization is completed, the LOG log information generated in the SPI communication test process is output by using the LOG log output mode corresponding to the specified LOG log output parameter.
9. A system for adaptively selecting a log output mode based on a communication rate, the system comprising: a log module configured to: receive a communication rate; and select a log output mode based on the communication rate. Comprise: An SPI communication module, configured to read input data of an SPI communication test tool; The input data of the SPI communication test tool at least comprises an SPI communication rate parameter; An output selection module, configured to adaptively select a matched LOG log output mode according to the SPI communication rate parameter and a pre-defined priority of selecting the LOG log output mode; A verification module, configured to screen the selected LOG log output mode in combination with an initialization state and a LOG log output frequency under each LOG log output mode, and determine a LOG log output mode meeting user demand; A LOG log output module, configured to receive a requested instruction message from a user end, and execute a corresponding operation according to content of the parsed instruction message. 10.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-9. The processor executes the computer program to implement the steps of the method in any one of claims 1-8.
Citation Information
Patent Citations
Log output method, device and equipment
CN113010366A
Log output method, system and device, vehicle-mounted equipment and readable storage medium
CN115017013A
Dynamic regulation and control log collection and processing method and device and storage medium
CN115168030A
Method, system and equipment for adaptively selecting LOG output mode based on communication rate
CN118885421A
Update log output system and output method
JP2000010844A