Struct heph::rt::Setup [−][src]
pub struct Setup { /* fields omitted */ }
Expand description
Setup a Runtime
.
This type implements a builder pattern to build a Runtime
. It is created
via Runtime::setup
, for examples and usage see rt
module.
Implementations
Set the name of the application.
If the name is not set when the runtime is build the name of the binary called will be used.
Returns the application name, if set using Setup::with_name
.
Set the number of worker threads to use, defaults to one.
Most applications would want to use Setup::use_all_cores
which sets
the number of threads equal to the number of CPU cores.
Set the number of worker threads equal to the number of CPU cores.
This uses thread::available_concurrency
, please read its
documentation for a number of caveats and platform-specific behaviour.
Returns the number of worker threads to use.
See Setup::num_threads
.
Automatically set CPU affinity.
This uses pthread_setaffinity_np(3)
to set the CPU affinity for each
worker thread to there own CPU core.
Thread-local workers creating sockets, such as UdpSocket
or
TcpStream
, will use SO_INCOMING_CPU
to set the CPU affinity to
the same value as the worker’s affinity.
Notes
The is mostly useful when using Setup::use_all_cores
to create a
single worker thread per CPU core.
This is currently only implementated on Linux.
Generate a trace of the runtime, writing it to the file specified by
path
.
See the trace
module for more information.
Returns an error if a file at path
already exists or can’t create the
file.