|
M_io_error_t | M_io_add_bwshaping (M_io_t *io, size_t *layer_id) |
|
M_bool | M_io_bwshaping_set_throttle (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 Bps) |
|
M_bool | M_io_bwshaping_set_throttle_mode (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_io_bwshaping_mode_t mode) |
|
M_bool | M_io_bwshaping_set_throttle_period (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 period_s, M_uint64 sample_frequency_ms) |
|
M_bool | M_io_bwshaping_set_latency (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction, M_uint64 latency_ms) |
|
M_uint64 | M_io_bwshaping_get_Bps (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction) |
|
M_uint64 | M_io_bwshaping_get_totalbytes (M_io_t *io, size_t layer_id, M_io_bwshaping_direction_t direction) |
|
M_uint64 | M_io_bwshaping_get_totalms (M_io_t *io, size_t layer_id) |
|
Bandwidth Shaping Addon
Allows tracking and altering data flow though an io object.
Common uses:
- Tracking bandwidth utilization.
- Rate limiting download speed for connected clients.
- Throttling to prevent network link saturation.
- Testing real world network setups.
- Determining how an application will perform in a bad environment.
◆ M_io_bwshaping_mode_t
◆ M_io_bwshaping_direction_t
◆ M_io_bwshaping_mode
Method of shaping.
Enumerator |
---|
M_IO_BWSHAPING_MODE_BURST | Allow bursting of data for each throttle period
|
M_IO_BWSHAPING_MODE_TRICKLE | Enforce data to be more evenly distributed across the throttle period
|
◆ M_io_bwshaping_direction
Shaping direction.
Enumerator |
---|
M_IO_BWSHAPING_DIRECTION_IN | |
M_IO_BWSHAPING_DIRECTION_OUT | |
◆ M_io_add_bwshaping()
Add a BWShaping layer.
Adding a layer without any settings will track bandwidth utilization
- Parameters
-
[in] | io | io object. |
[out] | layer_id | Layer id this is added at. |
- Returns
- Result.
◆ M_io_bwshaping_set_throttle()
Throttle data by bytes per seconds.
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
[in] | Bps | Bytes per seconds that should be throttled. Bps = 0 is infinite. |
- Returns
- Result.
◆ M_io_bwshaping_set_throttle_mode()
Set how the data throttling should function.
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
[in] | mode | Throttle mode. |
- Returns
- Result.
◆ M_io_bwshaping_set_throttle_period()
M_bool M_io_bwshaping_set_throttle_period |
( |
M_io_t * |
io, |
|
|
size_t |
layer_id, |
|
|
M_io_bwshaping_direction_t |
direction, |
|
|
M_uint64 |
period_s, |
|
|
M_uint64 |
sample_frequency_ms |
|
) |
| |
Set throttle period.
The period must be longer than the sample frequency. Meaning period * 1000 > sample frequency.
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
[in] | period_s | Period in seconds. Must be at least 1. |
[in] | sample_frequency_ms | Frequency in milliseconds. Must be at least 15. |
- Returns
- Result.
◆ M_io_bwshaping_set_latency()
Set latency.
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
[in] | latency_ms | Latency in milliseconds. 0 is no latency. |
- Returns
- Result.
◆ M_io_bwshaping_get_Bps()
Get current Bps in period for direction
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
- Returns
- Bps.
◆ M_io_bwshaping_get_totalbytes()
Get total number of bytes transferred for direction since beginning
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
[in] | direction | Direction this applies to. |
- Returns
- Count of bytes.
◆ M_io_bwshaping_get_totalms()
M_uint64 M_io_bwshaping_get_totalms |
( |
M_io_t * |
io, |
|
|
size_t |
layer_id |
|
) |
| |
Get total time of connection in ms
- Parameters
-
[in] | io | io object. |
[in] | layer_id | Layer id to apply this to. This should be the same layer id returned form M_io_add_bwshaping. |
- Returns
- Milliseconds.