diff options
author | Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> | 2018-03-20 08:08:03 +0000 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2018-03-21 04:04:29 +0300 |
commit | 31d3492b50b057df853ad51c909ac21d6e95a4ca (patch) | |
tree | 278af953a1030415a1f5c6767b06cd2b2859eef3 | |
parent | 74f7b6d1a003175f1cddf979212631a0d7832399 (diff) |
performance: fix sched_latency test with huge cpu count
odp_sched_latency has off-by-one error in accessing cpu stats: worker
thread id do not start from 0. Instead of fixing just off-by-one, use
ODP_THREAD_COUNT_MAX directly to allocate proper amount of cpu stats
structures.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
-rw-r--r-- | test/performance/odp_sched_latency.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index d49a212a0..ca7201193 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -27,7 +27,6 @@ /* GNU lib C */ #include <getopt.h> -#define MAX_WORKERS 64 /**< Maximum number of worker threads */ #define MAX_QUEUES 4096 /**< Maximum number of queues */ #define EVENT_POOL_SIZE (1024 * 1024) /**< Event pool size */ #define TEST_ROUNDS (4 * 1024 * 1024) /**< Test rounds for each thread */ @@ -105,7 +104,8 @@ typedef union ODP_ALIGNED_CACHE { /** Test global variables */ typedef struct { - core_stat_t core_stat[MAX_WORKERS]; /**< Core specific stats */ + /** Core specific stats */ + core_stat_t core_stat[ODP_THREAD_COUNT_MAX]; odp_barrier_t barrier; /**< Barrier for thread synchronization */ odp_pool_t pool; /**< Pool for allocating test events */ test_args_t args; /**< Parsed command line arguments */ @@ -617,8 +617,9 @@ static void parse_args(int argc, char *argv[], test_args_t *args) } /* Make sure arguments are valid */ - if (args->cpu_count > MAX_WORKERS) - args->cpu_count = MAX_WORKERS; + /* -1 for main thread */ + if (args->cpu_count > ODP_THREAD_COUNT_MAX - 1) + args->cpu_count = ODP_THREAD_COUNT_MAX - 1; if (args->prio[LO_PRIO].queues > MAX_QUEUES) args->prio[LO_PRIO].queues = MAX_QUEUES; if (args->prio[HI_PRIO].queues > MAX_QUEUES) |