TSLoad high-level API
Use this API to build custom agent on top of libtsload
Constants
TSLOAD_ERROR, TSLOAD_OK
TSLoad error codes
#define TSLOAD_ERROR 1 #define TSLOAD_OK 0
TSLOAD_PARAM_NULL, TSLOAD_PARAM_RANDVAR, TSLOAD_PARAM_MASK, TSLOAD_PARAM_MAP_FLAG, TSLOAD_PARAM_BOOLEAN, TSLOAD_PARAM_ARRAY_FLAG, TSLOAD_PARAM_INTEGER, TSLOAD_PARAM_FLOAT, TSLOAD_PARAM_RANDGEN, TSLOAD_PARAM_STRING
TSLoad parameter types. Used for describing complex parameters
#define TSLOAD_PARAM_NULL 0 #define TSLOAD_PARAM_BOOLEAN 1 #define TSLOAD_PARAM_INTEGER 2 #define TSLOAD_PARAM_FLOAT 3 #define TSLOAD_PARAM_STRING 4 #define TSLOAD_PARAM_RANDGEN 5 #define TSLOAD_PARAM_RANDVAR 6 #define TSLOAD_PARAM_MASK 0x0ff #define TSLOAD_PARAM_ARRAY_FLAG 0x100 #define TSLOAD_PARAM_MAP_FLAG 0x200
Functions
tsload_error_msg, tsload_error_msg_func
Hook that called when one of high-level operations encounters errors.
May be called multiple times during one call
typedef void (*tsload_error_msg_func)(ts_errcode_t code, const char* format, ...); LIBIMPORT tsload_error_msg_func tsload_error_msg
tsload_workload_status, tsload_workload_status_func
Hook for reporting workload statuses
typedef void (*tsload_workload_status_func)(const char* wl_name,int status,long progress,const char* config_msg); LIBIMPORT tsload_workload_status_func tsload_workload_status
tsload_requests_report_func, tsload_requests_report
Hook for reporting requests and it's params
typedef void (*tsload_requests_report_func)(list_head_t* rq_list); LIBIMPORT tsload_requests_report_func tsload_requests_report
tsload_walk_workload_types
public
Walk over workload types registered within TSLoad
LIBEXPORT void* tsload_walk_workload_types(tsload_walk_op_t op, void* arg, hm_walker_func walker)
tsload_walk_tp_dispatchers, tsload_walk_random_variators, tsload_walk_rqsched_variators, tsload_walk_request_schedulers, tsload_walk_random_generators
public
LIBEXPORT void* tsload_walk_random_generators(tsload_walk_op_t op, void* arg, hm_walker_func walker) LIBEXPORT void* tsload_walk_random_variators(tsload_walk_op_t op, void* arg, hm_walker_func walker) LIBEXPORT void* tsload_walk_tp_dispatchers(tsload_walk_op_t op, void* arg, hm_walker_func walker) LIBEXPORT void* tsload_walk_rqsched_variators(tsload_walk_op_t op, void* arg, hm_walker_func walker) LIBEXPORT void* tsload_walk_request_schedulers(tsload_walk_op_t op, void* arg, hm_walker_func walker)
tsload_get_resources, tsload_get_hostinfo
public
LIBEXPORT tsobj_node_t* tsload_get_resources(void) LIBEXPORT tsobj_node_t* tsload_get_hostinfo(void)
tsload_configure_workload
public
Create and configure new workload
ARGUMENTS
-
wl_name - name of workload
-
wl_type - name of workload type
-
tp_name - name of threadpool where workload would be attached. For chained workloads should be NULL
-
deadline - deadline for request execution
-
wl_chain_params - parameters of chaining in experiment.json format
-
rqsched_params - parameters of request scheduler in experiment.json format
-
wl_params - workload and request param configuration
LIBEXPORT int tsload_configure_workload(const char* wl_name, const char* wl_type, const char* tp_name, ts_time_t deadline,tsobj_node_t* wl_chain_params, tsobj_node_t* rqsched_params, tsobj_node_t* wl_params)
tsload_provide_step
public
Provide step for workload
ARGUMENTS
-
wl_name - name of workload
-
step_id - id of step. This argument is used to control that no tsload_provide_step calls was missed
-
num_rqs - number of request that should be generated
-
trace_rqs - queue of requests that created earlier from trace through tsload_create_request(). If this list not empty, than TSLoad would generate num_rqs requests
-
pstatus - output field that set to WL_STEP_QUEUE_FULL if function returns TSLOAD_OK, but queue of workload requests is overrun.
LIBEXPORT int tsload_provide_step(const char* wl_name, long step_id, unsigned num_rqs, list_head_t* trace_rqs,int* pstatus)
tsload_create_request
public
Create request and link it into rq_list to create trace-driven workloads
If chained is set B_TRUE, then it actually chains to last request in rq_list
ARGUMENTS
-
wl_name - name of workload
-
rq_list - linked list where new request should be put
-
chained - is request chained?
-
rq_id - id of request
-
step - id of step. Not neccessary be current/next step of workload
-
user_id - Id of user for user threadpool dispatcher
-
thread_id - Id of thread for trace threadpool dispatcher
-
sched_time - Scheduled time of request execution
-
rq_params - Vector of request params (copied inside this function, so it could be safely deallocated after call)
NOTES
If error occurs, tsload_create_request() will empty rq_list
LIBEXPORT int tsload_create_request(const char* wl_name, list_head_t* rq_list, boolean_t chained,int rq_id, long step, int user_id, int thread_id,ts_time_t sched_time, void* rq_params)
tsload_start_workload
public
Schedule workload to start
ARGUMENTS
-
wl_name - name of workload
-
start_time - scheduled start time
LIBEXPORT int tsload_start_workload(const char* wl_name, ts_time_t start_time)
tsload_unconfigure_workload
public
Unconfigure workload. Couldn't be called for workload that
currenly have "WLS_CONFIGURING" state because we couldn't interrupt
module routine
ARGUMENTS
-
wl_name - name of workload
LIBEXPORT int tsload_unconfigure_workload(const char* wl_name)
tsload_create_threadpool
public
Create threadpool
ARGUMENTS
-
tp_name - name of threadpool
-
num_threads - number of threads inside threadpool
-
quantum - threadpool's quantum
-
discard - if set to B_TRUE, threadpool will discard requests that missed their step
-
disp - parameters of threadpool dispatcher according to experiment.json format
LIBEXPORT int tsload_create_threadpool(const char* tp_name, unsigned num_threads, ts_time_t quantum,boolean_t discard, tsobj_node_t* disp)
tsload_schedule_threadpool
public
Set threadpool scheduler options
ARGUMENTS
-
tp_name - name of threadpool
-
sched - scheduling parameters according to experiment.json format
LIBEXPORT int tsload_schedule_threadpool(const char* tp_name, tsobj_node_t* sched)
tsload_destroy_threadpool, tsload_walk_threadpools
public
LIBEXPORT void* tsload_walk_threadpools(tsload_walk_op_t op, void* arg, hm_walker_func walker) LIBEXPORT int tsload_destroy_threadpool(const char* tp_name)
tsload_start, tsload_init
public
LIBEXPORT int tsload_init(struct subsystem* pre_subsys, unsigned pre_count,struct subsystem* post_subsys, unsigned post_count) LIBEXPORT int tsload_start(const char* basename)
Types
typedef struct tsload_param
typedef struct tsload_param { int type; const char* name; const char* hint; } tsload_param_t;
typedef enum tsload_walk_op
Walkie-talkie. Operations for tsload_walk_ functions
VALUES
-
TSLOAD_WALK_FIND - Find element identified by key stored in arg
-
TSLOAD_WALK_TSOBJ - Do TSLOAD_WALK_FIND but return formatted tsobj_node_t
-
TSLOAD_WALK_TSOBJ_ALL - Walks over hashmap and return TSObject of all items. args are ignored
-
TSLOAD_WALK_WALK - Walk over hashmap traditionally. arg - context of the walker
typedef enum tsload_walk_op { TSLOAD_WALK_FIND, TSLOAD_WALK_TSOBJ, TSLOAD_WALK_TSOBJ_ALL, TSLOAD_WALK_WALK } tsload_walk_op_t;