📄 loadtest.t2
字号:
.\" :vipdo:-mgspo.n -mwww:.ds LF.ds lF.ds cF.ds rF.ds CH.ds RH.SH.ps +2Simple cpu load test .LPThis is a simple run of a cpu load test using two CAN channelson one CPC-PCI two channel passive CAN board.One channel is used as a receiver,using the 'horch' software torecord the CAN messages. It's not a very big application,but at least receives the messagespulls it from the driver and writes to the disk..LPThe other channel uses 'can_send'to produce some bus-load.We once wrote a little extension to create a defined bus-load,but this still does work perfectly.But after some approaches.LS$ ./can_send -l 50 -b 1000 -T 100000send 100000 mesages, 83 messages every 20 ms cycle $.LE.nf.ta 1i-l 50 produces not 50% (-l 50) but nearly 30% bus load.-b 1000 at 1 Mbit/s.-T 100000 generate this number of messages..LPOn a standard desktop linux we have a minimal time slice of 20 ms.That's why the program calculateshow many messages it should write into the write buffer,before going to sleep until it is waken up again.The message is always with the same ID and 8 data bytes, approximately 113祍 at 1MBit/s..LPBoth CAN channels are directly connected on the same PC.The PC is .LSvendor_id : AuthenticAMDcpu family : 6model : 8model name : AMD Athlon(tm) XP 2400+stepping : 1cpu MHz : 1994.362cache size : 256 KBbogomips : 3971.48.LE.SHResults.LPAfter finishing.B can_send ,it should have sent 100000 Messages,which took about 36s,the logfile of the receiving process containsexactly 100000 CAN messages and 13 status messages containingCAN controller status information and the bus load, like:.LS:: sja1000 1000 12 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.5:: sja1000 1000 12 96 0 0 170 30.5:: sja1000 1000 12 96 0 0 170 30.1:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 12 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 12 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 28 96 0 0 170 30.4:: sja1000 1000 12 96 0 0 170 25.8 | | | | | +status | | | | + load + bit rate + error code 170=0xaa .LE.B error_code=0x55means something like a stuff error occured somewhere in the data fieldwhile receiving.Not serious.Looking at the CPU load statistic without running the CAN test:.LStop - 19:47:30 up 13 days, 2:21, 19 users, load average: 0.00, 0.03, 0.06Tasks: 135 total, 3 running, 131 sleeping, 0 stopped, 1 zombieCpu(s): 0.3% user, 1.0% system, 0.0% nice, 98.7% idle.LEBecause on the desktop are a lot of processes we see some noise and a basic load.running the test:.LSCpu(s): 4.6% user, 15.8% system, 0.0% nice, 79.5% idleCpu(s): 5.6% user, 12.5% system, 0.0% nice, 81.9% idleCpu(s): 7.6% user, 11.2% system, 0.0% nice, 81.2% idleCpu(s): 5.0% user, 8.6% system, 0.0% nice, 86.5% idleCpu(s): 5.0% user, 10.6% system, 0.0% nice, 84.5% idleCpu(s): 2.6% user, 11.6% system, 0.0% nice, 85.8% idleCpu(s): 2.6% user, 11.6% system, 0.0% nice, 85.8% idleCpu(s): 3.3% user, 12.2% system, 0.0% nice, 84.5% idleCpu(s): 5.3% user, 9.2% system, 0.0% nice, 85.5% idleCpu(s): 5.0% user, 17.8% system, 0.0% nice, 77.2% idle.LEThis gives slightly incorrect values,because the values were catched with the mouse,which increases both, the user and system load as well. Looking at the running process I can read(approximating with eyes and head):.DS.B3% user6% system.DE.LPWhere .B useris the time spend in user processes,and.B systemthe time spend within system calls,that is in this case the CAN driver and also disk I/O.The result without disk I/0 is approximately 1% better.that means the idle process is 92% instead of 91%..QPSubtracting the base load of 1%.Bwe can estimate that the can driver needs 5% of the systems processing power for sending .LGand.SMreceiving2650 Messages/s ..LPOn Linux we can count the interrupts processed with:.LS$ cat /proc/interrupts .... 12: 1668480 XT-PIC usb-uhci, VIA8233, Can ....$ time ./can_send -l 50 -b 1000 -T 100000$ cat /proc/interrupts .... 12: 1768480 XT-PIC usb-uhci, VIA8233, Can .....LEThe difference between the two counts are exactly 100000.That means we have one interrupt for each CAN message.The driver, handling both channels, gets the .B "Transmit ready"and the.B "Message received"interrupt nearly at the same time and handles both interrupts withone call to the ISR.We also see that the system is fast enough,otherwise it would have handled more than one interruptwith one call to the ISR.Otherwise the interrupt counter should show a number smaller than 100000. .SHBusload calculation.LPTo verify the 30% we got from horch, we can:.DS30 % from 1s is 300.000 祍divided by 113祍 we need for one message 300000/113 = 2654results in 2654 messages / sTo transfer 100000 messages we need 100000/2654 = 37 s.DE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -