Skip to content

Commit 9c2279a

Browse files
Tm-C-mTRbb666
authored andcommitted
[docs][utest]:Add comments for smp_bind_affinity
Add comments for smp_bind_affinity, And fixed some comment issues in smp_affinity_pri2_tc. Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
1 parent cafd9c6 commit 9c2279a

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

src/utest/smp/smp_affinity_pri2_tc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
* Test Case Name: [smp_affinity_pri2]
2323
*
2424
* Test Objectives:
25-
* - Verify that threads with low-priority unbound cores do not preempt high-priority threads.
25+
* - Verify that a low-priority thread bound to a core does not preempt a higher-priority thread running on the same core.
2626
*
2727
* Test Scenarios:
28-
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with each thread bound to its respective core. Among them,
29-
* - the thread on core 0 has a medium priority (THIGH_PRIORITY), while the other threads have the highest priority (THREAD_PRIORITY).
28+
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created. T0 is unbound with medium priority (THIGH_PRIORITY), while
29+
* - threads T1~T(RT_CPUS_NR-1) are each bound to their respective cores with the highest priority (THREAD_PRIORITY).
3030
* - All threads share a common entry function thread_entry. In thread_entry, only the threads running on non-core-0 cores
3131
* - execute an infinite loop (i.e., they do not release core ownership). After running for a certain period of time,
3232
* - the thread on core 0 checks whether run_flag equals 0 after creating a low-priority (LOW_PRIORITY) thread Tn. The entry

src/utest/smp/smp_bind_affinity_tc.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,29 @@
1717
* @note Create RT_CPUS_NR threads, thread 0 is bound to core 0, other threads are not bound to specific cores,
1818
* after running for a set number of times, count the number of times each core is run on the corresponding core,
1919
* thread 0 should always be run on core 0, other threads will be run on different cores.
20+
*
21+
* Test Case Name: [smp_bind_affinity]
22+
*
23+
* Test Objectives:
24+
* - Verify that threads bound to specific cores run on those cores.
25+
*
26+
* Test Scenarios:
27+
* - RT_CPUS_NR threads (T0~T(RT_CPUS_NR-1)) are created, with only T0 bound to core 0. When thread Tx is running,
28+
* - thread_tic[x] increments by 1; if x is equal to the core ID, thread_inc[x] also increments by 1. After the
29+
* - program runs for a period of time, observe the value relationship between the thread_inc and thread_tic arrays.
30+
* - If thread_inc[x] is equal to thread_tic[x], it indicates that thread Tx is correctly bound to core x. In this test case,
31+
* - only thread_inc[0] will be equal to thread_tic[0].
32+
*
33+
* Verification Metrics:
34+
* - Output message: [I/utest] [ PASSED ] [ result ] testcase (core.smp_bind_affinity)
35+
*
36+
* Dependencies:
37+
* - Enable RT_USING_SMP, set RT_THREAD_PRIORITY_MAX = 256.
38+
*
39+
* Expected Results:
40+
* - You will see the relevant PASS message. Additionally, RT_CPUS_NR lines of printed information will be displayed,
41+
* - indicating whether each thread Tx has been running on core x all the time. The results show that only T0 has been
42+
* - running on core 0 consistently.
2043
*/
2144

2245
/* Number of thread runs */

0 commit comments

Comments
 (0)