]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
- expanded status to include count of each call type
authorAndrew Tridgell <tridge@samba.org>
Fri, 20 Apr 2007 11:02:53 +0000 (21:02 +1000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 20 Apr 2007 11:02:53 +0000 (21:02 +1000)
- added lockwait latency

(This used to be ctdb commit 0b5d196147e644cf8b172cb4b593fd46b1caa386)

ctdb/common/ctdb.c
ctdb/common/ctdb_daemon.c
ctdb/common/ctdb_lockwait.c
ctdb/include/ctdb_private.h
ctdb/tools/ctdb_status.c

index ed96df91021fea30cc0b7fdf05decf2b5c6428a3..6bd2fda52941012eb43a6cd481fc1ed7e8f84336 100644 (file)
@@ -246,34 +246,42 @@ void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t length)
 
        switch (hdr->operation) {
        case CTDB_REQ_CALL:
+               ctdb->status.count.req_call++;
                ctdb_request_call(ctdb, hdr);
                break;
 
        case CTDB_REPLY_CALL:
+               ctdb->status.count.reply_call++;
                ctdb_reply_call(ctdb, hdr);
                break;
 
        case CTDB_REPLY_ERROR:
+               ctdb->status.count.reply_error++;
                ctdb_reply_error(ctdb, hdr);
                break;
 
        case CTDB_REPLY_REDIRECT:
+               ctdb->status.count.reply_redirect++;
                ctdb_reply_redirect(ctdb, hdr);
                break;
 
        case CTDB_REQ_DMASTER:
+               ctdb->status.count.req_dmaster++;
                ctdb_request_dmaster(ctdb, hdr);
                break;
 
        case CTDB_REPLY_DMASTER:
+               ctdb->status.count.reply_dmaster++;
                ctdb_reply_dmaster(ctdb, hdr);
                break;
 
        case CTDB_REQ_MESSAGE:
+               ctdb->status.count.req_message++;
                ctdb_request_message(ctdb, hdr);
                break;
 
        case CTDB_REQ_FINISHED:
+               ctdb->status.count.req_finished++;
                ctdb_request_finished(ctdb, hdr);
                break;
 
index 3189a8a31c6ad3955fc13f4c95950a2f2c3f04d8..d2721a0ae525d5547ad7cac3aa945fe7cdcf1ae6 100644 (file)
@@ -443,6 +443,7 @@ static void daemon_incoming_packet(void *p, uint8_t *data, uint32_t nread)
        struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
        struct ctdb_client *client = talloc_get_type(p, struct ctdb_client);
        TALLOC_CTX *tmp_ctx;
+       struct ctdb_context *ctdb = client->ctdb;
 
        /* place the packet as a child of a tmp_ctx. We then use
           talloc_free() below to free it. If any of the calls want
@@ -463,26 +464,32 @@ static void daemon_incoming_packet(void *p, uint8_t *data, uint32_t nread)
 
        switch (hdr->operation) {
        case CTDB_REQ_CALL:
+               ctdb->status.client.req_call++;
                daemon_request_call_from_client(client, (struct ctdb_req_call *)hdr);
                break;
 
        case CTDB_REQ_REGISTER:
+               ctdb->status.client.req_register++;
                daemon_request_register_message_handler(client, 
                                                        (struct ctdb_req_register *)hdr);
                break;
        case CTDB_REQ_MESSAGE:
+               ctdb->status.client.req_message++;
                daemon_request_message_from_client(client, (struct ctdb_req_message *)hdr);
                break;
 
        case CTDB_REQ_CONNECT_WAIT:
+               ctdb->status.client.req_connect_wait++;
                daemon_request_connect_wait(client, (struct ctdb_req_connect_wait *)hdr);
                break;
 
        case CTDB_REQ_SHUTDOWN:
+               ctdb->status.client.req_shutdown++;
                daemon_request_shutdown(client, (struct ctdb_req_shutdown *)hdr);
                break;
 
        case CTDB_REQ_STATUS:
+               ctdb->status.client.req_status++;
                daemon_request_status(client, (struct ctdb_req_status *)hdr);
                break;
 
index 1ed6e3ab8962f5631de6de9476d1404bc8c7c4ce..5381d4924b7f50d63ad8903781f64eded078b91b 100644 (file)
@@ -35,7 +35,7 @@ struct lockwait_handle {
        pid_t child;
        void *private_data;
        void (*callback)(void *);
-       struct timeval t;
+       struct timeval start_time;
 };
 
 static void lockwait_handler(struct event_context *ev, struct fd_event *fde, 
@@ -48,7 +48,7 @@ static void lockwait_handler(struct event_context *ev, struct fd_event *fde,
        pid_t child = h->child;
        talloc_set_destructor(h, NULL);
        close(h->fd[0]);
-       DEBUG(3,(__location__ " lockwait took %.6f seconds\n", timeval_elapsed(&h->t)));
+       ctdb_latency(&h->ctdb->status.max_lockwait_latency, h->start_time);
        h->ctdb->status.pending_lockwait_calls--;
        talloc_free(h); 
        callback(p);
@@ -133,7 +133,7 @@ struct lockwait_handle *ctdb_lockwait(struct ctdb_db_context *ctdb_db,
                return NULL;
        }
 
-       result->t = timeval_current();
+       result->start_time = timeval_current();
 
        return result;
 }
index c46a2c025060b94e99cde739d4fa375aa0037ae0..a8f7b48f49d2bb55715c553b4472ac840df29f05 100644 (file)
@@ -122,6 +122,25 @@ struct ctdb_status {
        uint32_t client_packets_recv;
        uint32_t node_packets_sent;
        uint32_t node_packets_recv;
+       struct {
+               uint32_t req_call;
+               uint32_t reply_call;
+               uint32_t reply_redirect;
+               uint32_t req_dmaster;
+               uint32_t reply_dmaster;
+               uint32_t reply_error;
+               uint32_t req_message;
+               uint32_t req_finished;
+       } count;
+       struct {
+               uint32_t req_call;
+               uint32_t req_message;
+               uint32_t req_finished;
+               uint32_t req_register;
+               uint32_t req_connect_wait;
+               uint32_t req_shutdown;
+               uint32_t req_status;
+       } client;
        uint32_t total_calls;
        uint32_t pending_calls;
        uint32_t lockwait_calls;
index 266fb0a212f74882f3768d4a4f5c6989fba45265..af4c62488d8825278616f9279a1f5e4749efb047 100644 (file)
@@ -33,8 +33,24 @@ static void show_status(struct ctdb_status *s)
 {
        printf(" client_packets_sent     %u\n", s->client_packets_sent);
        printf(" client_packets_recv     %u\n", s->client_packets_recv);
+       printf("   req_call              %u\n", s->client.req_call);
+       printf("   req_message           %u\n", s->client.req_message);
+       printf("   req_finished          %u\n", s->client.req_finished);
+       printf("   req_register          %u\n", s->client.req_register);
+       printf("   req_connect_wait      %u\n", s->client.req_connect_wait);
+       printf("   req_shutdown          %u\n", s->client.req_shutdown);
+       printf("   req_status            %u\n", s->client.req_status);
        printf(" node_packets_sent       %u\n", s->node_packets_sent);
        printf(" node_packets_recv       %u\n", s->node_packets_recv);
+       printf("   req_call              %u\n", s->client.req_call);
+       printf("   reply_call            %u\n", s->count.reply_call);
+       printf("   reply_redirect        %u\n", s->count.reply_redirect);
+       printf("   req_dmaster           %u\n", s->count.req_dmaster);
+       printf("   reply_dmaster         %u\n", s->count.reply_dmaster);
+       printf("   reply_error           %u\n", s->count.reply_error);
+       printf("   reply_redirect        %u\n", s->count.reply_redirect);
+       printf("   req_message           %u\n", s->count.req_message);
+       printf("   req_finished          %u\n", s->count.req_finished);
        printf(" total_calls             %u\n", s->total_calls);
        printf(" pending_calls           %u\n", s->pending_calls);
        printf(" lockwait_calls          %u\n", s->lockwait_calls);