如转发 请标明出处!
刚刚发布的VxWorks 7 24.03集成了一个Benchmark Suite:rtos-benchmark。这个测试涵盖了Task/Thread、Mutex、Semaphore、Message queue等领域,并支持VxWorks API和POSIX API两种标准。今天把它跑了跑,步骤如下
先在VSB里包含BENCHMARKS和BENCHMARKS_RTOS_BENCHMARK
然后修改VIP。添加组件INCLUDE_STANDALONE_SYM_TBL。为了方便操作,(公众号VxWorks567)还添加了INCLUDE_SHELL。为了减少干扰,建议去掉组件INCLUDE_NETWORK。为了提高精度,建议设置HIGH_RES_POSIX_CLOCK为TRUE
接下来就是测试用例了,如果使用的命令行,那直接add INCLUDE_RTOS_BENCHMARK_NONPOSIX或INCLUDE_RTOS_BENCHMARK_POSIX。这俩组件是互斥的,分别用于测试VxWorks API和POSIX API
如果使用Workbench创建的VIP,24.03自带的cdf有点小问题,需要在$(vsb)\krnl\cdf\20rtosBenchmark.cdf里手动添加一下这俩组件所在的folder,例如下图,是(公众号VxWorks567)刚刚添加的
添加ROMFS到VIP,并包含$(vsb)\usr\root\llvm\bin里的文件:rtos_benchmark_posix.vxe和rtos_benchmark_non_posix.vxe
参数RTOS_BENCHMARK_OPTIONS如果修改为1,ROMFS里的测试用例就会自启动;否则可以手动执行rtosBenchmarkRun()
这是VxWorks API的测试报告
-> rtosBenchmarkRun
->
Rtos-benchmark Testing for non-POSIX APIs:
Platform information:
x86_64 Processor (ACPI_BOOT_OP) SMP/SMT
VxWorks (for x86_64 Processor (ACPI_BOOT_OP) SMP/SMT) version SMP 64-bit
Kernel: Core Kernel version: 3.2.3.6
Made on Mar 21 2024 15:59:00
->
System Configurations:
- System tick clock frequency: 60 Hz
- Task CPU affinity on core: 1
- Main task priority: 50
- POSIX high-res clock timer resolution: 16666666 ns
- Timer frequency from clock_gettime(): 1000000000 Hz
*** Starting! ***
** Thread stats [avg, min, max] in nanoseconds **
Spawn (no context switch) : 83333, 0, 16666667
Create (no context switch) : 100000, 0, 16666667
Start (no context switch) : 0, 0, 0
Suspend (no context switch) : 0, 0, 0
Resume (no context switch) : 0, 0, 0
Spawn (context switch) : 100000, 0, 16666667
Start (context switch) : 0, 0, 0
Suspend (context switch) : 0, 0, 0
Resume (context switch) : 0, 0, 0
Terminate (context switch) : 216666, 0, 16666667
** Mutex Stats [avg, min, max] in nanoseconds **
Lock (no owner) : 0, 0, 0
Unlock (no waiters) : 0, 0, 0
Recursive lock : 0, 0, 0
Recursive unlock : 0, 0, 0
Unlock with unpend (no context switch) : 0, 0, 0
Unlock with unpend (context switch) : 0, 0, 0
Pend (no priority inheritance) : 0, 0, 0
Pend (priority inheritance) : 0, 0, 0
** Semaphore stats [avg, min, max] in nanoseconds **
Take (context switch) : 0, 0, 0
Give (context switch) : 0, 0, 0
** Semaphore stats [avg, min, max] in nanoseconds **
Give (no context switch) : 0, 0, 0
Take (no context switch) : 0, 0, 0
** Yield stats [avg, min, max] in nanoseconds **
Yield (no context switch) : 0, 0, 0
Yield (context switch) : 0, 0, 0
** Allocation stats [avg, min, max] in nanoseconds **
Malloc : 0, 0, 0
Free : 0, 0, 0
** Message queue stats [avg, min, max] in nanoseconds **
Create : 0, 0, 0
Send (no context switch) : 0, 0, 0
Receive (no context switch) : 0, 0, 0
Send (context switch) : 0, 0, 0
Receive (context switch) : 0, 0, 0
*** Done! ***
这是POSIX API的测试报告
-> rtosBenchmarkRun
->
Rtos-benchmark Testing for POSIX APIs:
Platform information:
x86_64 Processor (ACPI_BOOT_OP) SMP/SMT
VxWorks (for x86_64 Processor (ACPI_BOOT_OP) SMP/SMT) version SMP 64-bit
Kernel: Core Kernel version: 3.2.3.6
Made on Mar 21 2024 16:04:48
->
System Configurations:
- System tick clock frequency: 60 Hz
- Task CPU affinity on core: 1
- Main task priority: 50
- POSIX high-res clock timer resolution: 16666666 ns
- Timer frequency from clock_gettime(): 1000000000 Hz
*** Starting! ***
** Thread stats [avg, min, max] in nanoseconds **
Spawn (no context switch) : 133333, 0, 16666667
Create (no context switch) : n/a, n/a, n/a
Start (no context switch) : n/a, n/a, n/a
Suspend (no context switch) : n/a, n/a, n/a
Resume (no context switch) : n/a, n/a, n/a
Spawn (context switch) : 116666, 0, 16666667
Start (context switch) : n/a, n/a, n/a
Suspend (context switch) : n/a, n/a, n/a
Resume (context switch) : n/a, n/a, n/a
Terminate (context switch) : 199999, 0, 16666667
** Mutex Stats [avg, min, max] in nanoseconds **
Lock (no owner) : 0, 0, 0
Unlock (no waiters) : 0, 0, 0
Recursive lock : 0, 0, 0
Recursive unlock : 0, 0, 0
Unlock with unpend (no context switch) : 0, 0, 0
Unlock with unpend (context switch) : 0, 0, 0
Pend (no priority inheritance) : 0, 0, 0
Pend (priority inheritance) : 0, 0, 0
** Semaphore stats [avg, min, max] in nanoseconds **
Take (context switch) : 0, 0, 0
Give (context switch) : 0, 0, 0
** Semaphore stats [avg, min, max] in nanoseconds **
Give (no context switch) : 0, 0, 0
Take (no context switch) : 0, 0, 0
** Yield stats [avg, min, max] in nanoseconds **
Yield (no context switch) : 0, 0, 0
Yield (context switch) : 0, 0, 0
** Allocation stats [avg, min, max] in nanoseconds **
Malloc : 0, 0, 0
Free : 16666, 0, 16666666
** Message queue stats [avg, min, max] in nanoseconds **
Create : 0, 0, 0
Send (no context switch) : 0, 0, 0
Receive (no context switch) : 0, 0, 0
Send (context switch) : 0, 0, 0
Receive (context switch) : 0, 0, 0
*** Done! ***
因为Target CPU的性能太高,所以测试报告看上去精度不够。简单看了看源码,有时间可以再优化一下。
另外,这个测试用例应该与VxWorks的版本没什么关系,而且也不限于User mode。有时间试试把它移植到低版本的Kernel mode