NAME
cthread_parse_args - Command line parsing of cthreads
options
LIBRARY
C Threads Library (libcthreads.a)
SYNOPSIS
#include <cthread.h>
int cthread_parse_args( int argc, char ** argv);
PARAMETERS
argc The count of arguments in argv.
argv The argument vector.
DESCRIPTION
The cthread_parse_args() function parses command-line style
argument lists to set internal cthread options. For normal
cthread programs, cthread_parse_args() is an optional con-
venience function that allows configuration of the cthread
library from the command line for application programs. In
its normal use, cthread_parse_args() is called as in the
sample program below:
main(argc, argv)
int argc;
char **argv;
{
argc = cthread_parse_args(argc, argv);
/* application arg processing and initialization */
cthread_init(1, init_func);
}
Here cthread_parse_args() removes and interprets all the
arguments that it recognizes from the argv structure and
returns argv and the corrected argument count to the appli-
cation for processing of any further arguments.
cthreads_parse_args() can also be used like
cthread_configure() to set cthread options from the program
level. See the example below:
main()
{
char *arg_list[2] = {"-cthread_stack_size", "10240"};
cthread_parse_args(2, arg_list);
cthread_init(1, init_func);
}
cthreads_parse_args() cannot be called after cthread_init(),
though it can be called multiple times for processing com-
mand line and program level options.
At present, cthread_parse_args() understands the following
arguments:
-cthread_version
Print Cthreads version information on standard output
at the time cthread_parse_args() is called.
-num_procs <number>
This sets the number of processors (or processes on the
SPARC version) for cthreads to use. Use of this param-
eter overrides the processor count specified in
cthread_init.
-cthread_stack_size <number>
Sets the stack size of created threads.
-cthread_mem_exp <number>
Causes cthreads to have at least 2^<number> bytes of
dynamically allocable shared memory available.
-cthread_threads_per_proc <number>
Set the number of threads available per processor.
-cthread_stack_size <number>
Sets the stack size of created threads.
-cthread_debug <string>
Turns on internal cthread debugging printouts. Appli-
cation developers are most likely to be interested in
"-cthread_debug calls". This turns on tracing of
application-level cthreads calls. It can be quite use-
ful in tracing down bugs, deadlocks, etc. It is also
possible to enable trace printouts of internal cthread
functionality. This can be done on a file-by-file
basis by specifying a filename as the argument to
-cthread_debug. (Filename here means the name of a
file in the cthread library source.) For example,
-cthread_debug init.c, enables tracing of initializa-
tion activity traces contained in the file "init.c" in
cthread source.
-arg_file <filename>
Read further arguments from file <filename>. These
arguments are broken into tokens along whitespace boun-
daries and each token is treated as an argument.
Currently there is no provision for comments in the
argument file. Also, non-recognized arguments in the
file will cause an error message.
Additionally, cthread_parse_args() recognizes the following
monitoring specific arguments:
-cthread_steering
Enables default steering by forking separate steering
thread.
-cthread_adv_steering
Enables steering using the Progress steering library.
-cthread_default_monitoring
Causes events to be generated for cthread events.
-cthread_monitor_lms <number>
Sets the number of local monitor threads. Defaults
roughly to one local monitor for every eight processors
(or processes on the SPARC version).
-cthread_monitor_socket <machine name> <port number>
Causes the event stream to be directed to an internet
domain socket identified by <machine name>
<port number>.
-cthread_monitor_file <trace file name>
Causes the event stream to be written to a binary file
identified by <trace file name>.
-cthread_monitor_file_binary <trace file name>
Causes the event stream to be written to a binary file
identified by <trace file name>.
-cthread_monitor_buffer_size <number>
Sets the size of buffers used to buffer events between
the application and local monitor.
-cthread_logical_ts
Causes a logical timestamp to be stored to each event
instead of a physical timestamp.
LIMITS AND DEFAULTS
c c c c c c c l n n n n n n.
Value SUN KSR SGI Linux RS6000 Max
num_procs 32 64 16 32 32 Default threads per
proc 10 20 10 10 10 Default stack
size 10240 10240 10240 10240 10240 Default
memory exp 10 * * 10 10
* -- Ignored. Malloc used for memory management.
SEE ALSO
cthread_intro(3), cthread_configure(3),
cthread_monitoring_intro(3)
AUTHOR
Cthreads was written and maintained by many people.
This man page written by Greg Eisenhauer.