mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
testing/ostest: Fix Coverity for spinlock test.
This commit fixed coverity for spinlock test. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
parent
5eef7f324f
commit
06d07b1522
1 changed files with 15 additions and 8 deletions
|
|
@ -215,13 +215,20 @@ void run_test_thread(void *lock, FAR void *(*thread_func)(FAR void *arg),
|
|||
total_ns += param[i].delta;
|
||||
}
|
||||
|
||||
printf("%s: Test Results:\n", lock_type);
|
||||
printf("%s: Final counter: %" PRIu32 "\n", lock_type, pub.counter);
|
||||
assert(pub.counter == thread_num * LOOP_TIMES);
|
||||
printf("%s: Average throughput : %" PRIu64 " op/s\n", lock_type,
|
||||
(uint64_t)NSEC_PER_SEC * LOOP_TIMES * thread_num / total_ns);
|
||||
printf("%s: Total execution time: %" PRIu64 " ns\n \n",
|
||||
lock_type, calc_diff(&stime, &etime));
|
||||
if (total_ns != 0)
|
||||
{
|
||||
printf("%s: Test Results:\n", lock_type);
|
||||
printf("%s: Final counter: %" PRIu32 "\n", lock_type, pub.counter);
|
||||
assert(pub.counter == thread_num * LOOP_TIMES);
|
||||
printf("%s: Average throughput : %" PRIu64 " op/s\n", lock_type,
|
||||
(uint64_t)NSEC_PER_SEC * LOOP_TIMES * thread_num / total_ns);
|
||||
printf("%s: Total execution time: %" PRIu64 " ns\n \n",
|
||||
lock_type, calc_diff(&stime, &etime));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("spinlock_test: ERROR: total_ns is 0\n");
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -258,7 +265,7 @@ void spinlock_test(void)
|
|||
{
|
||||
unsigned tnr;
|
||||
|
||||
for (tnr = 1; tnr < MAX_THREAD_NUM; tnr++)
|
||||
for (tnr = 1; tnr <= MAX_THREAD_NUM; tnr++)
|
||||
{
|
||||
spinlock_test_thread_num(tnr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue