@@ -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"
@@ -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 <number> Core count.\n"
+ " -c, --count <number> CPU count.\n"
" -h, --help Display help and exit.\n"
" environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
" ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
@@ -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 <number> Core count.\n"
+ " -c, --count <number> 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"
@@ -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 <number> Core count.\n"
+ " -c, --count <number> CPU count.\n"
" -h, --help Display help and exit.\n"
" environment variables: ODP_PKTIO_DISABLE_SOCKET_MMAP\n"
" ODP_PKTIO_DISABLE_SOCKET_MMSG\n"
@@ -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 <number> core count, core IDs start from 1\n");
+ printf(" -c, --count <number> CPU count\n");
printf(" -r, --resolution <us> timeout resolution in usec\n");
printf(" -m, --min <us> minimum timeout in usec\n");
printf(" -x, --max <us> 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 */
@@ -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);
/**
@@ -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);
/**
* @}
@@ -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);
/**
* @}
@@ -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);
}
@@ -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;
}
@@ -118,7 +118,7 @@ int odp_thread_id(void)
}
-int odp_thread_core(void)
+int odp_thread_cpu(void)
{
return this_thread->cpu;
}
@@ -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();
@@ -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;
@@ -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;
@@ -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);
@@ -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 <number> core count, core IDs start from 1\n");
+ printf(" -c, --count <number> 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 */
@@ -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);
@@ -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;
@@ -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},
Rename odp_core_count() to odp_cpu_count(). Change "core" to "cpu"/"CPU" in messages and comments. Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org> --- (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(-)