latency is measured in us, not ms
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 30 Oct 2008 02:34:10 +0000 (13:34 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 30 Oct 2008 02:34:10 +0000 (13:34 +1100)
use an explicit ctdb_db variable instead of dereferencing state

common/ctdb_util.c
server/ctdb_daemon.c

index efa8969fb973961bdef49f76629d2fe906ff3d41..b5a3508eb6fb8f61dd769a032f5b52f820e97daf 100644 (file)
@@ -132,8 +132,8 @@ void ctdb_latency(struct ctdb_db_context *ctdb_db, const char *name, double *lat
        }
 
        if (ctdb_db->ctdb->tunable.log_latency_ms !=0) {
-               if (l > ctdb_db->ctdb->tunable.log_latency_ms) {
-                       DEBUG(DEBUG_WARNING, ("High latency %f for operation %s on database %s\n", l, name, ctdb_db->db_name));
+               if (l*1000 > ctdb_db->ctdb->tunable.log_latency_ms) {
+                       DEBUG(DEBUG_WARNING, ("High latency %fs for operation %s on database %s\n", l*1000000, name, ctdb_db->db_name));
                }
        }
 }
index 774efebc9493d10ef57dfdd404bbae26e368b9a6..b8684124b0bd7b3f62ce16cff7474043a82e6a9b 100644 (file)
@@ -269,6 +269,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
        int res;
        uint32_t length;
        struct ctdb_client *client = dstate->client;
+       struct ctdb_db_context = state->ctdb_db;
 
        talloc_steal(client, dstate);
        talloc_steal(dstate, dstate->call);
@@ -277,7 +278,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
        if (res != 0) {
                DEBUG(DEBUG_ERR, (__location__ " ctdbd_call_recv() returned error\n"));
                client->ctdb->statistics.pending_calls--;
-               ctdb_latency(state->ctdb_db, "call_from_client_cb 1", &client->ctdb->statistics.max_call_latency, dstate->start_time);
+               ctdb_latency(ctdb_db, "call_from_client_cb 1", &client->ctdb->statistics.max_call_latency, dstate->start_time);
                return;
        }
 
@@ -287,7 +288,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
        if (r == NULL) {
                DEBUG(DEBUG_ERR, (__location__ " Failed to allocate reply_call in ctdb daemon\n"));
                client->ctdb->statistics.pending_calls--;
-               ctdb_latency(state->ctdb_db, "call_from_client_cb 2", &client->ctdb->statistics.max_call_latency, dstate->start_time);
+               ctdb_latency(ctdb_db, "call_from_client_cb 2", &client->ctdb->statistics.max_call_latency, dstate->start_time);
                return;
        }
        r->hdr.reqid        = dstate->reqid;
@@ -298,7 +299,7 @@ static void daemon_call_from_client_callback(struct ctdb_call_state *state)
        if (res != 0) {
                DEBUG(DEBUG_ERR, (__location__ " Failed to queue packet from daemon to client\n"));
        }
-       ctdb_latency(state->ctdb_db, "call_from_client_cb 3", &client->ctdb->statistics.max_call_latency, dstate->start_time);
+       ctdb_latency(ctdb_db, "call_from_client_cb 3", &client->ctdb->statistics.max_call_latency, dstate->start_time);
        talloc_free(dstate);
        client->ctdb->statistics.pending_calls--;
 }