make parallelism configurable
This commit is contained in:
parent
171391057d
commit
cbba3d5f29
@ -245,6 +245,13 @@ struct WorkItem
|
|||||||
*/
|
*/
|
||||||
static int global_ret;
|
static int global_ret;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Number of worker threads to use. Default (0) is to use one per CPU core
|
||||||
|
* available.
|
||||||
|
* Length of the #workers array.
|
||||||
|
*/
|
||||||
|
static unsigned int num_workers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time when the key update is executed.
|
* Time when the key update is executed.
|
||||||
* Either the actual current time, or a pretended time.
|
* Either the actual current time, or a pretended time.
|
||||||
@ -386,11 +393,6 @@ static volatile bool in_shutdown;
|
|||||||
*/
|
*/
|
||||||
static pthread_t *workers;
|
static pthread_t *workers;
|
||||||
|
|
||||||
/**
|
|
||||||
* Length of the #workers array.
|
|
||||||
*/
|
|
||||||
static unsigned int num_workers;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main function of a worker thread that signs.
|
* Main function of a worker thread that signs.
|
||||||
@ -1879,7 +1881,8 @@ run (void *cls,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* start crypto workers */
|
/* start crypto workers */
|
||||||
num_workers = 1; // for now...
|
if (0 == num_workers)
|
||||||
|
num_workers = sysconf (_SC_NPROCESSORS_CONF);
|
||||||
workers = GNUNET_new_array (num_workers,
|
workers = GNUNET_new_array (num_workers,
|
||||||
pthread_t);
|
pthread_t);
|
||||||
for (unsigned int i = 0; i<num_workers; i++)
|
for (unsigned int i = 0; i<num_workers; i++)
|
||||||
@ -1905,6 +1908,11 @@ main (int argc,
|
|||||||
struct GNUNET_GETOPT_CommandLineOption options[] = {
|
struct GNUNET_GETOPT_CommandLineOption options[] = {
|
||||||
GNUNET_GETOPT_option_timetravel ('T',
|
GNUNET_GETOPT_option_timetravel ('T',
|
||||||
"timetravel"),
|
"timetravel"),
|
||||||
|
GNUNET_GETOPT_option_uint ('p',
|
||||||
|
"parallelism",
|
||||||
|
"NUM_WORKERS",
|
||||||
|
"number of worker threads to use",
|
||||||
|
&num_workers),
|
||||||
GNUNET_GETOPT_option_absolute_time ('t',
|
GNUNET_GETOPT_option_absolute_time ('t',
|
||||||
"time",
|
"time",
|
||||||
"TIMESTAMP",
|
"TIMESTAMP",
|
||||||
|
Loading…
Reference in New Issue
Block a user