Summary of the invention
The embodiment of the invention provides a kind of processor method of testing and device of embedded system, is used to test embedded system and handles the overall performance that device is handled message.
A kind of processor performance test method of embedded system comprises:
Message is imported from transport layer, through network layer, data link layer output;
When the message of confirming the output of described data link layer is test packet, this message is sent to first network port driving layer;
After described first network port driving layer receives message, described packet buffer in formation, and is returned the message in the formation through described data link layer, network layer, transport layer;
Determine described performance of processors time of delay according to returning of the message that returns.
Described test packet is the winding message; And described network layer is sent to described data link layer with this winding message after determining to receive the winding message from described transport layer.
A kind of processor performance test method of embedded system comprises:
Message is imported from transport layer, outputed to first network port driving layer through network layer, data link layer;
After described first network port driving layer receives message, described packet buffer in formation, and is returned the message in the formation through described data link layer, network layer, transport layer;
Determine described performance of processors time of delay according to returning of the message that returns.
A kind of processor performance test device of embedded system comprises: transport layer module, network layer module, data link layer module also comprise:
The message sending module is used for message is sent to described transport layer module;
The first network port driving layer module is used to receive the message of input, and described packet buffer in formation, and is returned the message in the formation; The message of described input is a message that described message sending module sends, arrive the first network port driving layer module after transport layer module, network layer module, data link layer resume module;
The message receiver module is used to receive the message that returns; The described message that returns is a message that the described first network port driving layer module is returned, arrive described message receiver module after data link layer module, network layer module, transport layer module are handled;
The processor performance determination module is used for time of delay of returning of the message that receives according to described message receiver module, determines described performance of processors.
A kind of processor performance test method of embedded system comprises:
Message from the input of socket Socket layer, is exported through port Port layer, virtual link layer;
When the message of confirming the output of described virtual link layer is test packet, this message is sent to first network port driving layer;
After described first network port driving layer receives message, described packet buffer in formation, and with the message in the formation, is returned through described virtual link layer, Port layer, Socket layer;
Determine described performance of processors time of delay according to returning of the message that returns.
A kind of processor performance test method of embedded system comprises:
Message from the input of socket Socket layer, is outputed to first network port driving layer through port Port layer, virtual link layer;
After described first network port driving layer receives message, described packet buffer in formation, and with the message in the formation, is returned through described virtual link layer, Port layer, Socket layer;
Determine described performance of processors time of delay according to returning of the message that returns.
A kind of processor performance test device of embedded system comprises: socket layer module, port layer module, virtual link layer module also comprise:
The message sending module is used for message is sent to described socket layer module;
The first network port driving layer module is used to receive the message of input, and described packet buffer in formation, and is returned the message in the formation; The message of described input is a message that described message sending module sends, arrive the first network port driving layer module after socket layer module, port layer module, virtual link layer resume module;
The message receiver module is used to receive the message that returns; The described message that returns is a message that the described first network port driving layer module is returned, arrive described message receiver module after virtual link layer module, port layer module, socket layer resume module;
The processor performance determination module is used for time of delay of returning of the message that receives according to described message receiver module, determines described performance of processors.
The embodiment of the invention is owing to import test packet from transport layer, arrive first network port driving layer (being the virtual network port Drive Layer) through network layer, data link layer, return this test packet by the virtual network port Drive Layer again through data link layer, network layer, transport layer, thereby according to the performance of determining CPU time of delay of returning of test packet.Like this, message is after having passed through whole transmission, receiving course, and returning of message directly reflected the performance of CPU to the whole process of message processing time of delay.In addition, because input and receive message more than transport layer, I/O that needn't calling system reads the message that handle in intermediate layer (as network layer, data link layer etc.), thereby has reduced the number of times to the I/O visit, the test of having avoided the I/O visit to cause postpones, and makes test result more accurate.
The embodiment of the invention is owing to import message from the Socket layer, arrive first network port driving layer (being the virtual network port Drive Layer) through Port layer, virtual link layer, return this message by the virtual network port Drive Layer again through virtual link layer, Port layer, Socket layer, thereby according to the performance of determining CPU time of delay of returning of message.Like this, message is after having passed through whole transmission, receiving course, and returning of message directly reflected the performance of CPU to the whole process of message processing time of delay.In addition, because input and receive message more than the Socket layer, I/O that needn't calling system reads the message that handle in intermediate layer (as Socket layer, Port layer etc.), thereby has reduced the number of times to the I/O visit, the test of having avoided the I/O visit to cause postpones, and makes test result more accurate.
Embodiment
The embodiment of the invention by test macro to the whole transmission of message, receive the process of handling, thereby the CPU that determines embedded system to whole message sends, the handling property of receiving course, also just obtained the overall performance of CPU processing message.For example, message for the TCP/IP architecture, the embodiment of the invention is imported message from transport layer, arrive the virtual network port Drive Layer through network layer, data link layer, return this message by the virtual network port Drive Layer again through data link layer, network layer, transport layer, thereby according to the performance of determining CPU time of delay of returning of message.Like this, message is after having passed through whole transmission, receiving course, and returning of message directly reflected that the performance of CPU to the whole process of message processing---the performance that the short more then CPU of return time handles message is just high more time of delay.
The invention provides two specific embodiments.Wherein, embodiment one is the technical scheme of test CPU to the message handling property of TCP/IP architecture; Embodiment two is the technical scheme of test CPU to the message handling property of TIPC architecture.
Embodiment one
TCP/IP (TCP) is a kind of network communication protocol, its standard all communication equipments on the network, especially data transmission format and the load mode between a main frame and another main frame.TCP/IP is the basic agreement of internet.Test CPU to the schematic diagram of the message handling property of TCP/IP architecture as shown in Figure 3, the flow chart of concrete method of testing as shown in Figure 4, comprises following concrete steps:
S401, message is imported from transport layer.
Message continues to pass down after transport layer process.
S402, message arrive network layer; Message is after arriving network layer, and network layer handles accordingly to message.
Because use the winding message to do the above connecting path test of network layer in the prior art usually, therefore, network layer can judge also whether this message is the winding message, if the winding message, then network layer is returned this message to transport layer; If not the winding message shows that this message is the normal message that sends, then network layer sends this message (as shown in Figure 5) to data link layer.
In embodiments of the present invention,, then can the function of network layer be changed, make network layer when detecting the winding message, still send this message to data link layer if utilize the winding message to carry out the test of cpu performance.
S403, message arrive data link layer, and data link layer is handled the back accordingly to message and passed this message down.
S404, judge whether message is test packet; If transmit this message to the virtual network port Drive Layer.
In the built-in network system, be provided with true network port driving layer, be used for sending message, perhaps receive message from network to network; In addition, also be provided with the virtual network port Drive Layer in the built-in network system, the virtual network port Drive Layer is used for using when the test cpu performance.
After judging that the message of exporting from data link layer is test packet, this message is sent to the virtual network port Drive Layer; Otherwise, send to true network port driving layer, by true network port driving layer this message is sent by network.Like this, in the process of test cpu performance, system still can send message to network; That is to say, in test process, do not influence the reception and the transmission of network message.
If system adopts the winding message as test packet, when then the message that the data link layer is exported is judged as the winding message, this message is sent to the virtual network port Drive Layer; Otherwise, send to true network port driving layer, by true network port driving layer this message is sent by network.
Here it is pointed out that and judge that whether message is that the step of test packet is not necessary.For example, the tester can be configured before test---network port driving layer is configured to the virtual network port Drive Layer.Like this, all messages all arrive the virtual network port Drive Layer through after the data link layer, and whether needn't distinguish is test packet again, and decision is to the virtual network port Drive Layer or true network port driving layer sends.
S405, message return after arriving the virtual network port Drive Layer.
The packet buffer that the virtual network port Drive Layer will receive from data link layer is after formation, the message in the formation is not sent to network by hardware device (as network interface card etc.), but activate the receiving interface thread, by the receiving interface thread message in the formation is returned to the upper strata.
S406, message return through data link layer, network layer, transport layer.
S407, according to the transmitting time and the return time of message, determine the time of delay of returning of message, thereby determine the performance of CPU.
After message returns from transport layer, according to the transmitting time and the return time of message, determine the time of delay of returning of message, thereby determine the performance of CPU.Concrete, the transmitting time of the return time-message that returns time of delay=message of message.In order to obtain test result more accurately, can add up the time of delay of returning of a large amount of messages, thereby determine the performance of the CPU of this built-in network system.For example, when the message of adding up on average returns time of delay greater than set point A, then determine the poor-performing of CPU; Perhaps, rule of thumb formulate one and return the time of delay and the cpu performance grade table of comparisons, on average return time of delay, determine corresponding cpu performance grade according to the message of testing.
The processor performance test device of a kind of built-in network system that the embodiment of the invention provides, as shown in Figure 6, comprising: message sending module 601, transport layer module 602, network layer module 603, data link layer module 604, the first network port driving layer module 605, message receiver module 606, processor performance determination module 607.
Message sending module 601 is used for message is sent to transport layer module 602.
After 602 pairs of messages that receive from message sending module 601 of transport layer module are made the respective handling of transport layer, send this message to network layer module 603.
Network layer module 603 is made the respective handling of network layer to this message after receiving the message that transport layer module 602 sends, and sends these messages to data link layer module 604.
Data link layer module 604 is done this message to send these messages to the first network port driving layer module 605 after the respective handling of data link layer after receiving the message that network layer module 603 sends.
The first network port driving layer module 605 in formation, and activates the receiving interface thread with described packet buffer after receiving the message that data link layer module 604 sends; The receiving interface thread returns the message in the formation to data link layer module 604.
Data link layer module 604 receives the respective handling of making the data link layer behind the message that the first network port driving layer module 605 returns, returns this message to network layer module 603.
Network layer module 603 receives the respective handling of making network layer behind the message that data link layer module 604 returns, returns this message to transport layer module 602.
Transport layer module 602 receives the respective handling of making transport layer behind the message that network layer module 603 returns, sends the message that returns to message receiver module 606.
Message receiver module 606 receives the message that returns that transport layer module 602 sends.
The message that processor performance determination module 607 is received according to message receiver module 606 return time of delay, determine performance of processors.The time that to be processor performance determination module 607 receive returned packet according to the transmitting time and the message receiver module 606 of this message is determined the time of delay of returning of message, and then definite performance of processors.
Further, described device also comprises:
Test packet determination module 608 is between the first network port driving layer module 605 and data link layer module 604, and whether the message that judgment data link layer module 604 sends to the first network port driving layer module 605 is test packet; If then this message is forwarded to the first network port driving layer module 605; Otherwise, this message is forwarded to the second network port driving layer module, 609, the second network port driving layer modules, the 609 driving network hardwares this message is sent to network.
Further, network layer module 603 also is used for still this message being sent to described data link layer module after definite message that receives from transport layer is the winding message.
The embodiment of the invention is owing to import message from transport layer, arrive the virtual network port Drive Layer through network layer, data link layer, return this message by the virtual network port Drive Layer again through data link layer, network layer, transport layer, thereby according to the performance of determining CPU time of delay of returning of message.Like this, message is after having passed through whole transmission, receiving course, and returning of message directly reflected the performance of CPU to the whole process of message processing time of delay.
Because input and reception message more than transport layer, I/O that needn't calling system reads the message that handle in intermediate layer (as network layer, data link layer etc.), thereby reduced the number of times to the I/O visit, the test of having avoided the I/O visit to cause postpones, and makes test result more accurate.
Embodiment two
The TIPC agreement is the transparent interior interprocess communication protocol, with shared drive is the scheduling of basic realization task and resource, the TIPC protocol specialized is used for inner cluster (intra cluster) communication, be in different nodes in the identical cluster and can consider that residing position directly carries out rapid and reliable communication, intra cluster can be the distributed multi-processor system of any kind.TIPC provides a cover transparent reliable host-host protocol for the interprocess communication of distributed system.
For the cpu performance in the full test built-in network system, can also test the performance (as shown in Figure 7) of CPU processing TIPC message, concrete method of testing and above-mentioned test CPU are similar to the method for testing of TCP/IP handling property, and flow chart comprises the steps: as shown in Figure 8
S801, message is imported from the Socket layer.
Message continues to pass down after the Socket layer is handled.
S802, message arrive the Port layer, and the Port layer handles accordingly to message.
Similarly, use the winding message to do the above connecting path test of Port layer in the prior art usually, therefore, the Port layer can judge also whether the message of reception is the winding message, if the winding message, then Port course Socket layer returns this message; If not the winding message shows that this message is the normal message that sends, then the virtual Link layer of Port course sends this message.
In embodiments of the present invention,, then can the function of Port layer be changed, make the Port layer when detecting the winding message, still send this message to virtual Link layer if utilize the winding message to carry out the test of cpu performance as test packet.
S803, message arrive virtual Link layer, and virtual Link layer is handled the back accordingly to message and passed this message down.
S804, judge whether message is test packet; If send this message to the virtual network port Drive Layer.
Similarly, in the built-in network system, also can be provided with true network port driving layer and virtual network port Drive Layer at the TIPC body.True network port driving layer is used for sending message to miscellaneous equipment or system, perhaps receives message from miscellaneous equipment or system; The virtual network port Drive Layer is used for using when the test cpu performance.
After the message of judging virtual Link layer output is test packet, this message is sent to the virtual network port Drive Layer; Otherwise, send to true network port driving layer, by true network port driving layer this message is sent to miscellaneous equipment or system by network.Like this, in the process of test cpu performance, system still can send message to miscellaneous equipment or system.
Here it is pointed out that and judge that whether message is that the step of test packet is not necessary.For example, the tester can be configured before test---network port driving layer is configured to the virtual network port Drive Layer.Like this, all messages all arrive the virtual network port Drive Layer through after the data link layer, and whether needn't distinguish is test packet again, and decision is to the virtual network port Drive Layer or true network port driving layer sends.
S805, message return after arriving the virtual network port Drive Layer.
The packet buffer that the virtual network port Drive Layer will receive from data link layer is after formation, the message in the formation is not sent by hardware device (as network interface card etc.), but activate the receiving interface thread, by the receiving interface thread message in the formation is returned to the upper strata.
S806, message return through virtual Link layer, Port layer, Socket layer.
S807, according to the transmitting time and the return time of message, determine the time of delay of returning of message, thereby determine the performance of CPU.
After message returns from the Socket layer, according to the transmitting time and the return time of message, determine the time of delay of returning of message, thereby determine the performance of CPU.
In order to obtain test result more accurately, can add up the time of delay of returning of a large amount of messages, thereby determine the performance of the CPU of this built-in network system.For example, when the message of adding up on average returns time of delay greater than set point B, then determine the poor-performing of CPU; Perhaps, rule of thumb formulate one and return the time of delay and the cpu performance grade table of comparisons, on average return time of delay, determine corresponding cpu performance grade according to the message of testing.
The processor performance test device of a kind of built-in network system that the embodiment of the invention provides, as shown in Figure 9, comprising: message sending module 901, socket layer module 902, port layer module 903, virtual link layer module 904, the first network port driving layer module 905, message receiver module 906, processor performance determination module 907.
Message sending module 901 is used for message is sent to socket layer module 902.
After 902 pairs of messages that receive from message sending module 901 of socket layer module are made the respective handling of Socket layer, send this message to port layer module 903.
Port layer module 903 is made the respective handling of Port layer to this message after receiving the message that socket layer module 902 sends, and sends these messages to virtual link layer module 904.
Virtual link layer module 904 done this message to send these messages to the first network port driving layer module 905 after the respective handling of virtual link layer after receiving the message that port layer module 903 sends.
The first network port driving layer module 905 in formation, and activates the receiving interface thread with described packet buffer after receiving the message that virtual link layer module 904 send; The receiving interface thread returns the message in the formation to virtual link layer module 904.
Virtual link layer module 904 receives to be made corresponding virtual link layer behind the message that the first network port driving layer module 905 returns and handles, and returns this message to port layer module 903.
Port layer module 903 receives the respective handling of making the Port layer behind the message that virtual link layer module 904 return, returns this message to socket layer module 902.
Socket layer module 902 receives the respective handling of making the Socket layer behind the message that port layer module 903 returns, sends the message that returns to message receiver module 906.
Message receiver module 906 receives the message that returns that socket layer module 902 sends.
The message that processor performance determination module 907 is received according to message receiver module 906 return time of delay, determine performance of processors.The time that to be processor performance determination module 907 receive returned packet according to the transmitting time and the message receiver module 906 of this message is determined the time of delay of returning of message, and then definite performance of processors.
Further, described device also comprises:
Test packet determination module 908 judges whether the message that virtual link layer module 904 sends to the first network port driving layer module 905 is test packet between the first network port driving layer module 905 and virtual link layer module 904; If then this message is forwarded to the first network port driving layer module 905; Otherwise, this message is forwarded to the second network port driving layer module, 909, the second network port driving layer modules, the 909 driving network hardwares this message is sent to network.
Further, port layer module 903 also is used for still this message being sent to described virtual link layer module after definite message that receives from transport layer is the winding message.
The embodiment of the invention is owing to import message from the Socket layer, arrive the virtual network port Drive Layer through Port layer, virtual link layer, return this message by the virtual network port Drive Layer again through virtual link layer, Port layer, Socket layer, thereby according to the performance of determining CPU time of delay of returning of message.Like this, message is after having passed through whole transmission, receiving course, and returning of message directly reflected the performance of CPU to the whole process of message processing time of delay.
Because input and reception message more than the Socket layer, I/O that needn't calling system reads the message that handle in intermediate layer (as Socket layer, Port layer etc.), thereby reduced the number of times to the I/O visit, the test of having avoided the I/O visit to cause postpones, and makes test result more accurate.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to finish by program, this program can be stored in the computer read/write memory medium, as: ROM/RAM, magnetic disc, CD etc.
Will also be appreciated that the apparatus structure shown in accompanying drawing or the embodiment only is schematically, the presentation logic structure.Wherein the module that shows as separating component may or may not be physically to separate, and the parts that show as module may be or may not be physical modules.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.