gfio: ignore group stats for now
[fio.git] / client.h
CommitLineData
dd366728
SC
1#ifndef CLIENT_H
2#define CLIENT_H
3
0f92bd20
JA
4#include <sys/socket.h>
5#include <sys/un.h>
6#include <netinet/in.h>
7#include <arpa/inet.h>
8
3e47bd25
JA
9#include "stat.h"
10
dd366728 11struct fio_net_cmd;
a5276616 12struct client_ops;
dd366728 13
b9d2f30a
JA
14enum {
15 Client_created = 0,
16 Client_connected = 1,
17 Client_started = 2,
18 Client_running = 3,
19 Client_stopped = 4,
20 Client_exited = 5,
21};
22
0f92bd20
JA
23struct fio_client {
24 struct flist_head list;
25 struct flist_head hash_list;
26 struct flist_head arg_list;
27 union {
28 struct sockaddr_in addr;
29 struct sockaddr_in6 addr6;
30 struct sockaddr_un addr_un;
31 };
32 char *hostname;
33 int port;
34 int fd;
5121a9aa 35 unsigned int refs;
0f92bd20
JA
36
37 char *name;
38
39 int state;
40
41 int skip_newline;
42 int is_sock;
43 int disk_stats_shown;
44 unsigned int jobs;
45 int error;
46 int ipv6;
47 int sent_job;
48
49 struct flist_head eta_list;
50 struct client_eta *eta_in_flight;
51
52 struct flist_head cmd_list;
53
54 uint16_t argc;
55 char **argv;
3ec62ec4 56
a5276616 57 struct client_ops *ops;
3ec62ec4 58 void *client_data;
0f92bd20
JA
59};
60
084d1c6f 61typedef void (*client_text_op_func)(struct fio_client *client, struct fio_net_cmd *cmd);
dd366728 62typedef void (*client_disk_util_op_func)(struct fio_client *client, struct fio_net_cmd *cmd);
89e5fad9
JA
63typedef void (*client_thread_status_op)(struct fio_client *client, struct fio_net_cmd *cmd);
64typedef void (*client_group_stats_op)(struct fio_client *client, struct fio_net_cmd *cmd);
a5276616 65typedef void (*client_eta_op)(struct jobs_eta *je);
dd366728 66typedef void (*client_probe_op)(struct fio_client *client, struct fio_net_cmd *cmd);
04cc6b77 67typedef void (*client_thread_status_display_op)(char *status_message, double perc);
3ec62ec4 68typedef void (*client_quit_op)(struct fio_client *);
807f9971 69typedef void (*client_add_job_op)(struct fio_client *, struct fio_net_cmd *);
ed727a46 70typedef void (*client_timed_out)(struct fio_client *);
6b79c80c 71typedef void (*client_stop_op)(struct fio_client *, struct fio_net_cmd *);
3ec62ec4 72
dd366728
SC
73struct client_ops {
74 client_text_op_func text_op;
75 client_disk_util_op_func disk_util;
76 client_thread_status_op thread_status;
77 client_group_stats_op group_stats;
0420ba6a 78 client_eta_op eta;
dd366728 79 client_probe_op probe;
3ec62ec4 80 client_quit_op quit;
807f9971 81 client_add_job_op add_job;
ed727a46 82 client_timed_out timed_out;
6b79c80c 83 client_stop_op stop;
3ec62ec4 84 int stay_connected;
dd366728
SC
85};
86
87extern struct client_ops fio_client_ops;
88
3e47bd25
JA
89struct client_eta {
90 struct jobs_eta eta;
91 unsigned int pending;
92};
93
a5276616
JA
94extern int fio_handle_client(struct fio_client *);
95extern void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op fn);
3e47bd25 96extern void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je);
3e47bd25 97
3ec62ec4
JA
98enum {
99 Fio_client_ipv4 = 1,
100 Fio_client_ipv6,
101 Fio_client_socket,
102};
103
104extern int fio_clients_connect(void);
b9d2f30a
JA
105extern int fio_start_client(struct fio_client *);
106extern int fio_start_all_clients(void);
3ec62ec4 107extern int fio_clients_send_ini(const char *);
a5276616
JA
108extern int fio_handle_clients(struct client_ops *);
109extern int fio_client_add(struct client_ops *, const char *, void **);
110extern struct fio_client *fio_client_add_explicit(struct client_ops *, const char *, int, int);
3ec62ec4 111extern void fio_client_add_cmd_option(void *, const char *);
df06f220
JA
112extern void fio_clients_terminate(void);
113
dd366728
SC
114#endif
115