tool functions TAPI

Overview

TAPI to handle wrk tool. More…

// typedefs

typedef struct tapi_wrk_opt tapi_wrk_opt;
typedef struct tapi_wrk_thread_stats tapi_wrk_thread_stats;
typedef struct tapi_wrk_latency_percentile tapi_wrk_latency_percentile;
typedef struct tapi_wrk_socket_errors tapi_wrk_socket_errors;
typedef struct tapi_wrk_report tapi_wrk_report;
typedef struct tapi_wrk_app tapi_wrk_app;

// structs

struct tapi_wrk_app;
struct tapi_wrk_latency_percentile;
struct tapi_wrk_opt;
struct tapi_wrk_report;
struct tapi_wrk_socket_errors;
struct tapi_wrk_thread_stats;

// global variables

const tapi_wrk_opt tapi_wrk_default_opt;

// global functions

te_errno tapi_wrk_create(tapi_job_factory_t* factory, const tapi_wrk_opt* opt, tapi_wrk_app** app);
te_errno tapi_wrk_start(tapi_wrk_app* app);
te_errno tapi_wrk_wait(tapi_wrk_app* app, int timeout_ms);
te_errno tapi_wrk_get_report(tapi_wrk_app* app, tapi_wrk_report* report);
te_errno tapi_wrk_kill(tapi_wrk_app* app, int signo);
te_errno tapi_wrk_destroy(tapi_wrk_app* app);
void tapi_wrk_report_mi_log(te_mi_logger* logger, const tapi_wrk_report* report);

// macros

#define TAPI_WRK_HEADERS_MAX
#define TAPI_WRK_LATENCY_DISTR_ENTRIES
#define TAPI_WRK_SCRIPT_ARGS_MAX

Detailed Documentation

TAPI to handle wrk tool.

Copyright (C) 2019-2022 OKTET Labs Ltd. All rights reserved.

Typedefs

typedef struct tapi_wrk_opt tapi_wrk_opt

wrk tool specific command line options

typedef struct tapi_wrk_thread_stats tapi_wrk_thread_stats

Statistics for a single thread in wrk

typedef struct tapi_wrk_latency_percentile tapi_wrk_latency_percentile

Entry of latency distribution statistics

typedef struct tapi_wrk_socket_errors tapi_wrk_socket_errors

Statistics of socket errors

typedef struct tapi_wrk_report tapi_wrk_report

Statistics report of wrk

typedef struct tapi_wrk_app tapi_wrk_app

Information of a wrk tool

Global Variables

const tapi_wrk_opt tapi_wrk_default_opt

Default options initializer

Global Functions

te_errno tapi_wrk_create(tapi_job_factory_t* factory, const tapi_wrk_opt* opt, tapi_wrk_app** app)

Create wrk app. All needed information to run wrk is in opt

Parameters:

factory

Job factory.

opt

Options of wrk tool.

app

wrk app handle.

Returns:

Status code.

te_errno tapi_wrk_start(tapi_wrk_app* app)

Start wrk.

Parameters:

app

wrk app handle.

Returns:

Status code.

te_errno tapi_wrk_wait(tapi_wrk_app* app, int timeout_ms)

Wait for wrk completion.

Parameters:

app

wrk app handle.

timeout_ms

Wait timeout in milliseconds.

Returns:

Status code.

te_errno tapi_wrk_get_report(tapi_wrk_app* app, tapi_wrk_report* report)

Get wrk report.

Field ‘arguments’ in the report points to a new allocated string that should be freed by user.

Parameters:

app

wrk app handle.

report

wrk statistics report.

Returns:

Status code.

te_errno tapi_wrk_kill(tapi_wrk_app* app, int signo)

Send a signal to wrk.

Parameters:

app

wrk app handle.

signo

Signal to send to wrk.

Returns:

Status code.

te_errno tapi_wrk_destroy(tapi_wrk_app* app)

Destroy wrk app.

Parameters:

app

wrk app handle.

Returns:

Status code.

void tapi_wrk_report_mi_log(te_mi_logger* logger, const tapi_wrk_report* report)

Add wrk report to MI logger.

Parameters:

logger

MI logger entity

report

wrk statistics report.

Macros

#define TAPI_WRK_HEADERS_MAX

Maximum number of headers that can be set in wrk options

#define TAPI_WRK_LATENCY_DISTR_ENTRIES

Number of entries in wrk latency distibution statistics

#define TAPI_WRK_SCRIPT_ARGS_MAX

Maximum number of arguments that can be passed to the Lua script