summaryrefslogtreecommitdiffstats
path: root/ctdb/include
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-04-20 20:07:47 +1000
committerAndrew Tridgell <tridge@samba.org>2007-04-20 20:07:47 +1000
commit2e5aae04de7ba8d8b4dd67e1743d396f3d09b68c (patch)
treed6c33c810070013309ad8b19ba971c687e2405e8 /ctdb/include
parent00c706c2b8310fc3bafc19fd361277817b60faa1 (diff)
downloadsamba-2e5aae04de7ba8d8b4dd67e1743d396f3d09b68c.tar.gz
samba-2e5aae04de7ba8d8b4dd67e1743d396f3d09b68c.tar.xz
samba-2e5aae04de7ba8d8b4dd67e1743d396f3d09b68c.zip
added ctdb_status tool
(This used to be ctdb commit 908d6c6a936e21f70f05827ce302e966cca0132a)
Diffstat (limited to 'ctdb/include')
-rw-r--r--ctdb/include/ctdb.h5
-rw-r--r--ctdb/include/ctdb_private.h34
2 files changed, 38 insertions, 1 deletions
diff --git a/ctdb/include/ctdb.h b/ctdb/include/ctdb.h
index 997bdc6e13..cb765884b6 100644
--- a/ctdb/include/ctdb.h
+++ b/ctdb/include/ctdb.h
@@ -208,4 +208,9 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb,
struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
+struct ctdb_context *ctdb_cmdline_client(struct event_context *ev, const char *ctdb_socket);
+
+struct ctdb_status;
+int ctdb_status(struct ctdb_context *ctdb, struct ctdb_status *status);
+
#endif
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 2f42cfb88a..c46a2c0250 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -114,6 +114,22 @@ struct ctdb_daemon_data {
struct ctdb_queue *queue;
};
+/*
+ ctdb status information
+ */
+struct ctdb_status {
+ uint32_t client_packets_sent;
+ uint32_t client_packets_recv;
+ uint32_t node_packets_sent;
+ uint32_t node_packets_recv;
+ uint32_t total_calls;
+ uint32_t pending_calls;
+ uint32_t lockwait_calls;
+ uint32_t pending_lockwait_calls;
+ double max_call_latency;
+ double max_lockwait_latency;
+};
+
/* main state of the ctdb daemon */
struct ctdb_context {
struct event_context *ev;
@@ -135,6 +151,7 @@ struct ctdb_context {
struct ctdb_db_context *db_list;
struct ctdb_message_list *message_list;
struct ctdb_daemon_data daemon;
+ struct ctdb_status status;
};
struct ctdb_db_context {
@@ -225,7 +242,9 @@ enum ctdb_operation {
CTDB_REQ_REGISTER = 1000,
CTDB_REQ_CONNECT_WAIT = 1001,
CTDB_REPLY_CONNECT_WAIT = 1002,
- CTDB_REQ_SHUTDOWN = 1003
+ CTDB_REQ_SHUTDOWN = 1003,
+ CTDB_REQ_STATUS = 1004,
+ CTDB_REPLY_STATUS = 1005
};
#define CTDB_MAGIC 0x43544442 /* CTDB */
@@ -318,6 +337,15 @@ struct ctdb_reply_connect_wait {
uint32_t num_connected;
};
+struct ctdb_req_status {
+ struct ctdb_req_header hdr;
+};
+
+struct ctdb_reply_status {
+ struct ctdb_req_header hdr;
+ struct ctdb_status status;
+};
+
/* internal prototypes */
void ctdb_set_error(struct ctdb_context *ctdb, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
void ctdb_fatal(struct ctdb_context *ctdb, const char *msg);
@@ -459,4 +487,8 @@ void *_idr_find_type(struct idr_context *idp, int id, const char *type, const ch
void ctdb_recv_raw_pkt(void *p, uint8_t *data, uint32_t length);
+int ctdb_socket_connect(struct ctdb_context *ctdb);
+
+void ctdb_latency(double *latency, struct timeval t);
+
#endif