diff options
| author | Frédéric Desbiens <[email protected]> | 2026-03-06 19:27:49 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-06 19:27:49 +0100 |
| commit | 3726d7906b4808bfec7855fc088e073199df9120 (patch) | |
| tree | 8789bfd03d1d49e1967e80d04aa4ff606fda43eb /utility/benchmarks | |
| parent | 4b6e8100d932a3a67b34c6eb17f84f3bffb9e2ae (diff) | |
| parent | c3259a216026372e3833dd8996a68f77e8595fbd (diff) | |
Merge pull request #510 from eclipse-threadx/devv6.5.0.202601_rel
Merge changes ahead of the v6.5.0.202601 release
Diffstat (limited to 'utility/benchmarks')
13 files changed, 319 insertions, 361 deletions
diff --git a/utility/benchmarks/thread_metric/thread_metric_readme.txt b/utility/benchmarks/thread_metric/thread_metric_readme.txt index 70896efb..044f7ee2 100644 --- a/utility/benchmarks/thread_metric/thread_metric_readme.txt +++ b/utility/benchmarks/thread_metric/thread_metric_readme.txt @@ -1,4 +1,4 @@ - Thread-Metric RTOS Test Suite + Thread-Metric RTOS Test Suite 1. Thread-Metric Test Suite @@ -6,46 +6,46 @@ The Thread-Metric test suite consists of 8 distinct RTOS tests that are designed to highlight commonly used aspects of an RTOS. The test measures the total number of RTOS events -that can be processed during a specific timer interval. A 30 -second time interval is recommended. +that can be processed during a specific timer interval. A 30 +second time interval is recommended. -1.1. Basic Processing Test +1.1. Basic Processing Test -This is the baseline test consisting of a single thread. This -should execute the same on every operating system. Test values -from testing with different RTOS products should be scaled +This is the baseline test consisting of a single thread. This +should execute the same on every operating system. Test values +from testing with different RTOS products should be scaled relative to the difference between the values of this test. 1.2. Cooperative Scheduling Test -This test consists of 5 threads created at the same priority that -voluntarily release control to each other in a round-robin fashion. -Each thread will increment its run counter and then relinquish to -the next thread. At the end of the test the counters will be verified -to make sure they are valid (should all be within 1 of the same -value). If valid, the numbers will be summed and presented as the +This test consists of 5 threads created at the same priority that +voluntarily release control to each other in a round-robin fashion. +Each thread will increment its run counter and then relinquish to +the next thread. At the end of the test the counters will be verified +to make sure they are valid (should all be within 1 of the same +value). If valid, the numbers will be summed and presented as the result of the cooperative scheduling test. 1.3. Preemptive Scheduling Test -This test consists of 5 threads that each have a unique priority. -In this test, all threads except the lowest priority thread are -left in a suspended state. The lowest priority thread will resume -the next highest priority thread. That thread will resume the -next highest priority thread and so on until the highest priority -thread executes. Each thread will increment its run count and then -call thread suspend. Eventually the processing will return to the -lowest priority thread, which is still in the middle of the thread -resume call. Once processing returns to the lowest priority thread, -it will increment its run counter and once again resume the next +This test consists of 5 threads that each have a unique priority. +In this test, all threads except the lowest priority thread are +left in a suspended state. The lowest priority thread will resume +the next highest priority thread. That thread will resume the +next highest priority thread and so on until the highest priority +thread executes. Each thread will increment its run count and then +call thread suspend. Eventually the processing will return to the +lowest priority thread, which is still in the middle of the thread +resume call. Once processing returns to the lowest priority thread, +it will increment its run counter and once again resume the next highest priority thread - starting the whole process over once again. 1.4. Interrupt Processing Test -This test consists of a single thread. The thread will cause an -interrupt (typically implemented as a trap), which will result in -a call to the interrupt handler. The interrupt handler will -increment a counter and then post to a semaphore. After the +This test consists of a single thread. The thread will cause an +interrupt (typically implemented as a trap), which will result in +a call to the interrupt handler. The interrupt handler will +increment a counter and then post to a semaphore. After the interrupt handler completes, processing returns to the test thread that initiated the interrupt. The thread then retrieves the semaphore set by the interrupt handler, increments a counter @@ -54,26 +54,26 @@ and then generates another interrupt. 1.5. Interrupt Preemption Processing Test This test is similar to the previous interrupt test. The big -difference is the interrupt handler in this test resumes a -higher priority thread, which causes thread preemption. +difference is the interrupt handler in this test resumes a +higher priority thread, which causes thread preemption. 1.6. Message Processing Test -This test consists of a thread sending a 16 byte message to a -queue and retrieving the same 16 byte message from the queue. -After the send/receive sequence is complete, the thread will +This test consists of a thread sending a 16 byte message to a +queue and retrieving the same 16 byte message from the queue. +After the send/receive sequence is complete, the thread will increment its run counter. 1.4. Synchronization Processing Test -This test consists of a thread getting a semaphore and then -immediately releasing it. After the get/put cycle completes, +This test consists of a thread getting a semaphore and then +immediately releasing it. After the get/put cycle completes, the thread will increment its run counter. 1.5. RTOS Memory allocation -This test consists of a thread allocating a 128-byte block and -releasing the same block. After the block is released, the thread +This test consists of a thread allocating a 128-byte block and +releasing the same block. After the block is released, the thread will increment its run counter. @@ -104,8 +104,8 @@ tm_message_processing_test.c Message exchange processing test tm_synchronization_processing_test.c Semaphore get/put processing test tm_memory_allocation_test.c Basic memory allocation test tm_porting_layer.h Port specific information, including - in-line assembly instruction to - cause an interrupt for the + in-line assembly instruction to + cause an interrupt for the interrupt processing tests tm_porting_layer_template.c Generic template for RTOS porting layer @@ -114,93 +114,93 @@ tm_porting_layer_threadx.c Specific porting layer source 2.1 Porting Layer -As for the porting layer defined in tm_porting_layer_template.c, this file contain -shell services of the generic RTOS services used by the actual tests. The -shell services provide the mapping between the tests and the underlying RTOS. -The following generic API's are required to map any RTOS to the performance +As for the porting layer defined in tm_porting_layer_template.c, this file contain +shell services of the generic RTOS services used by the actual tests. The +shell services provide the mapping between the tests and the underlying RTOS. +The following generic API's are required to map any RTOS to the performance measurement tests: void tm_initialize(void (*test_initialization_function)(void)); - This function is typically called by the application from its - main() function. It is responsible for providing all the RTOS - initialization, calling the test initialization function as + This function is typically called by the application from its + main() function. It is responsible for providing all the RTOS + initialization, calling the test initialization function as specified, and then starting the RTOS. int tm_thread_create(int thread_id, int priority, void (*entry_function)(void)); - This function creates a thread of the specified priority where 1 is - the highest and 16 is the lowest. If successful, TM_SUCCESS - returned. If an error occurs, TM_ERROR is returned. The created thread + This function creates a thread of the specified priority where 1 is + the highest and 16 is the lowest. If successful, TM_SUCCESS + returned. If an error occurs, TM_ERROR is returned. The created thread is not started. int tm_thread_resume(int thread_id); - This function resumes the previously created thread specified by + This function resumes the previously created thread specified by thread_id. If successful, a TM_SUCCESS is returned. int tm_thread_suspend(int thread_id); - This function suspend the previously created thread specified by + This function suspend the previously created thread specified by thread_id. If successful, a TM_SUCCESS is returned. void tm_thread_relinquish(void); - This function lets all other threads of same priority execute + This function lets all other threads of same priority execute before the calling thread runs again. void tm_thread_sleep(int seconds); - This function suspends the calling thread for the specified + This function suspends the calling thread for the specified number of seconds. int tm_queue_create(int queue_id); - This function creates a queue with a capacity to hold at least + This function creates a queue with a capacity to hold at least one 16-byte message. If successful, a TM_SUCCESS is returned. int tm_queue_send(int queue_id, unsigned long *message_ptr); - This function sends a message to the previously created queue. + This function sends a message to the previously created queue. If successful, a TM_SUCCESS is returned. int tm_queue_receive(int queue_id, unsigned long *message_ptr); - This function receives a message from the previously created + This function receives a message from the previously created queue. If successful, a TM_SUCCESS is returned. int tm_semaphore_create(int semaphore_id); - This function creates a binary semaphore. If successful, a + This function creates a binary semaphore. If successful, a TM_SUCCESS is returned. int tm_semaphore_get(int semaphore_id); - This function gets the previously created binary semaphore. + This function gets the previously created binary semaphore. If successful, a TM_SUCCESS is returned. int tm_semaphore_put(int semaphore_id); - This function puts the previously created binary semaphore. + This function puts the previously created binary semaphore. If successful, a TM_SUCCESS is returned. int tm_memory_pool_create(int pool_id); - This function creates a memory pool able to satisfy at least one + This function creates a memory pool able to satisfy at least one 128-byte block of memory. If successful, a TM_SUCCESS is returned. int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr); - This function allocates a 128-byte block of memory from the - previously created memory pool. If successful, a TM_SUCCESS - is returned along with the pointer to the allocated memory + This function allocates a 128-byte block of memory from the + previously created memory pool. If successful, a TM_SUCCESS + is returned along with the pointer to the allocated memory in the "memory_ptr" variable. int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr); - This function releases the previously allocated 128-byte block - of memory. If successful, a TM_SUCCESS is returned. + This function releases the previously allocated 128-byte block + of memory. If successful, a TM_SUCCESS is returned. 2.2 Porting Requirements @@ -208,20 +208,20 @@ measurement tests: The following requirements are made in order to ensure fair benchmarks are achieved on each RTOS performing the test: - 1. Time period should be 30 seconds. This will ensure the printf + 1. Time period should be 30 seconds. This will ensure the printf processing in the reporting thread is insignificant. - 2. The porting layer services are implemented inside of + 2. The porting layer services are implemented inside of tm_porting_layer_[RTOS].c and NOT as macros. 3. The tm_thread_sleep service is implemented by a 10ms RTOS periodic interrupt source. - 4. Locking regions of the tests and/or the RTOS in cache is + 4. Locking regions of the tests and/or the RTOS in cache is not allowed. 5. The Interrupt Processing and Interrupt Preemption Processing tests - require an instruction that generates an interrupt. Please refer - to tm_porting_layer.h for an example implementation. + require an instruction that generates an interrupt. Please refer + to tm_porting_layer.h for an example implementation. diff --git a/utility/benchmarks/thread_metric/threadx_example/tm_porting_layer_threadx.c b/utility/benchmarks/thread_metric/threadx_example/tm_porting_layer_threadx.c index 405d9223..7490da44 100644 --- a/utility/benchmarks/thread_metric/threadx_example/tm_porting_layer_threadx.c +++ b/utility/benchmarks/thread_metric/threadx_example/tm_porting_layer_threadx.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Porting Layer (ThreadX Example) */ @@ -26,7 +27,7 @@ #endif -/* For smallest size, the ThreadX library and application code should be built +/* For smallest size, the ThreadX library and application code should be built with the following options defined (easiest to add in tx_port.h): #define TX_ENABLE_EXECUTION_CHANGE_NOTIFY @@ -110,7 +111,7 @@ void (*tm_initialization_function)(void); VOID tm_thread_entry(ULONG thread_input); -/* This function called from main performs basic RTOS initialization, +/* This function called from main performs basic RTOS initialization, calls the test initialization function, and then starts the RTOS function. */ void tm_initialize(void (*test_initialization_function)(void)) { @@ -119,13 +120,13 @@ void tm_initialize(void (*test_initialization_function)(void)) tm_initialization_function = test_initialization_function; /* Call the previously defined initialization function. */ - (tm_initialization_function)(); + (tm_initialization_function)(); } /* This function takes a thread ID and priority and attempts to create the - file in the underlying RTOS. Valid priorities range from 1 through 31, - where 1 is the highest priority and 31 is the lowest. If successful, + file in the underlying RTOS. Valid priorities range from 1 through 31, + where 1 is the highest priority and 31 is the lowest. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_thread_create(int thread_id, int priority, void (*entry_function)(void)) { @@ -197,7 +198,7 @@ void tm_thread_relinquish(void) /* This function suspends the specified thread for the specified number - of seconds. If successful, the function should return TM_SUCCESS. + of seconds. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ void tm_thread_sleep(int seconds) { @@ -216,7 +217,7 @@ UINT status; /* Create the specified queue with 16-byte messages. */ - status = tx_queue_create(&tm_queue_array[queue_id], "Thread-Metric test", TX_4_ULONG, + status = tx_queue_create(&tm_queue_array[queue_id], "Thread-Metric test", TX_4_ULONG, &tm_queue_memory_area[queue_id*TM_THREADX_QUEUE_SIZE], TM_THREADX_QUEUE_SIZE); /* Determine if the queue create was successful. */ @@ -227,7 +228,7 @@ UINT status; } -/* This function sends a 16-byte message to the specified queue. If successful, +/* This function sends a 16-byte message to the specified queue. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_queue_send(int queue_id, unsigned long *message_ptr) { @@ -246,7 +247,7 @@ UINT status; } -/* This function receives a 16-byte message from the specified queue. If successful, +/* This function receives a 16-byte message from the specified queue. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_queue_receive(int queue_id, unsigned long *message_ptr) { @@ -342,8 +343,8 @@ UINT status; } -/* This function allocates a 128 byte block from the specified memory pool. - If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR +/* This function allocates a 128 byte block from the specified memory pool. + If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr) { @@ -362,8 +363,8 @@ UINT status; } -/* This function releases a previously allocated 128 byte block from the specified - memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR +/* This function releases a previously allocated 128 byte block from the specified + memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr) { diff --git a/utility/benchmarks/thread_metric/tm_api.h b/utility/benchmarks/thread_metric/tm_api.h index 85c8982c..74ac6b11 100644 --- a/utility/benchmarks/thread_metric/tm_api.h +++ b/utility/benchmarks/thread_metric/tm_api.h @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Application Interface (API) */ @@ -19,31 +20,25 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* APPLICATION INTERFACE DEFINITION RELEASE */ -/* */ -/* tm_api.h PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ -/* This file defines the basic Application Interface (API) */ +/**************************************************************************/ +/* */ +/* APPLICATION INTERFACE DEFINITION RELEASE */ +/* */ +/* tm_api.h PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This file defines the basic Application Interface (API) */ /* implementation source code for the Thread-Metrics performance */ /* test suite. All service prototypes and data structure definitions */ -/* are defined in this file. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ - +/* are defined in this file. */ +/* */ +/**************************************************************************/ + #ifndef TM_API_H #define TM_API_H diff --git a/utility/benchmarks/thread_metric/tm_basic_processing_test.c b/utility/benchmarks/thread_metric/tm_basic_processing_test.c index 27f3e48e..f1c4fa22 100644 --- a/utility/benchmarks/thread_metric/tm_basic_processing_test.c +++ b/utility/benchmarks/thread_metric/tm_basic_processing_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Basic Processing Test */ @@ -19,28 +20,22 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_basic_processing_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_basic_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the basic test for determining board processing */ /* capabilities */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -49,8 +44,8 @@ unsigned long tm_basic_processing_counter; -/* Test array. We will just do a series of calculations on the - test array to eat up processing bandwidth. The idea is that +/* Test array. We will just do a series of calculations on the + test array to eat up processing bandwidth. The idea is that all RTOSes should produce the same metric here if everything else is equal, e.g. processor speed, memory speed, etc. */ @@ -92,7 +87,7 @@ void tm_basic_processing_initialize(void) /* Resume thread 0. */ tm_thread_resume(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_basic_processing_thread_report); tm_thread_resume(5); @@ -116,9 +111,9 @@ int i; while(1) { - /* Loop through the basic processing array, add the previous + /* Loop through the basic processing array, add the previous contents with the contents of the tm_basic_processing_counter - and xor the result with the previous value... just to eat + and xor the result with the previous value... just to eat up some time. */ for (i = 0; i < 1024; i++) { diff --git a/utility/benchmarks/thread_metric/tm_cooperative_scheduling_test.c b/utility/benchmarks/thread_metric/tm_cooperative_scheduling_test.c index b444c723..31d18c18 100644 --- a/utility/benchmarks/thread_metric/tm_cooperative_scheduling_test.c +++ b/utility/benchmarks/thread_metric/tm_cooperative_scheduling_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Cooperative Scheduling Test */ @@ -18,27 +19,21 @@ /**************************************************************************/ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_cooperative_scheduling_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_cooperative_scheduling_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the cooperative scheduling test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -99,7 +94,7 @@ void tm_cooperative_scheduling_initialize(void) tm_thread_resume(3); tm_thread_resume(4); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_cooperative_thread_report); tm_thread_resume(5); @@ -112,7 +107,7 @@ void tm_cooperative_thread_0_entry(void) while(1) { - + /* Relinquish to all other threads at same priority. */ tm_thread_relinquish(); @@ -217,7 +212,7 @@ unsigned long average; /* Calculate the average of all the counters. */ average = total/5; - + /* WCC - integrity check */ printf("tm_cooperative_thread_0_counter: %d\n", tm_cooperative_thread_0_counter); printf("tm_cooperative_thread_1_counter: %d\n", tm_cooperative_thread_1_counter); @@ -226,15 +221,15 @@ unsigned long average; printf("tm_cooperative_thread_4_counter: %d\n", tm_cooperative_thread_4_counter); /* See if there are any errors. */ - if ((tm_cooperative_thread_0_counter < (average - 1)) || + if ((tm_cooperative_thread_0_counter < (average - 1)) || (tm_cooperative_thread_0_counter > (average + 1)) || - (tm_cooperative_thread_1_counter < (average - 1)) || + (tm_cooperative_thread_1_counter < (average - 1)) || (tm_cooperative_thread_1_counter > (average + 1)) || - (tm_cooperative_thread_2_counter < (average - 1)) || + (tm_cooperative_thread_2_counter < (average - 1)) || (tm_cooperative_thread_2_counter > (average + 1)) || - (tm_cooperative_thread_3_counter < (average - 1)) || + (tm_cooperative_thread_3_counter < (average - 1)) || (tm_cooperative_thread_3_counter > (average + 1)) || - (tm_cooperative_thread_4_counter < (average - 1)) || + (tm_cooperative_thread_4_counter < (average - 1)) || (tm_cooperative_thread_4_counter > (average + 1))) { diff --git a/utility/benchmarks/thread_metric/tm_interrupt_preemption_processing_test.c b/utility/benchmarks/thread_metric/tm_interrupt_preemption_processing_test.c index 3ed64a78..5b6aeec2 100644 --- a/utility/benchmarks/thread_metric/tm_interrupt_preemption_processing_test.c +++ b/utility/benchmarks/thread_metric/tm_interrupt_preemption_processing_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Interrupt Preemption Processing Test */ @@ -19,27 +20,21 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_interrupt_preemption_processing_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_interrupt_preemption_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the preemptive scheduling test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -97,14 +92,14 @@ void tm_interrupt_preemption_processing_initialize(void) /* Resume just thread 1. */ tm_thread_resume(1); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_interrupt_preemption_thread_report); tm_thread_resume(5); } -/* Define the interrupt thread. This thread is resumed from the +/* Define the interrupt thread. This thread is resumed from the interrupt handler. It runs and suspends. */ void tm_interrupt_preemption_thread_0_entry(void) { @@ -115,7 +110,7 @@ void tm_interrupt_preemption_thread_0_entry(void) /* Increment this thread's counter. */ tm_interrupt_preemption_thread_0_counter++; - /* Suspend. This will allow the thread generating the + /* Suspend. This will allow the thread generating the interrupt to run again. */ tm_thread_suspend(0); } @@ -128,7 +123,7 @@ void tm_interrupt_preemption_thread_1_entry(void) while(1) { - /* Force an interrupt. The underlying RTOS must see that the + /* Force an interrupt. The underlying RTOS must see that the the interrupt handler is called from the appropriate software interrupt or trap. */ TM_CAUSE_INTERRUPT @@ -192,11 +187,11 @@ unsigned long average; average = total/3; /* See if there are any errors. */ - if ((tm_interrupt_preemption_thread_0_counter < (average - 1)) || + if ((tm_interrupt_preemption_thread_0_counter < (average - 1)) || (tm_interrupt_preemption_thread_0_counter > (average + 1)) || - (tm_interrupt_preemption_thread_1_counter < (average - 1)) || + (tm_interrupt_preemption_thread_1_counter < (average - 1)) || (tm_interrupt_preemption_thread_1_counter > (average + 1)) || - (tm_interrupt_preemption_handler_counter < (average - 1)) || + (tm_interrupt_preemption_handler_counter < (average - 1)) || (tm_interrupt_preemption_handler_counter > (average + 1))) { diff --git a/utility/benchmarks/thread_metric/tm_interrupt_processing_test.c b/utility/benchmarks/thread_metric/tm_interrupt_processing_test.c index 6591593e..69d156d9 100644 --- a/utility/benchmarks/thread_metric/tm_interrupt_processing_test.c +++ b/utility/benchmarks/thread_metric/tm_interrupt_processing_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Interrupt Processing Test */ @@ -18,27 +19,21 @@ /**************************************************************************/ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_interrupt_processing_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_interrupt_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the No-preemption interrupt processing test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -87,14 +82,14 @@ void tm_interrupt_processing_initialize(void) /* Create thread that generates the interrupt at priority 10. */ tm_thread_create(0, 10, tm_interrupt_thread_0_entry); - /* Create a semaphore that will be posted from the interrupt + /* Create a semaphore that will be posted from the interrupt handler. */ tm_semaphore_create(0); /* Resume just thread 0. */ tm_thread_resume(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_interrupt_thread_report); tm_thread_resume(5); @@ -118,13 +113,13 @@ int status; while(1) { - /* Force an interrupt. The underlying RTOS must see that the + /* Force an interrupt. The underlying RTOS must see that the the interrupt handler is called from the appropriate software interrupt or trap. */ TM_CAUSE_INTERRUPT /* We won't get back here until the interrupt processing is complete, - including the setting of the semaphore from the interrupt + including the setting of the semaphore from the interrupt handler. */ /* Pickup the semaphore set by the interrupt handler. */ @@ -189,9 +184,9 @@ unsigned long average; average = total/2; /* See if there are any errors. */ - if ((tm_interrupt_thread_0_counter < (average - 1)) || + if ((tm_interrupt_thread_0_counter < (average - 1)) || (tm_interrupt_thread_0_counter > (average + 1)) || - (tm_interrupt_handler_counter < (average - 1)) || + (tm_interrupt_handler_counter < (average - 1)) || (tm_interrupt_handler_counter > (average + 1))) { diff --git a/utility/benchmarks/thread_metric/tm_memory_allocation_test.c b/utility/benchmarks/thread_metric/tm_memory_allocation_test.c index 9e88861f..fc1c40d7 100644 --- a/utility/benchmarks/thread_metric/tm_memory_allocation_test.c +++ b/utility/benchmarks/thread_metric/tm_memory_allocation_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Memory Allocation Test */ @@ -18,27 +19,21 @@ /**************************************************************************/ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_memory_allocation_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_memory_allocation_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the Message exchange processing test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -86,7 +81,7 @@ void tm_memory_allocation_initialize(void) /* Create a memory pool. */ tm_memory_pool_create(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_memory_allocation_thread_report); tm_thread_resume(5); diff --git a/utility/benchmarks/thread_metric/tm_message_processing_test.c b/utility/benchmarks/thread_metric/tm_message_processing_test.c index c709252b..f82da79e 100644 --- a/utility/benchmarks/thread_metric/tm_message_processing_test.c +++ b/utility/benchmarks/thread_metric/tm_message_processing_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Message Processing Test */ @@ -19,27 +20,21 @@ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUCTION RELEASE */ -/* */ -/* tm_message_processing_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUCTION RELEASE */ +/* */ +/* tm_message_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* Basic test for message exchange processing. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -89,7 +84,7 @@ void tm_message_processing_initialize(void) /* Create a queue for the message passing. */ tm_queue_create(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_message_processing_thread_report); tm_thread_resume(5); @@ -107,7 +102,7 @@ void tm_message_processing_thread_0_entry(void) tm_message_sent[3] = 0x77778888; while(1) - { + { /* Send a message to the queue. */ tm_queue_send(0, tm_message_sent); diff --git a/utility/benchmarks/thread_metric/tm_porting_layer.h b/utility/benchmarks/thread_metric/tm_porting_layer.h index 3e9e2d63..ec1b7a26 100644 --- a/utility/benchmarks/thread_metric/tm_porting_layer.h +++ b/utility/benchmarks/thread_metric/tm_porting_layer.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -14,9 +15,9 @@ #include <stdio.h> -/* Define the TRAP instruction. This is used by the Interrupt Processing and Interrupt Preemption Processing tests. - The SVC instruction below is for Cortex-M architectures using IAR tools. This will likely need to be modified - for different processors and/or development tools. +/* Define the TRAP instruction. This is used by the Interrupt Processing and Interrupt Preemption Processing tests. + The SVC instruction below is for Cortex-M architectures using IAR tools. This will likely need to be modified + for different processors and/or development tools. Note also that for the Interrupt Processing test there is the assumption that the SVC ISR looks like: diff --git a/utility/benchmarks/thread_metric/tm_porting_layer_template.c b/utility/benchmarks/thread_metric/tm_porting_layer_template.c index c0460802..fcbc59a8 100644 --- a/utility/benchmarks/thread_metric/tm_porting_layer_template.c +++ b/utility/benchmarks/thread_metric/tm_porting_layer_template.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Porting Layer (Must be completed with RTOS specifics) */ @@ -24,7 +25,7 @@ #include "tm_api.h" -/* This function called from main performs basic RTOS initialization, +/* This function called from main performs basic RTOS initialization, calls the test initialization function, and then starts the RTOS function. */ void tm_initialize(void (*test_initialization_function)(void)) { @@ -33,8 +34,8 @@ void tm_initialize(void (*test_initialization_function)(void)) /* This function takes a thread ID and priority and attempts to create the - file in the underlying RTOS. Valid priorities range from 1 through 31, - where 1 is the highest priority and 31 is the lowest. If successful, + file in the underlying RTOS. Valid priorities range from 1 through 31, + where 1 is the highest priority and 31 is the lowest. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_thread_create(int thread_id, int priority, void (*entry_function)(void)) { @@ -67,7 +68,7 @@ void tm_thread_relinquish(void) /* This function suspends the specified thread for the specified number - of seconds. If successful, the function should return TM_SUCCESS. + of seconds. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ void tm_thread_sleep(int seconds) { @@ -83,7 +84,7 @@ int tm_queue_create(int queue_id) } -/* This function sends a 16-byte message to the specified queue. If successful, +/* This function sends a 16-byte message to the specified queue. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_queue_send(int queue_id, unsigned long *message_ptr) { @@ -91,7 +92,7 @@ int tm_queue_send(int queue_id, unsigned long *message_ptr) } -/* This function receives a 16-byte message from the specified queue. If successful, +/* This function receives a 16-byte message from the specified queue. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_queue_receive(int queue_id, unsigned long *message_ptr) { @@ -132,8 +133,8 @@ int tm_memory_pool_create(int pool_id) } -/* This function allocates a 128 byte block from the specified memory pool. - If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR +/* This function allocates a 128 byte block from the specified memory pool. + If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr) { @@ -141,8 +142,8 @@ int tm_memory_pool_allocate(int pool_id, unsigned char **memory_ptr) } -/* This function releases a previously allocated 128 byte block from the specified - memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR +/* This function releases a previously allocated 128 byte block from the specified + memory pool. If successful, the function should return TM_SUCCESS. Otherwise, TM_ERROR should be returned. */ int tm_memory_pool_deallocate(int pool_id, unsigned char *memory_ptr) { diff --git a/utility/benchmarks/thread_metric/tm_preemptive_scheduling_test.c b/utility/benchmarks/thread_metric/tm_preemptive_scheduling_test.c index 95ee4be8..ef3222f3 100644 --- a/utility/benchmarks/thread_metric/tm_preemptive_scheduling_test.c +++ b/utility/benchmarks/thread_metric/tm_preemptive_scheduling_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Preemptive Scheduling Test */ @@ -18,27 +19,21 @@ /**************************************************************************/ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_preemptive_scheduling_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_preemptive_scheduling_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the preemptive scheduling test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -103,7 +98,7 @@ void tm_preemptive_scheduling_initialize(void) /* Resume just thread 0. */ tm_thread_resume(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_preemptive_thread_report); tm_thread_resume(5); @@ -245,15 +240,15 @@ unsigned long average; average = total/5; /* See if there are any errors. */ - if ((tm_preemptive_thread_0_counter < (average - 1)) || + if ((tm_preemptive_thread_0_counter < (average - 1)) || (tm_preemptive_thread_0_counter > (average + 1)) || - (tm_preemptive_thread_1_counter < (average - 1)) || + (tm_preemptive_thread_1_counter < (average - 1)) || (tm_preemptive_thread_1_counter > (average + 1)) || - (tm_preemptive_thread_2_counter < (average - 1)) || + (tm_preemptive_thread_2_counter < (average - 1)) || (tm_preemptive_thread_2_counter > (average + 1)) || - (tm_preemptive_thread_3_counter < (average - 1)) || + (tm_preemptive_thread_3_counter < (average - 1)) || (tm_preemptive_thread_3_counter > (average + 1)) || - (tm_preemptive_thread_4_counter < (average - 1)) || + (tm_preemptive_thread_4_counter < (average - 1)) || (tm_preemptive_thread_4_counter > (average + 1))) { diff --git a/utility/benchmarks/thread_metric/tm_synchronization_processing_test.c b/utility/benchmarks/thread_metric/tm_synchronization_processing_test.c index 103ad7ea..6fa2a187 100644 --- a/utility/benchmarks/thread_metric/tm_synchronization_processing_test.c +++ b/utility/benchmarks/thread_metric/tm_synchronization_processing_test.c @@ -1,16 +1,17 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ -/** */ +/** */ /** Thread-Metric Component */ /** */ /** Synchronization Processing Test */ @@ -18,27 +19,21 @@ /**************************************************************************/ /**************************************************************************/ -/**************************************************************************/ -/* */ -/* FUNCTION RELEASE */ -/* */ -/* tm_synchronization_processing_test PORTABLE C */ -/* 6.1.7 */ -/* AUTHOR */ -/* */ -/* William E. Lamie, Microsoft Corporation */ -/* */ -/* DESCRIPTION */ -/* */ +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* tm_synchronization_processing_test PORTABLE C */ +/* 6.1.7 */ +/* AUTHOR */ +/* */ +/* William E. Lamie, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ /* This file defines the Semaphore get/put processing test. */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 10-15-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ -/**************************************************************************/ +/* */ +/**************************************************************************/ #include "tm_api.h" @@ -86,7 +81,7 @@ void tm_synchronization_processing_initialize(void) /* Create a semaphore for the test. */ tm_semaphore_create(0); - /* Create the reporting thread. It will preempt the other + /* Create the reporting thread. It will preempt the other threads and print out the test results. */ tm_thread_create(5, 2, tm_synchronization_processing_thread_report); tm_thread_resume(5); |
