Motr  M0
console_u.c File Reference
#include <stdio.h>
#include <string.h>
#include "lib/getopts.h"
#include "lib/errno.h"
#include "lib/memory.h"
#include "lib/time.h"
#include "lib/arith.h"
#include "lib/trace.h"
#include "motr/init.h"
#include "module/instance.h"
#include "net/test/user_space/common_u.h"
#include "net/test/slist.h"
#include "net/test/stats.h"
#include "net/test/console.h"
#include "net/test/initfini.h"
Include dependency graph for console_u.c:

Go to the source code of this file.

Macros

#define DESCRIBE(field, name, description)
 
#define NUMBER_ARG(name)
 
#define SCALED_ARG(name)
 
#define SLIST_ARG(name)
 
#define ASCIIZ_ARG(name)
 
#define TIME_ARG(name)
 
#define CONSOLE_PRINT_MSG_NR(name)   printf("%s_"#name" %lu ", prefix, msg_nr->ntmn_##name)
 
#define CONSOLE_PRINT_STATS(name)   printf("%s_"#name" %lu ", prefix, stats->nts_##name);
 

Functions

 DESCRIBE (addr_console4servers, 'A', "Console command endpoint address " "for the test servers")
 
 DESCRIBE (addr_console4clients, 'a', "Console command endpoint address " "for the test clients")
 
 DESCRIBE (servers, 'C', "List of test server command endpoints")
 
 DESCRIBE (clients, 'c', "List of test client command endpoints")
 
 DESCRIBE (data_servers, 'D', "List of test server data endpoints")
 
 DESCRIBE (data_clients, 'd', "List of test client data endpoints")
 
 DESCRIBE (test_type, 't', "Test type, 'ping' or 'bulk'")
 
 DESCRIBE (msg_nr, 'n', "Number of test messages for the " "test client (for each server)")
 
 DESCRIBE (msg_size, 's', "Test message size")
 
 DESCRIBE (test_time_limit, 'T', "Test run time limit, seconds")
 
 DESCRIBE (bd_buf_nr_server, 'B', "Number of message buffers for bulk buffer " "network descriptors for the test server")
 
 DESCRIBE (bd_buf_nr_client, 'b', "Number of message buffers for bulk buffer " "network descriptors for the test client")
 
 DESCRIBE (bd_buf_size, 'f', "Size of buffer for bulk buffer " "network descriptors")
 
 DESCRIBE (bd_nr_max, 'g', "Maximum number of bulk buffer " "network descriptors in msg buffer")
 
 DESCRIBE (concurrency_server, 'E', "Test server concurrency")
 
 DESCRIBE (concurrency_client, 'e', "Test client concurrency")
 
static bool addr_check (const char *addr)
 
static bool addr_list_check (struct m0_net_test_slist *slist)
 
static bool config_check (struct m0_net_test_console_cfg *cfg)
 
static void print_slist (char *name, struct m0_net_test_slist *slist)
 
static void config_print (struct m0_net_test_console_cfg *cfg)
 
static int configure (int argc, char *argv[], struct m0_net_test_console_cfg *cfg)
 
static void config_free (struct m0_net_test_console_cfg *cfg)
 
static bool console_step (struct m0_net_test_console_ctx *ctx, enum m0_net_test_role role, enum m0_net_test_cmd_type cmd_type, const char *text_pre, const char *text_post)
 
static void print_msg_nr (const char *descr, struct m0_net_test_msg_nr *msg_nr)
 
static void print_stats (const char *descr, struct m0_net_test_stats *stats)
 
static void bsize_print (const char *descr, struct m0_net_test_console_ctx *ctx, double msg_nr)
 
static double avg_total (m0_time_t diff_t, double msg_nr)
 
static void print_status_data (struct m0_net_test_console_ctx *ctx)
 
static void print_msg_nr_parsable (const char *prefix, struct m0_net_test_msg_nr *msg_nr)
 
static void print_stats_parsable (const char *prefix, struct m0_net_test_stats *stats)
 
static void print_status_data_implementation (struct m0_net_test_cmd_status_data *sd, bool parsable)
 
static void print_status_data_v (struct m0_net_test_cmd_status_data *sd)
 
static void print_status_data_parsable (const char *prefix, struct m0_net_test_cmd_status_data *sd)
 
static int console_run (struct m0_net_test_console_ctx *ctx)
 
int main (int argc, char *argv[])
 

Variables

static bool produce_parsable_output = true
 
static bool parse_trace_buffer = false
 

Macro Definition Documentation

◆ ASCIIZ_ARG

#define ASCIIZ_ARG (   name)
Value:
M0_STRINGARG(opt_##name, msg_##name, \
LAMBDA(void, (const char *str) { \
cfg->ntcc_##name = m0_net_test_u_str_copy(str); \
}))
#define M0_STRINGARG(ch, desc, func)
Definition: getopts.h:207
#define LAMBDA(T,...)
Definition: thread.h:153
const char * name
Definition: trace.c:110
char * m0_net_test_u_str_copy(const char *str)
Definition: common_u.c:45

◆ CONSOLE_PRINT_MSG_NR

#define CONSOLE_PRINT_MSG_NR (   name)    printf("%s_"#name" %lu ", prefix, msg_nr->ntmn_##name)

◆ CONSOLE_PRINT_STATS

#define CONSOLE_PRINT_STATS (   name)    printf("%s_"#name" %lu ", prefix, stats->nts_##name);

◆ NUMBER_ARG

#define NUMBER_ARG (   name)
Value:
M0_NUMBERARG(opt_##name, msg_##name, \
LAMBDA(void, (int64_t nr) { \
if (nr <= 0) \
success = false; \
else \
cfg->ntcc_##name = nr; \
}))
static size_t nr
Definition: dump.c:1505
#define M0_NUMBERARG(ch, desc, func)
Definition: getopts.h:187
#define LAMBDA(T,...)
Definition: thread.h:153
const char * name
Definition: trace.c:110

◆ SCALED_ARG

#define SCALED_ARG (   name)
Value:
M0_SCALEDARG(opt_##name, msg_##name, \
LAMBDA(void, (m0_bcount_t size) { \
if (size <= 0) \
success = false; \
else \
cfg->ntcc_##name = size; \
}))
uint64_t m0_bcount_t
Definition: types.h:77
#define LAMBDA(T,...)
Definition: thread.h:153
const char * name
Definition: trace.c:110
#define M0_SCALEDARG(ch, desc, func)
Definition: getopts.h:197
m0_bcount_t size
Definition: di.c:39

◆ SLIST_ARG

#define SLIST_ARG (   name)
Value:
M0_STRINGARG(opt_##name, msg_##name, \
LAMBDA(void, (const char *str) { \
success &= \
m0_net_test_slist_init(&cfg->ntcc_##name, \
str, ',') == 0; \
}))
#define M0_STRINGARG(ch, desc, func)
Definition: getopts.h:207
#define LAMBDA(T,...)
Definition: thread.h:153
const char * name
Definition: trace.c:110

◆ TIME_ARG

#define TIME_ARG (   name)
Value:
M0_NUMBERARG(opt_##name, msg_##name, \
LAMBDA(void, (int64_t nr) { \
if (nr <= 0) \
success = false; \
else \
cfg->ntcc_##name = M0_MKTIME(nr, 0); \
}))
static size_t nr
Definition: dump.c:1505
#define M0_NUMBERARG(ch, desc, func)
Definition: getopts.h:187
#define LAMBDA(T,...)
Definition: thread.h:153
const char * name
Definition: trace.c:110
#define M0_MKTIME(secs, ns)
Definition: time.h:86