From patchwork Wed Jan 7 16:23:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ola Liljedahl X-Patchwork-Id: 42839 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 3CCC12055F for ; Wed, 7 Jan 2015 16:24:55 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z12sf852810lbi.6 for ; Wed, 07 Jan 2015 08:24:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references: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=rOILsJFBH58g0IiH5nHGjE+DAk689MCw8THpUTbQFq8=; b=jTKYYBQHcbDMpOCF4FsPaBdeeCBk1j6sdhEiqrQOlES8X8Luk0WmCvha3OBSOoT3gn 8AK2qBAsTNlKQmWmoKAZjqJEFMyBko67dZGIWy1aQ+noEkLDZTFYevF1hRH78CkHGXQ+ 5yiEdodUXXJPElTtwSGnr2g1n8dyhtROMhs3YQHpyj+AEBbPwKCKfo4MOUGVni9yBMzc OdszbL732si/QwthkopDAsjbWnnIb/cwulqNmymejtNjnQpjFad0y043EPAHU/wL6cGy gNR+HOnE3DlcA9foaGmbYkoNgBdBT03ULtkEKPVyXd6hVajyb7hguAl/YDtKg7Z2n0JF lQXg== X-Gm-Message-State: ALoCoQnl4PHul0U3I4XQTCobeGacklkw+iWu4o0zg/O0KNWyIVt/Z+A2KiIpzl8Ewd9gnvy32xBL X-Received: by 10.112.42.104 with SMTP id n8mr194708lbl.19.1420647894170; Wed, 07 Jan 2015 08:24:54 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.9 with SMTP id o9ls204718lah.29.gmail; Wed, 07 Jan 2015 08:24:54 -0800 (PST) X-Received: by 10.152.5.7 with SMTP id o7mr6076523lao.26.1420647893998; Wed, 07 Jan 2015 08:24:53 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id oe5si3807925lbb.2.2015.01.07.08.24.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 Jan 2015 08:24:53 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id q1so4448952lam.5 for ; Wed, 07 Jan 2015 08:24:53 -0800 (PST) X-Received: by 10.152.8.11 with SMTP id n11mr4954201laa.38.1420647893813; Wed, 07 Jan 2015 08:24:53 -0800 (PST) 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.9.200 with SMTP id c8csp1533665lbb; Wed, 7 Jan 2015 08:24:50 -0800 (PST) X-Received: by 10.140.108.74 with SMTP id i68mr5714622qgf.35.1420647882198; Wed, 07 Jan 2015 08:24:42 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j7si2485375qaf.48.2015.01.07.08.24.40 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 07 Jan 2015 08:24:42 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y8tPS-0002X3-Ij; Wed, 07 Jan 2015 16:24:38 +0000 Received: from mail-la0-f52.google.com ([209.85.215.52]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Y8tPF-0002W3-5D for lng-odp@lists.linaro.org; Wed, 07 Jan 2015 16:24:25 +0000 Received: by mail-la0-f52.google.com with SMTP id hs14so4398511lab.11 for ; Wed, 07 Jan 2015 08:24:19 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr6011255lbb.2.1420647858882; Wed, 07 Jan 2015 08:24:18 -0800 (PST) Received: from macmini.lan (78-82-118-111.tn.glocalnet.net. [78.82.118.111]) by mx.google.com with ESMTPSA id m9sm540167laa.28.2015.01.07.08.24.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 08:24:18 -0800 (PST) From: Ola Liljedahl To: lng-odp@lists.linaro.org Date: Wed, 7 Jan 2015 17:23:58 +0100 Message-Id: <1420647839-23553-2-git-send-email-ola.liljedahl@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1420647839-23553-1-git-send-email-ola.liljedahl@linaro.org> References: <1420647839-23553-1-git-send-email-ola.liljedahl@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 1/2] api: odp_system_info.h: change core to cpu everywhere X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ola.liljedahl@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.46 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 Rename odp_core_count() to odp_cpu_count(). Change "core" to "cpu"/"CPU" in messages and comments. Signed-off-by: Ola Liljedahl --- (This document/code contribution attached is provided under the terms of agreement LES-LTM-21309) example/generator/odp_generator.c | 38 ++++++++++---------- example/ipsec/odp_ipsec.c | 32 ++++++++--------- example/l2fwd/odp_l2fwd.c | 42 +++++++++++----------- example/packet/odp_pktio.c | 40 ++++++++++----------- example/timer/odp_timer_test.c | 38 ++++++++++---------- helper/include/odph_linux.h | 24 ++++++------- .../linux-generic/include/api/odp_system_info.h | 8 +++-- platform/linux-generic/include/api/odp_thread.h | 6 ++-- platform/linux-generic/odp_linux.c | 34 +++++++++--------- platform/linux-generic/odp_system_info.c | 22 ++++++------ platform/linux-generic/odp_thread.c | 2 +- test/api_test/odp_atomic_test.c | 6 ++-- test/api_test/odp_common.c | 8 ++--- test/api_test/odp_ring_test.c | 2 +- test/api_test/odp_shm_test.c | 2 +- test/performance/odp_scheduling.c | 38 ++++++++++---------- test/validation/odp_schedule.c | 26 +++++++------- test/validation/odp_shm.c | 2 +- test/validation/odp_system.c | 10 +++--- 19 files changed, 191 insertions(+), 189 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index d4bea92..95b4b3c 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -44,7 +44,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; /**< system core count */ + int cpu_count; /**< system CPU count */ int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ odp_buffer_pool_t pool; /**< Buffer pool for packet IO */ @@ -527,8 +527,8 @@ int main(int argc, char *argv[]) odp_buffer_pool_t pool; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -566,11 +566,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -582,15 +582,15 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First CPU: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -627,10 +627,10 @@ int main(int argc, char *argv[]) } else { for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; int if_idx; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if_idx = i % args->appl.if_count; @@ -652,7 +652,7 @@ int main(int argc, char *argv[]) * Calls odp_thread_create(cpu) for each thread */ odph_linux_pthread_create(&thread_tbl[i], 1, - core, thr_run_func, + cpu, thr_run_func, &args->thread[i]); } } @@ -708,7 +708,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'w': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'I': @@ -846,10 +846,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 223ca61..7a0fbef 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -49,7 +49,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ crypto_api_mode_e mode; /**< Crypto API preferred mode */ @@ -1172,8 +1172,8 @@ main(int argc, char *argv[]) odph_linux_pthread_t thread_tbl[MAX_WORKERS]; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; int stream_count; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -1214,11 +1214,11 @@ main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -1229,11 +1229,11 @@ main(int argc, char *argv[]) odp_barrier_init(&sync_barrier, num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = (1 == core_count) ? 0 : 1; - printf("First core: %i\n\n", first_core); + first_cpu = (1 == cpu_count) ? 0 : 1; + printf("First CPU: %i\n\n", first_cpu); /* Create packet buffer pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -1285,7 +1285,7 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, pktio_thread, NULL); /* @@ -1353,7 +1353,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -1460,10 +1460,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -1519,7 +1519,7 @@ static void usage(char *progname) " -a 192.168.111.2:192.168.222.2:md5:201:a731649644c5dee92cbd9c2e7e188ee6\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/l2fwd/odp_l2fwd.c b/example/l2fwd/odp_l2fwd.c index 3e11b60..34289b1 100644 --- a/example/l2fwd/odp_l2fwd.c +++ b/example/l2fwd/odp_l2fwd.c @@ -65,7 +65,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ @@ -314,8 +314,8 @@ int main(int argc, char *argv[]) odph_linux_pthread_t thread_tbl[MAX_WORKERS]; odp_buffer_pool_t pool; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_pktio_t pktio; odp_shm_t shm; odp_buffer_pool_param_t params; @@ -349,11 +349,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &gbl_args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (gbl_args->appl.core_count) - num_workers = gbl_args->appl.core_count; + if (gbl_args->appl.cpu_count) + num_workers = gbl_args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -361,7 +361,7 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); if (num_workers < gbl_args->appl.if_count) { - EXAMPLE_ERR("Error: core count %d is less than interface " + EXAMPLE_ERR("Error: CPU count %d is less than interface " "count\n", num_workers); exit(EXIT_FAILURE); } @@ -371,15 +371,15 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First cpu: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -434,15 +434,15 @@ int main(int argc, char *argv[]) /* Create worker threads */ for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if (gbl_args->appl.mode == APPL_MODE_PKT_BURST) thr_run_func = pktio_ifburst_thread; else /* APPL_MODE_PKT_QUEUE */ thr_run_func = pktio_queue_thread; - odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + odph_linux_pthread_create(&thread_tbl[i], 1, cpu, thr_run_func, &gbl_args->thread[i]); } @@ -518,7 +518,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -603,10 +603,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -645,7 +645,7 @@ static void usage(char *progname) " 1: Send&receive packets through ODP queues.\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 0a38ec2..3df1d9c 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -65,7 +65,7 @@ * Parsed command line application arguments */ typedef struct { - int core_count; + int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ @@ -312,8 +312,8 @@ int main(int argc, char *argv[]) odp_buffer_pool_t pool; int num_workers; int i; - int first_core; - int core_count; + int first_cpu; + int cpu_count; odp_buffer_pool_param_t params; args = calloc(1, sizeof(args_t)); @@ -340,11 +340,11 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl); - core_count = odp_sys_core_count(); - num_workers = core_count; + cpu_count = odp_sys_cpu_count(); + num_workers = cpu_count; - if (args->appl.core_count) - num_workers = args->appl.core_count; + if (args->appl.cpu_count) + num_workers = args->appl.cpu_count; if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; @@ -352,15 +352,15 @@ int main(int argc, char *argv[]) printf("Num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (core_count == 1) - first_core = 0; + if (cpu_count == 1) + first_cpu = 0; - printf("First core: %i\n\n", first_core); + printf("First CPU: %i\n\n", first_cpu); /* Create packet pool */ params.buf_size = SHM_PKT_POOL_BUF_SIZE; @@ -380,10 +380,10 @@ int main(int argc, char *argv[]) memset(thread_tbl, 0, sizeof(thread_tbl)); for (i = 0; i < num_workers; ++i) { void *(*thr_run_func) (void *); - int core; + int cpu; int if_idx; - core = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; if_idx = i % args->appl.if_count; @@ -400,7 +400,7 @@ int main(int argc, char *argv[]) * because each thread might get different arguments. * Calls odp_thread_create(cpu) for each thread */ - odph_linux_pthread_create(&thread_tbl[i], 1, core, thr_run_func, + odph_linux_pthread_create(&thread_tbl[i], 1, cpu, thr_run_func, &args->thread[i]); } @@ -515,7 +515,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) switch (opt) { case 'c': - appl_args->core_count = atoi(optarg); + appl_args->cpu_count = atoi(optarg); break; /* parse packet-io interface names */ case 'i': @@ -599,10 +599,10 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU model: %s\n" "CPU freq (hz): %"PRIu64"\n" "Cache line size: %i\n" - "Core count: %i\n" + "CPU count: %i\n" "\n", odp_version_api_str(), odp_sys_cpu_model_str(), odp_sys_cpu_hz(), - odp_sys_cache_line_size(), odp_sys_core_count()); + odp_sys_cache_line_size(), odp_sys_cpu_count()); printf("Running ODP appl: \"%s\"\n" "-----------------\n" @@ -638,7 +638,7 @@ static void usage(char *progname) " 1: Send&receive packets through ODP queues.\n" "\n" "Optional OPTIONS\n" - " -c, --count Core count.\n" + " -c, --count CPU count.\n" " -h, --help Display help and exit.\n" " environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n" " ODP_PKTIO_DISABLE_SOCKET_MMSG\n" diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index c754695..2acf2fc 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -32,7 +32,7 @@ /** Test arguments */ typedef struct { - int core_count; /**< Core count*/ + int cpu_count; /**< CPU count*/ int resolution_us; /**< Timeout resolution in usec*/ int min_us; /**< Minimum timeout in usec*/ int max_us; /**< Maximum timeout in usec*/ @@ -126,7 +126,7 @@ static void *run_thread(void *ptr) args = ptr; thr = odp_thread_id(); - printf("Thread %i starts on core %i\n", thr, odp_thread_core()); + printf("Thread %i starts on cpu %i\n", thr, odp_thread_cpu()); /* * Find the buffer pool @@ -156,7 +156,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count core count, core IDs start from 1\n"); + printf(" -c, --count CPU count\n"); printf(" -r, --resolution timeout resolution in usec\n"); printf(" -m, --min minimum timeout in usec\n"); printf(" -x, --max maximum timeout in usec\n"); @@ -191,7 +191,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) }; /* defaults */ - args->core_count = 0; /* all cores */ + args->cpu_count = 0; /* all CPU's */ args->resolution_us = 10000; args->min_us = args->resolution_us; args->max_us = 10000000; @@ -207,7 +207,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) switch (opt) { case 'c': - args->core_count = atoi(optarg); + args->cpu_count = atoi(optarg); break; case 'r': args->resolution_us = atoi(optarg); @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) int num_workers; odp_buffer_pool_t pool; odp_queue_t queue; - int first_core; + int first_cpu; uint64_t cycles, ns; odp_queue_param_t param; odp_shm_t shm; @@ -277,32 +277,32 @@ int main(int argc, char *argv[]) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Max core count: %i\n", odp_sys_core_count()); + printf("Max CPU count: %i\n", odp_sys_cpu_count()); printf("\n"); - /* A worker thread per core */ - num_workers = odp_sys_core_count(); + /* A worker thread per CPU */ + num_workers = odp_sys_cpu_count(); - if (args.core_count) - num_workers = args.core_count; + if (args.cpu_count) + num_workers = args.cpu_count; - /* force to max core count */ + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; printf("num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (odp_sys_core_count() == 1) - first_core = 0; + if (odp_sys_cpu_count() == 1) + first_cpu = 0; - printf("first core: %i\n", first_core); + printf("first CPU: %i\n", first_cpu); printf("resolution: %i usec\n", args.resolution_us); printf("min timeout: %i usec\n", args.min_us); printf("max timeout: %i usec\n", args.max_us); @@ -379,7 +379,7 @@ int main(int argc, char *argv[]) odp_barrier_init(&test_barrier, num_workers); /* Create and launch worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, run_thread, &args); /* Wait for worker threads to exit */ diff --git a/helper/include/odph_linux.h b/helper/include/odph_linux.h index 8671dc0..4ed8bbe 100644 --- a/helper/include/odph_linux.h +++ b/helper/include/odph_linux.h @@ -30,14 +30,14 @@ extern "C" { typedef struct { pthread_t thread; /**< Pthread ID */ pthread_attr_t attr; /**< Pthread attributes */ - int core; /**< Core ID */ + int cpu; /**< CPU ID */ } odph_linux_pthread_t; /** Linux process state information */ typedef struct { pid_t pid; /**< Process ID */ - int core; /**< Core ID */ + int cpu; /**< CPU ID */ int status; /**< Process state change status */ } odph_linux_process_t; @@ -45,17 +45,17 @@ typedef struct { /** * Creates and launches pthreads * - * Creates, pins and launches num threads to separate cores starting from - * first_core. + * Creates, pins and launches num threads to separate CPU's starting from + * first_cpu. * * @param thread_tbl Thread table * @param num Number of threads to create - * @param first_core First physical core + * @param first_cpu First physical CPU * @param start_routine Thread start function * @param arg Thread argument */ void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, - int num, int first_core, + int num, int first_cpu, void *(*start_routine) (void *), void *arg); @@ -74,31 +74,31 @@ void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); /** * Fork a process * - * Forks and sets core affinity for the child process + * Forks and sets CPU affinity for the child process * * @param proc Pointer to process state info (for output) - * @param core Destination core for the child process + * @param cpu Destination CPU for the child process * * @return On success: 1 for the parent, 0 for the child * On failure: -1 for the parent, -2 for the child */ -int odph_linux_process_fork(odph_linux_process_t *proc, int core); +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu); /** * Fork a number of processes * - * Forks and sets core affinity for child processes + * Forks and sets CPU affinity for child processes * * @param proc_tbl Process state info table (for output) * @param num Number of processes to create - * @param first_core Destination core for the first process + * @param first_cpu Destination CPU for the first process * * @return On success: 1 for the parent, 0 for the child * On failure: -1 for the parent, -2 for the child */ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - int num, int first_core); + int num, int first_cpu); /** diff --git a/platform/linux-generic/include/api/odp_system_info.h b/platform/linux-generic/include/api/odp_system_info.h index bcd08d7..42ab054 100644 --- a/platform/linux-generic/include/api/odp_system_info.h +++ b/platform/linux-generic/include/api/odp_system_info.h @@ -61,11 +61,13 @@ const char *odp_sys_cpu_model_str(void); int odp_sys_cache_line_size(void); /** - * Core count + * CPU count + * Report the number of CPU's available to this ODP program. + * This may be smaller than the number of (online) CPU's in the system. * - * @return Core count + * @return Number of available CPU's */ -int odp_sys_core_count(void); +int odp_sys_cpu_count(void); /** * @} diff --git a/platform/linux-generic/include/api/odp_thread.h b/platform/linux-generic/include/api/odp_thread.h index 2b7177d..469d298 100644 --- a/platform/linux-generic/include/api/odp_thread.h +++ b/platform/linux-generic/include/api/odp_thread.h @@ -31,11 +31,11 @@ int odp_thread_id(void); /** - * Get core id + * Get CPU number * - * @return Core id where the thread is running currently + * @return CPU ID where the thread is currently running */ -int odp_thread_core(void); +int odp_thread_cpu(void); /** * @} diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c index 229d24e..79192cf 100644 --- a/platform/linux-generic/odp_linux.c +++ b/platform/linux-generic/odp_linux.c @@ -56,27 +56,27 @@ static void *odp_run_start_routine(void *arg) void odph_linux_pthread_create(odph_linux_pthread_t *thread_tbl, int num, - int first_core, + int first_cpu, void *(*start_routine) (void *), void *arg) { int i; cpu_set_t cpu_set; odp_start_args_t *start_args; - int core_count; + int cpu_count; int cpu; - core_count = odp_sys_core_count(); + cpu_count = odp_sys_cpu_count(); - assert((first_core >= 0) && (first_core < core_count)); - assert((num >= 0) && (num <= core_count)); + assert((first_cpu >= 0) && (first_cpu < cpu_count)); + assert((num >= 0) && (num <= cpu_count)); memset(thread_tbl, 0, num * sizeof(odph_linux_pthread_t)); for (i = 0; i < num; i++) { pthread_attr_init(&thread_tbl[i].attr); - cpu = (first_core + i) % core_count; - thread_tbl[i].core = cpu; + cpu = (first_cpu + i) % cpu_count; + thread_tbl[i].cpu = cpu; CPU_ZERO(&cpu_set); CPU_SET(cpu, &cpu_set); @@ -109,30 +109,30 @@ void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - int num, int first_core) + int num, int first_cpu) { cpu_set_t cpu_set; pid_t pid; - int core_count; + int cpu_count; int cpu; int i; memset(proc_tbl, 0, num*sizeof(odph_linux_process_t)); - core_count = odp_sys_core_count(); + cpu_count = odp_sys_cpu_count(); - if (first_core < 0 || first_core >= core_count) { - ODP_ERR("Bad first_core\n"); + if (first_cpu < 0 || first_cpu >= cpu_count) { + ODP_ERR("Bad first_cpu\n"); return -1; } - if (num < 0 || num > core_count) { + if (num < 0 || num > cpu_count) { ODP_ERR("Bad num\n"); return -1; } for (i = 0; i < num; i++) { - cpu = (first_core + i) % core_count; + cpu = (first_cpu + i) % cpu_count; pid = fork(); if (pid < 0) { @@ -143,7 +143,7 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, /* Parent continues to fork */ if (pid > 0) { proc_tbl[i].pid = pid; - proc_tbl[i].core = cpu; + proc_tbl[i].cpu = cpu; continue; } @@ -168,9 +168,9 @@ int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, } -int odph_linux_process_fork(odph_linux_process_t *proc, int core) +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu) { - return odph_linux_process_fork_n(proc, 1, core); + return odph_linux_process_fork_n(proc, 1, cpu); } diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 7d18573..aab3f6f 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -24,7 +24,7 @@ typedef struct { uint64_t huge_page_size; uint64_t page_size; int cache_line_size; - int core_count; + int cpu_count; char model_str[128]; } odp_system_info_t; @@ -45,9 +45,9 @@ static odp_system_info_t odp_system_info; /* - * Sysconf + * Report the number of online CPU's */ -static int sysconf_core_count(void) +static int sysconf_cpu_count(void) { long ret; @@ -287,13 +287,13 @@ static int systemcpu(odp_system_info_t *sysinfo) { int ret; - ret = sysconf_core_count(); + ret = sysconf_cpu_count(); if (ret == 0) { - ODP_ERR("sysconf_core_count failed.\n"); + ODP_ERR("sysconf_cpu_count failed.\n"); return -1; } - sysinfo->core_count = ret; + sysinfo->cpu_count = ret; ret = systemcpu_cache_line_size(); @@ -325,13 +325,13 @@ static int systemcpu(odp_system_info_t *sysinfo) { int ret; - ret = sysconf_core_count(); + ret = sysconf_cpu_count(); if (ret == 0) { - ODP_ERR("sysconf_core_count failed.\n"); + ODP_ERR("sysconf_cpu_count failed.\n"); return -1; } - sysinfo->core_count = ret; + sysinfo->cpu_count = ret; /* Dummy values */ sysinfo->cpu_hz = 1400000000; @@ -403,7 +403,7 @@ int odp_sys_cache_line_size(void) return odp_system_info.cache_line_size; } -int odp_sys_core_count(void) +int odp_sys_cpu_count(void) { - return odp_system_info.core_count; + return odp_system_info.cpu_count; } diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index 01c8147..ccbd068 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -118,7 +118,7 @@ int odp_thread_id(void) } -int odp_thread_core(void) +int odp_thread_cpu(void) { return this_thread->cpu; } diff --git a/test/api_test/odp_atomic_test.c b/test/api_test/odp_atomic_test.c index 5563606..ec4a8d8 100644 --- a/test/api_test/odp_atomic_test.c +++ b/test/api_test/odp_atomic_test.c @@ -37,7 +37,7 @@ static void usage(void) "\t\t5 - Test add/sub of 64-bit atomic int\n" "\t\t-n <1 - 31> - no of threads to start\n" "\t\tif user doesn't specify this option, then\n" - "\t\tno of threads created is equivalent to no of cores\n" + "\t\tno of threads created is equivalent to no of CPU's\n" "\t\tavailable in the system\n" "\tExample usage:\n" "\t\t./odp_atomic -t 2\n" @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) goto err_exit; } if (test_type < TEST_MIX || test_type > TEST_MAX || - pthrdnum > odp_sys_core_count() || pthrdnum < 0) { + pthrdnum > odp_sys_cpu_count() || pthrdnum < 0) { usage(); goto err_exit; } @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) } if (pthrdnum == 0) - pthrdnum = odp_sys_core_count(); + pthrdnum = odp_sys_cpu_count(); test_atomic_init(); test_atomic_store(); diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 329d4d4..e585ef5 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -46,8 +46,8 @@ void odp_print_system_info(void) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Core count: %i\n", odp_sys_core_count()); - printf("Core mask: %s\n", str); + printf("CPU count: %i\n", odp_sys_cpu_count()); + printf("CPU mask: %s\n", str); printf("\n"); } @@ -62,8 +62,8 @@ int odp_test_global_init(void) return -1; } - num_workers = odp_sys_core_count(); - /* force to max core count */ + num_workers = odp_sys_cpu_count(); + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; diff --git a/test/api_test/odp_ring_test.c b/test/api_test/odp_ring_test.c index 54398f0..e3d7b4e 100644 --- a/test/api_test/odp_ring_test.c +++ b/test/api_test/odp_ring_test.c @@ -430,7 +430,7 @@ int main(int argc __attribute__((__unused__)), odph_ring_tailq_init(); - rarg.thrdarg.numthrds = odp_sys_core_count(); + rarg.thrdarg.numthrds = odp_sys_cpu_count(); #ifdef RING_TEST_BASIC rarg.thrdarg.testcase = ODP_RING_TEST_BASIC; diff --git a/test/api_test/odp_shm_test.c b/test/api_test/odp_shm_test.c index 5163337..be83657 100644 --- a/test/api_test/odp_shm_test.c +++ b/test/api_test/odp_shm_test.c @@ -58,7 +58,7 @@ int main(int argc __attribute__((__unused__)), printf("test shared data at %p\n\n", test_shared_data); thrdarg.testcase = ODP_SHM_TEST; - thrdarg.numthrds = odp_sys_core_count(); + thrdarg.numthrds = odp_sys_cpu_count(); odp_test_thread_create(run_thread, &thrdarg); odp_test_thread_exit(&thrdarg); diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index a18e858..ba7528d 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -48,7 +48,7 @@ typedef struct { /** Test arguments */ typedef struct { - int core_count; /**< Core count */ + int cpu_count; /**< CPU count */ int proc_mode; /**< Process mode */ } test_args_t; @@ -714,7 +714,7 @@ static void *run_thread(void *arg) thr = odp_thread_id(); - printf("Thread %i starts on core %i\n", thr, odp_thread_core()); + printf("Thread %i starts on CPU %i\n", thr, odp_thread_cpu()); shm = odp_shm_lookup("test_globals"); globals = odp_shm_addr(shm); @@ -893,7 +893,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count core count, core IDs start from 1\n"); + printf(" -c, --count CPU count\n"); printf(" -h, --help this help\n"); printf(" --proc process mode\n"); printf("\n\n"); @@ -930,7 +930,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) break; case 'c': - args->core_count = atoi(optarg); + args->cpu_count = atoi(optarg); break; case 'h': @@ -957,7 +957,7 @@ int main(int argc, char *argv[]) odp_queue_t queue; int i, j; int prios; - int first_core; + int first_cpu; odp_shm_t shm; test_globals_t *globals; odp_buffer_pool_param_t params; @@ -996,32 +996,32 @@ int main(int argc, char *argv[]) printf("CPU model: %s\n", odp_sys_cpu_model_str()); printf("CPU freq (hz): %"PRIu64"\n", odp_sys_cpu_hz()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); - printf("Max core count: %i\n", odp_sys_core_count()); + printf("Max CPU count: %i\n", odp_sys_cpu_count()); printf("\n"); - /* A worker thread per core */ - num_workers = odp_sys_core_count(); + /* A worker thread per CPU */ + num_workers = odp_sys_cpu_count(); - if (args.core_count) - num_workers = args.core_count; + if (args.cpu_count) + num_workers = args.cpu_count; - /* force to max core count */ + /* force to max CPU count */ if (num_workers > MAX_WORKERS) num_workers = MAX_WORKERS; printf("num worker threads: %i\n", num_workers); /* - * By default core #0 runs Linux kernel background tasks. - * Start mapping thread from core #1 + * By default CPU #0 runs Linux kernel background tasks. + * Start mapping thread from CPU #1 */ - first_core = 1; + first_cpu = 1; - if (odp_sys_core_count() == 1) - first_core = 0; + if (odp_sys_cpu_count() == 1) + first_cpu = 0; - printf("first core: %i\n", first_core); + printf("first CPU: %i\n", first_cpu); /* Test cycle count accuracy */ @@ -1112,7 +1112,7 @@ int main(int argc, char *argv[]) /* Fork worker processes */ ret = odph_linux_process_fork_n(proc, num_workers, - first_core); + first_cpu); if (ret < 0) { LOG_ERR("Fork workers failed %i\n", ret); @@ -1130,7 +1130,7 @@ int main(int argc, char *argv[]) } else { /* Create and launch worker threads */ - odph_linux_pthread_create(thread_tbl, num_workers, first_core, + odph_linux_pthread_create(thread_tbl, num_workers, first_cpu, run_thread, NULL); /* Wait for worker threads to terminate */ diff --git a/test/validation/odp_schedule.c b/test/validation/odp_schedule.c index 31be742..5df3c86 100644 --- a/test/validation/odp_schedule.c +++ b/test/validation/odp_schedule.c @@ -34,7 +34,7 @@ /* Test global variables */ typedef struct { - int core_count; + int cpu_count; odp_barrier_t barrier; odp_schedule_prio_t current_prio; int prio_buf_count; @@ -48,7 +48,7 @@ typedef struct ODP_PACKED { int num_queues; int num_prio; int num_bufs; - int num_cores; + int num_cpus; int enable_schd_multi; int enable_excl_atomic; } thread_args_t; @@ -82,7 +82,7 @@ static void *schedule_common_(void *arg) { thread_args_t *args = (thread_args_t *)arg; odp_schedule_sync_t sync; - int num_queues, num_prio, num_bufs, num_cores; + int num_queues, num_prio, num_bufs, num_cpus; odp_shm_t shm; test_globals_t *globals; @@ -90,7 +90,7 @@ static void *schedule_common_(void *arg) num_queues = args->num_queues; num_prio = args->num_prio; num_bufs = args->num_bufs; - num_cores = args->num_cores; + num_cpus = args->num_cpus; shm = odp_shm_lookup(GLOBALS_SHM_NAME); CU_ASSERT_FATAL(shm != ODP_SHM_INVALID); @@ -98,7 +98,7 @@ static void *schedule_common_(void *arg) CU_ASSERT_FATAL(globals != NULL); - if (num_cores == globals->core_count) + if (num_cpus == globals->cpu_count) odp_barrier_wait(&globals->barrier); while (1) { @@ -230,9 +230,9 @@ static void schedule_common(odp_schedule_sync_t sync, int num_queues, args.num_queues = num_queues; args.num_prio = num_prio; args.num_bufs = TEST_NUM_BUFS; - args.num_cores = 1; + args.num_cpus = 1; args.enable_schd_multi = enable_schd_multi; - args.enable_excl_atomic = 0; /* Not needed with a single core */ + args.enable_excl_atomic = 0; /* Not needed with a single CPU */ fill_queues(&args); @@ -264,7 +264,7 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, thr_args->num_bufs = TEST_NUM_BUFS_EXCL; else thr_args->num_bufs = TEST_NUM_BUFS; - thr_args->num_cores = globals->core_count; + thr_args->num_cpus = globals->cpu_count; thr_args->enable_schd_multi = enable_schd_multi; thr_args->enable_excl_atomic = enable_excl_atomic; @@ -275,7 +275,7 @@ static void parallel_execute(odp_schedule_sync_t sync, int num_queues, globals->prio_buf_count = 0; /* Create and launch worker threads */ - thr_args->thrdarg.numthrds = globals->core_count; + thr_args->thrdarg.numthrds = globals->cpu_count; odp_cunit_thread_create(schedule_common_, &thr_args->thrdarg); /* Wait for worker threads to terminate */ @@ -539,9 +539,9 @@ static int schd_suite_init(void) memset(globals, 0, sizeof(test_globals_t)); - globals->core_count = odp_sys_core_count(); - if (globals->core_count > MAX_WORKERS) - globals->core_count = MAX_WORKERS; + globals->cpu_count = odp_sys_cpu_count(); + if (globals->cpu_count > MAX_WORKERS) + globals->cpu_count = MAX_WORKERS; shm = odp_shm_reserve(SHM_THR_ARGS_NAME, sizeof(thread_args_t), ODP_CACHE_LINE_SIZE, 0); @@ -555,7 +555,7 @@ static int schd_suite_init(void) memset(thr_args, 0, sizeof(thread_args_t)); /* Barrier to sync test case execution */ - odp_barrier_init(&globals->barrier, globals->core_count); + odp_barrier_init(&globals->barrier, globals->cpu_count); odp_ticketlock_init(&globals->count_lock); odp_spinlock_init(&globals->atomic_lock); diff --git a/test/validation/odp_shm.c b/test/validation/odp_shm.c index 63353db..c26925b 100644 --- a/test/validation/odp_shm.c +++ b/test/validation/odp_shm.c @@ -61,7 +61,7 @@ static void test_odp_shm_sunnyday(void) test_shared_data->foo = TEST_SHARE_FOO; test_shared_data->bar = TEST_SHARE_BAR; - thrdarg.numthrds = odp_sys_core_count(); + thrdarg.numthrds = odp_sys_cpu_count(); if (thrdarg.numthrds > MAX_WORKERS) thrdarg.numthrds = MAX_WORKERS; diff --git a/test/validation/odp_system.c b/test/validation/odp_system.c index b5742c4..109bc60 100644 --- a/test/validation/odp_system.c +++ b/test/validation/odp_system.c @@ -7,12 +7,12 @@ #include "odp.h" #include "odp_cunit_common.h" -static void test_odp_sys_core_count(void) +static void test_odp_sys_cpu_count(void) { - int cores; + int cpus; - cores = odp_sys_core_count(); - CU_ASSERT(0 < cores); + cpus = odp_sys_cpu_count(); + CU_ASSERT(0 < cpus); } static void test_odp_sys_cache_line_size(void) @@ -59,7 +59,7 @@ static void test_odp_sys_cpu_hz(void) } CU_TestInfo test_odp_system[] = { - {"odp_sys_core_count", test_odp_sys_core_count}, + {"odp_sys_cpu_count", test_odp_sys_cpu_count}, {"odp_sys_cache_line_size", test_odp_sys_cache_line_size}, {"odp_sys_cpu_model_str", test_odp_sys_cpu_model_str}, {"odp_sys_page_size", test_odp_sys_page_size},