硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1699|回复: 1
收起左侧

[ThreadX全家桶] 新版ThreadX 6.1.9提供新能测试组件Thread-Metric Test Suite

[复制链接]

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106437
QQ
发表于 2021-10-15 09:09:06 | 显示全部楼层 |阅读模式


https://github.com/azure-rtos/th ... marks/thread_metric

  1. Thread-Metric RTOS Test Suite


  2. 1. Thread-Metric Test Suite

  3. The Thread-Metric test suite consists of 8 distinct RTOS
  4. tests that are designed to highlight commonly used aspects
  5. of an RTOS. The test measures the total number of RTOS events
  6. that can be processed during a specific timer interval. A 30
  7. second time interval is recommended.

  8. 1.1. Basic Processing Test   

  9. This is the baseline test consisting of a single thread. This
  10. should execute the same on every operating system. Test values
  11. from testing with different RTOS products should be scaled
  12. relative to the difference between the values of this test.

  13. 1.2. Cooperative Scheduling Test

  14. This test consists of 5 threads created at the same priority that
  15. voluntarily release control to each other in a round-robin fashion.  
  16. Each thread will increment its run counter and then relinquish to
  17. the next thread.  At the end of the test the counters will be verified
  18. to make sure they are valid (should all be within 1 of the same
  19. value). If valid, the numbers will be summed and presented as the
  20. result of the cooperative scheduling test.

  21. 1.3. Preemptive Scheduling Test

  22. This test consists of 5 threads that each have a unique priority.
  23. In this test, all threads except the lowest priority thread are
  24. left in a suspended state. The lowest priority thread will resume
  25. the next highest priority thread.  That thread will resume the
  26. next highest priority thread and so on until the highest priority
  27. thread executes. Each thread will increment its run count and then
  28. call thread suspend.  Eventually the processing will return to the
  29. lowest priority thread, which is still in the middle of the thread
  30. resume call. Once processing returns to the lowest priority thread,
  31. it will increment its run counter and once again resume the next
  32. highest priority thread - starting the whole process over once again.

  33. 1.4. Interrupt Processing Test

  34. This test consists of a single thread. The thread will cause an
  35. interrupt (typically implemented as a trap), which will result in
  36. a call to the interrupt handler. The interrupt handler will
  37. increment a counter and then post to a semaphore. After the
  38. interrupt handler completes, processing returns to the test
  39. thread that initiated the interrupt. The thread then retrieves
  40. the semaphore set by the interrupt handler, increments a counter
  41. and then generates another interrupt.

  42. 1.5. Interrupt Preemption Processing Test

  43. This test is similar to the previous interrupt test. The big
  44. difference is the interrupt handler in this test resumes a
  45. higher priority thread, which causes thread preemption.  

  46. 1.6. Message Processing Test

  47. This test consists of a thread sending a 16 byte message to a
  48. queue and retrieving the same 16 byte message from the queue.  
  49. After the send/receive sequence is complete, the thread will
  50. increment its run counter.

  51. 1.4. Synchronization Processing Test

  52. This test consists of a thread getting a semaphore and then
  53. immediately releasing it. After the get/put cycle completes,
  54. the thread will increment its run counter.

  55. 1.5. RTOS Memory allocation

  56. This test consists of a thread allocating a 128-byte block and
  57. releasing the same block. After the block is released, the thread
  58. will increment its run counter.


  59. 2. Thread-Metric Source Code

  60. The Thread-Metric source code may be freely used, providing its use
  61. complies with the stated copyright banner in each source file. For
  62. simplicity, each test is defined in its own file. Furthermore, each
  63. test is written in a generic C fashion. Providing the RTOS vendor
  64. completes the porting layer file with calls to its services, the
  65. tests are ready to run on any RTOS.

  66. The source code to the Thread-Metric test suite is organized into
  67. the following files:

  68.             File                                    Meaning

  69. tm_api.h                                    API and constants for test suite
  70. tm_basic_processing_test.c                  Basic test for determining board
  71.                                               processing capabilities
  72. tm_cooperative_scheduling_test.c            Cooperative scheduling test
  73. tm_preemptive_scheduling_test.c             Preemptive scheduling test
  74. tm_interrupt_processing_test.c              No-preemption interrupt processing
  75.                                               test
  76. tm_interrupt_preemption_processing_test.c   Interrupt preemption processing
  77.                                               test
  78. tm_message_processing_test.c                Message exchange processing test
  79. tm_synchronization_processing_test.c        Semaphore get/put processing test
  80. tm_memory_allocation_test.c                 Basic memory allocation test
  81. tm_porting_layer.h                          Port specific information, including
  82.                                               in-line assembly instruction to
  83.                                               cause an interrupt for the
  84.                                               interrupt processing tests
  85. tm_porting_layer_template.c                 Generic template for RTOS porting
  86.                                               layer
  87. tm_porting_layer_threadx.c                  Specific porting layer source
  88.                                               code for ThreadX

  89. 2.1 Porting Layer

  90. As for the porting layer defined in tm_porting_layer_template.c, this file contain
  91. shell services of the generic RTOS services used by the actual tests. The
  92. shell services provide the mapping between the tests and the underlying RTOS.  
  93. The following generic API's are required to map any RTOS to the performance
  94. measurement tests:


  95.     void  tm_initialize(void (*test_initialization_function)(void));

  96.     This function is typically called by the application from its
  97.     main() function. It is responsible for providing all the RTOS
  98.     initialization, calling the test initialization function as
  99.     specified, and then starting the RTOS.

  100.     int  tm_thread_create(int thread_id, int priority, void (*entry_function)(void));

  101.     This function creates a thread of the specified priority where 1 is
  102.     the highest and 16 is the lowest.  If successful, TM_SUCCESS
  103.     returned. If an error occurs, TM_ERROR is returned. The created thread
  104.     is not started.

  105.     int  tm_thread_resume(int thread_id);

  106.     This function resumes the previously created thread specified by
  107.     thread_id. If successful, a TM_SUCCESS is returned.

  108.     int  tm_thread_suspend(int thread_id);

  109.     This function suspend the previously created thread specified by
  110.     thread_id. If successful, a TM_SUCCESS is returned.

  111.     void  tm_thread_relinquish(void);

  112.     This function lets all other threads of same priority execute
  113.     before the calling thread runs again.

  114.     void  tm_thread_sleep(int seconds);

  115.     This function suspends the calling thread for the specified
  116.     number of seconds.

  117.     int  tm_queue_create(int queue_id);

  118.     This function creates a queue with a capacity to hold at least
  119.     one 16-byte message. If successful, a TM_SUCCESS is returned.

  120.     int  tm_queue_send(int queue_id, unsigned long *message_ptr);

  121.     This function sends a message to the previously created queue.  
  122.     If successful, a TM_SUCCESS is returned.

  123.     int  tm_queue_receive(int queue_id, unsigned long *message_ptr);

  124.     This function receives a message from the previously created
  125.     queue. If successful, a TM_SUCCESS is returned.

  126.     int  tm_semaphore_create(int semaphore_id);

  127.     This function creates a binary semaphore. If successful, a
  128.     TM_SUCCESS is returned.

  129.     int  tm_semaphore_get(int semaphore_id);

  130.     This function gets the previously created binary semaphore.  
  131.     If successful, a TM_SUCCESS is returned.

  132.     int  tm_semaphore_put(int semaphore_id);

  133.     This function puts the previously created binary semaphore.
  134.     If successful, a TM_SUCCESS is returned.

  135.     int  tm_memory_pool_create(int pool_id);

  136.     This function creates a memory pool able to satisfy at least one
  137.     128-byte block of memory. If successful, a TM_SUCCESS is returned.

  138.     int  tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr);

  139.     This function allocates a 128-byte block of memory from the
  140.     previously created memory pool. If successful, a TM_SUCCESS
  141.     is returned along with the pointer to the allocated memory
  142.     in the "memory_ptr" variable.

  143.     int  tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr);

  144.     This function releases the previously allocated 128-byte block
  145.     of memory. If successful, a TM_SUCCESS is returned.


  146. 2.2 Porting Requirements

  147. The following requirements are made in order to ensure fair benchmarks
  148. are achieved on each RTOS performing the test:

  149.     1. Time period should be 30 seconds. This will ensure the printf
  150.        processing in the reporting thread is insignificant.

  151.     2. The porting layer services are implemented inside of
  152.        tm_porting_layer_[RTOS].c and NOT as macros.

  153.     3. The tm_thread_sleep service is implemented by a 10ms RTOS
  154.        periodic interrupt source.

  155.     4. Locking regions of the tests and/or the RTOS in cache is
  156.        not allowed.

  157.     5. The Interrupt Processing and Interrupt Preemption Processing tests
  158.        require an instruction that generates an interrupt. Please refer
  159.        to tm_porting_layer.h for an example implementation.
复制代码


回复

使用道具 举报

608

主题

3038

回帖

4882

积分

至尊会员

积分
4882
发表于 2021-10-18 10:22:19 | 显示全部楼层
牛逼了,rtos
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-4-20 18:42 , Processed in 0.161614 second(s), 25 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表