#include "qos_ul.h"
#include <linux/types.h>
#include <linux/aquosa/rres_config.h>
#include <sys/types.h>
#include "qos_debug.h"
Go to the source code of this file.
Defines | |
#define | QRES_TIME_FMT "%ld" |
Format string for printing qres_time_t. | |
#define | QRES_ATIME_FMT "%lld" |
Format string for printing qres_time_t. | |
#define | QRES_SID_FMT "%d" |
Format string for printing qres_sid_t. | |
#define | QRES_SID_NULL ((qres_sid_t)0) |
Null server identifier. | |
#define | QOS_BW_FMT "%lu" |
Format string to be used for qos_bw_t types in printf-like functions. | |
#define | QOS_BW_BITS 24 |
Precision of representation of a bandwidth value. | |
#define | MAX_BW (1ul << QOS_BW_BITS) |
Corresponds to maximum CPU usage (1.0). | |
#define | U_LUB r2bw_c(RRES_U_LUB, 100) |
Maximum utilizable bandwidth. | |
#define | md2bw(b) ((qos_bw_t) (b * (double) MAX_BW)) |
Warning: inside kernel, use exclusively with constant parameters. | |
#define | r2bw_c(Q, P) ((qos_bw_t) ((((unsigned long long) (Q)) << QOS_BW_BITS) / (P))) |
Converts a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value. | |
#define | QRES_DEF_P 100000 |
The default P value used when not specified. | |
#define | QOS_F_DEFAULT 0x00000001 |
The server to create is the default one. | |
#define | QOS_F_SOFT 0x00000002 |
Server tasks are scheduled within the reservation, and also by Linux outside, when budget is exhausted. | |
#define | QOS_F_NOMULTI 0x00000004 |
Do not allow more tasks in the new server. | |
#define | QOS_F_PERSISTENT 0x00000008 |
Empty server survives until a maximum timeout. | |
Typedefs | |
typedef long | qres_time_t |
Represents times in usecs. | |
typedef long long | qres_atime_t |
Represents absolute time. | |
typedef int | qres_sid_t |
Identifies uniquely a server. | |
typedef int | qos_bool_t |
Boolean type. | |
typedef pid_t | tid_t |
Identifies a thread together with the pid of the owning process. | |
typedef unsigned long int | qos_bw_t |
The type used for representing a CPU bandwidth. | |
Functions | |
static struct timespec | qres_time_to_timespec (qres_time_t time) |
static qres_time_t | qres_timespec_to_time (struct timespec ts) |
static qos_bw_t | d2bw (double b) |
Convert a double in the range [0..1] to a qos_bw_t. | |
static double | bw2d (qos_bw_t b) |
Convert a qos_bw_t to a double in the range [0..1]. | |
static qos_bw_t | r2bw (qres_time_t Q, qres_time_t P) |
Converts a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value. | |
static qos_bw_t | r2bw_ceil (qres_time_t Q, qres_time_t P) |
Convert a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value, upper-rounding the result. | |
static unsigned long | div_by_bw (unsigned long num, qos_bw_t bw) |
static unsigned long | mul_by_bw (unsigned long value, qos_bw_t bw) |
static qres_time_t | bw2Q (qos_bw_t bw, qres_time_t P) |
Computes the budget Q of a reservation (Q, P) from the server period P and the ratio Q/P represented as a qos_bw_t value. |
#define MAX_BW (1ul << QOS_BW_BITS) |
Corresponds to maximum CPU usage (1.0).
This is a theoretical value, never assigned to any task in practice.
Definition at line 84 of file qos_types.h.
Referenced by bw2d(), d2bw(), and rres_init_server().
#define md2bw | ( | b | ) | ((qos_bw_t) (b * (double) MAX_BW)) |
Warning: inside kernel, use exclusively with constant parameters.
Definition at line 101 of file qos_types.h.
#define QOS_BW_BITS 24 |
Precision of representation of a bandwidth value.
This is the number of bits used to represent a bandwidth value in the range [0.0, 1.0].
Definition at line 79 of file qos_types.h.
Referenced by bw2Q(), div_by_bw(), mul_by_bw(), r2bw(), r2bw_ceil(), and test().
#define QOS_BW_FMT "%lu" |
Format string to be used for qos_bw_t types in printf-like functions.
Definition at line 72 of file qos_types.h.
Referenced by qos_func_define(), qsup_set_required_bw(), recharge(), and rres_set_current_bandwidth().
#define QOS_F_DEFAULT 0x00000001 |
The server to create is the default one.
Definition at line 162 of file qos_types.h.
Referenced by flags2str(), qos_func_define(), rres_init_server(), and str2flags().
#define QOS_F_NOMULTI 0x00000004 |
Do not allow more tasks in the new server.
Definition at line 171 of file qos_types.h.
#define QOS_F_PERSISTENT 0x00000008 |
Empty server survives until a maximum timeout.
Definition at line 172 of file qos_types.h.
Referenced by flags2str(), rres_check_destroy(), and str2flags().
#define QOS_F_SOFT 0x00000002 |
Server tasks are scheduled within the reservation, and also by Linux outside, when budget is exhausted.
Definition at line 170 of file qos_types.h.
Referenced by dispatch_task_safe(), flags2str(), stop_task_safe(), and str2flags().
#define QRES_ATIME_FMT "%lld" |
Format string for printing qres_time_t.
Definition at line 22 of file qos_types.h.
Referenced by main(), and main_body().
#define QRES_DEF_P 100000 |
The default P value used when not specified.
Definition at line 155 of file qos_types.h.
#define QRES_SID_FMT "%d" |
Format string for printing qres_sid_t.
Definition at line 37 of file qos_types.h.
Referenced by _rres_cleanup_server().
#define QRES_SID_NULL ((qres_sid_t)0) |
Null server identifier.
Definition at line 39 of file qos_types.h.
Referenced by main(), new_server_id(), rres_find_by_id(), rres_get_sid(), and rres_init_server().
#define QRES_TIME_FMT "%ld" |
Format string for printing qres_time_t.
Definition at line 21 of file qos_types.h.
Referenced by _rres_cleanup_server(), data_write_timestamps(), main(), main_body(), main_loop(), qos_func_define(), qsup_dump(), rres_get_params(), rres_init_server(), rres_set_params(), and test().
#define r2bw_c | ( | Q, | |||
P | ) | ((qos_bw_t) ((((unsigned long long) (Q)) << QOS_BW_BITS) / (P))) |
Converts a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value.
This macro is more convenient than r2bw() for initializing constants, but has fewer parameter checks and is more inefficient.
Definition at line 138 of file qos_types.h.
#define U_LUB r2bw_c(RRES_U_LUB, 100) |
Maximum utilizable bandwidth.
This may be less than one in order to account for scheduling overhead
Definition at line 89 of file qos_types.h.
Referenced by qsup_add_level_rule(), qsup_init(), qsup_init_server(), qsup_reserve_spare(), and qsup_set_required_bw().
typedef int qos_bool_t |
Boolean type.
This is mainly used for the purpose of clarifying that the value may be used within an if statement condition, and that boolean operators should be used in place of bitwise ones, when logically combining multiple values of this kind.
Definition at line 48 of file qos_types.h.
typedef unsigned long int qos_bw_t |
The type used for representing a CPU bandwidth.
A CPU bandwidth is a fraction of usage of the processor, in the Resource Reservation meaning, whose maximum value is 1.0. It is represented as a fixed precision number.
Definition at line 69 of file qos_types.h.
typedef long long qres_atime_t |
Represents absolute time.
Definition at line 19 of file qos_types.h.
typedef int qres_sid_t |
Identifies uniquely a server.
Definition at line 36 of file qos_types.h.
typedef long qres_time_t |
Represents times in usecs.
Definition at line 17 of file qos_types.h.
typedef pid_t tid_t |
Identifies a thread together with the pid of the owning process.
Definition at line 61 of file qos_types.h.
static double bw2d | ( | qos_bw_t | b | ) | [inline, static] |
Convert a qos_bw_t to a double in the range [0..1].
This function should not be used inside the kernel.
Definition at line 107 of file qos_types.h.
References MAX_BW.
Referenced by main().
static qres_time_t bw2Q | ( | qos_bw_t | bw, | |
qres_time_t | P | |||
) | [inline, static] |
Computes the budget Q of a reservation (Q, P) from the server period P and the ratio Q/P represented as a qos_bw_t value.
Definition at line 145 of file qos_types.h.
References QOS_BW_BITS, and ul_mul_shr.
Referenced by main(), qos_func_define(), qres_set_bandwidth(), qres_update_bandwidths(), qsup_dump(), recharge(), rres_get_actual_budget(), rres_get_params(), rres_set_params(), and test().
static qos_bw_t d2bw | ( | double | b | ) | [inline, static] |
Convert a double in the range [0..1] to a qos_bw_t.
This function should not be used inside the kernel.
Definition at line 96 of file qos_types.h.
References MAX_BW.
Referenced by fill_rule(), and main().
static unsigned long div_by_bw | ( | unsigned long | num, | |
qos_bw_t | bw | |||
) | [inline, static] |
Definition at line 126 of file qos_types.h.
References QOS_BW_BITS, and ul_shl_div.
static unsigned long mul_by_bw | ( | unsigned long | value, | |
qos_bw_t | bw | |||
) | [inline, static] |
Definition at line 130 of file qos_types.h.
References QOS_BW_BITS, and ul_mul_shr.
static struct timespec qres_time_to_timespec | ( | qres_time_t | time | ) | [static, read] |
Definition at line 24 of file qos_types.h.
static qres_time_t qres_timespec_to_time | ( | struct timespec | ts | ) | [inline, static] |
Definition at line 31 of file qos_types.h.
static qos_bw_t r2bw | ( | qres_time_t | Q, | |
qres_time_t | P | |||
) | [inline, static] |
Converts a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value.
Definition at line 115 of file qos_types.h.
References QOS_BW_BITS, and ul_shl_div.
Referenced by _rres_get_bandwidth(), qos_func_define(), rres_init_server(), rres_set_budget(), and rres_set_params().
static qos_bw_t r2bw_ceil | ( | qres_time_t | Q, | |
qres_time_t | P | |||
) | [inline, static] |
Convert a reservation (Q,P) into the ratio Q/P represented as a qos_bw_t value, upper-rounding the result.
Definition at line 122 of file qos_types.h.
References QOS_BW_BITS, and ul_shl_ceil.
Referenced by qos_func_define(), qsup_init_server(), and test().