From patchwork Mon Jul 20 16:24:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 51289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8279A20323 for ; Mon, 20 Jul 2015 16:25:17 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf40995383lbc.0 for ; Mon, 20 Jul 2015 09:25:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=0MXAGGYgA0GqI0CqvP7dM4NBshFwe9nXouflozJDvq4=; b=FlttYYILVXA1e1Ed45+SrEm+zgFRryjoiSTz/KcnG/1pWqXZ877NOBB4OqaIQm99Fj XsL5SWIXcf9xtaTx8y9PFUjAUT4RxnmqvE68iBe/p+GYGBgsTzkGaDfGJoA9ytg1lQn8 16ul5dLnGkdVSiWXju6CbfjISqcERXEXXRVSa3Cj67oZVrkDCqkJMB4WgNuWWsv/2YP4 lPbK0A7nLcQzBFzCy86FfUdULhWtwXZ5repMsu2GkeZbyQPhZkr2UqSGzVoI4Gm68oP3 EwhGAHeEOP00Y8z9Guk7cHfcgWpWG3FMXDYoGPXhX8br11mMVbA9hFHWti7ZkCLG2MqF /y2Q== X-Gm-Message-State: ALoCoQkekJ2923Yyx20pLj8cKhqqIvDZApYqPuAsAAqne+Iq8l1hNweo/2rcxA8CUT+A+SZ+Al+t X-Received: by 10.112.13.200 with SMTP id j8mr15394277lbc.14.1437409516532; Mon, 20 Jul 2015 09:25:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.224.129 with SMTP id rc1ls756506lac.25.gmail; Mon, 20 Jul 2015 09:25:16 -0700 (PDT) X-Received: by 10.112.25.39 with SMTP id z7mr28964838lbf.102.1437409516374; Mon, 20 Jul 2015 09:25:16 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id y6si18354960lbj.20.2015.07.20.09.25.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2015 09:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by lagw2 with SMTP id w2so100284839lag.3 for ; Mon, 20 Jul 2015 09:25:16 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr29099167laf.32.1437409515923; Mon, 20 Jul 2015 09:25:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp893216lba; Mon, 20 Jul 2015 09:25:15 -0700 (PDT) X-Received: by 10.140.147.195 with SMTP id 186mr42765968qht.59.1437409514499; Mon, 20 Jul 2015 09:25:14 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 42si24801575qkx.120.2015.07.20.09.25.13; Mon, 20 Jul 2015 09:25:14 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 4D4E361DDF; Mon, 20 Jul 2015 16:25:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5DB7C61DD5; Mon, 20 Jul 2015 16:25:08 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 5481461DD6; Mon, 20 Jul 2015 16:25:06 +0000 (UTC) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by lists.linaro.org (Postfix) with ESMTPS id 6503661DD1 for ; Mon, 20 Jul 2015 16:25:05 +0000 (UTC) Received: by wgav7 with SMTP id v7so69359378wga.2 for ; Mon, 20 Jul 2015 09:25:04 -0700 (PDT) X-Received: by 10.181.13.109 with SMTP id ex13mr20443772wid.39.1437409504606; Mon, 20 Jul 2015 09:25:04 -0700 (PDT) Received: from localhost.localdomain ([87.120.178.39]) by smtp.gmail.com with ESMTPSA id bg6sm32737384wjc.13.2015.07.20.09.25.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jul 2015 09:25:03 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Mon, 20 Jul 2015 19:24:57 +0300 Message-Id: <1437409497-20286-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT PATCH] validation: scheduler: use number of workers X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Use number of workes instead of number of total cpus. Signed-off-by: Maxim Uvarov --- test/validation/scheduler/scheduler.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c index f73c23a..57ac528 100644 --- a/test/validation/scheduler/scheduler.c +++ b/test/validation/scheduler/scheduler.c @@ -38,7 +38,7 @@ /* Test global variables */ typedef struct { - int cpu_count; + int num_workers; odp_barrier_t barrier; int buf_count; odp_ticketlock_t lock; @@ -164,14 +164,12 @@ static void *schedule_common_(void *arg) { thread_args_t *args = (thread_args_t *)arg; odp_schedule_sync_t sync; - int num_cpus; test_globals_t *globals; globals = args->globals; sync = args->sync; - num_cpus = args->num_cpus; - if (num_cpus == globals->cpu_count) + if (args->num_cpus > 1) odp_barrier_wait(&globals->barrier); while (1) { @@ -352,14 +350,14 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, args->num_bufs = NUM_BUFS_EXCL; else args->num_bufs = TEST_NUM_BUFS; - args->num_cpus = globals->cpu_count; + args->num_cpus = globals->num_workers; args->enable_schd_multi = enable_schd_multi; args->enable_excl_atomic = enable_excl_atomic; fill_queues(args); /* Create and launch worker threads */ - args->cu_thr.numthrds = globals->cpu_count; + args->cu_thr.numthrds = globals->num_workers; odp_cunit_thread_create(schedule_common_, &args->cu_thr); /* Wait for worker threads to terminate */ @@ -662,6 +660,7 @@ static int create_queues(void) static int scheduler_suite_init(void) { + odp_cpumask_t mask; odp_shm_t shm; odp_pool_t pool; test_globals_t *globals; @@ -692,9 +691,9 @@ static int scheduler_suite_init(void) memset(globals, 0, sizeof(test_globals_t)); - globals->cpu_count = odp_cpu_count(); - if (globals->cpu_count > MAX_WORKERS) - globals->cpu_count = MAX_WORKERS; + globals->num_workers = odp_cpumask_def_worker(&mask, 0); + if (globals->num_workers > MAX_WORKERS) + globals->num_workers = MAX_WORKERS; shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t), ODP_CACHE_LINE_SIZE, 0); @@ -708,7 +707,7 @@ static int scheduler_suite_init(void) memset(args, 0, sizeof(thread_args_t)); /* Barrier to sync test case execution */ - odp_barrier_init(&globals->barrier, globals->cpu_count); + odp_barrier_init(&globals->barrier, globals->num_workers); odp_ticketlock_init(&globals->lock); odp_spinlock_init(&globals->atomic_lock);