Move code around to fix headers problem etc.
This commit is contained in:
@ -1414,12 +1414,61 @@ DCB *dcb;
|
||||
spinlock_release(&dcbspin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic to print one DCB in the system
|
||||
*
|
||||
* @param pdcb DCB to print results to
|
||||
* @param dcb DCB to be printed
|
||||
*/
|
||||
void
|
||||
dprintOneDCB(DCB *pdcb, DCB *dcb)
|
||||
{
|
||||
DCB *dcb;
|
||||
|
||||
dcb_printf(pdcb, "DCB: %p\n", (void *)dcb);
|
||||
dcb_printf(pdcb, "\tDCB state: %s\n",
|
||||
gw_dcb_state2string(dcb->state));
|
||||
if (dcb->session && dcb->session->service)
|
||||
dcb_printf(pdcb, "\tService: %s\n",
|
||||
dcb->session->service->name);
|
||||
if (dcb->remote)
|
||||
dcb_printf(pdcb, "\tConnected to: %s\n",
|
||||
dcb->remote);
|
||||
if (dcb->user)
|
||||
dcb_printf(pdcb, "\tUsername: %s\n",
|
||||
dcb->user);
|
||||
if (dcb->writeq)
|
||||
dcb_printf(pdcb, "\tQueued write data: %d\n",
|
||||
gwbuf_length(dcb->writeq));
|
||||
char *statusname = server_status(dcb->server);
|
||||
if (statusname)
|
||||
{
|
||||
dcb_printf(pdcb, "\tServer status: %s\n", statusname);
|
||||
free(statusname);
|
||||
}
|
||||
char *rolename = dcb_role_name(dcb);
|
||||
if (rolename)
|
||||
{
|
||||
dcb_printf(pdcb, "\tRole: %s\n", rolename);
|
||||
free(rolename);
|
||||
}
|
||||
dcb_printf(pdcb, "\tStatistics:\n");
|
||||
dcb_printf(pdcb, "\t\tNo. of Reads: %d\n", dcb->stats.n_reads);
|
||||
dcb_printf(pdcb, "\t\tNo. of Writes: %d\n", dcb->stats.n_writes);
|
||||
dcb_printf(pdcb, "\t\tNo. of Buffered Writes: %d\n", dcb->stats.n_buffered);
|
||||
dcb_printf(pdcb, "\t\tNo. of Accepts: %d\n", dcb->stats.n_accepts);
|
||||
dcb_printf(pdcb, "\t\tNo. of High Water Events: %d\n", dcb->stats.n_high_water);
|
||||
dcb_printf(pdcb, "\t\tNo. of Low Water Events: %d\n", dcb->stats.n_low_water);
|
||||
if (dcb->flags & DCBF_CLONE)
|
||||
dcb_printf(pdcb, "\t\tDCB is a clone.\n");
|
||||
}
|
||||
/**
|
||||
* Diagnostic to print all DCB allocated in the system
|
||||
*
|
||||
* @param pdcb DCB to print results to
|
||||
*/
|
||||
void dprintAllDCBs(DCB *pdcb)
|
||||
void
|
||||
dprintAllDCBs(DCB *pdcb)
|
||||
{
|
||||
DCB *dcb;
|
||||
|
||||
@ -1433,108 +1482,12 @@ DCB *dcb;
|
||||
dcb = allDCBs;
|
||||
while (dcb)
|
||||
{
|
||||
dcb_printf(pdcb, "DCB: %p\n", (void *)dcb);
|
||||
dcb_printf(pdcb, "\tDCB state: %s\n",
|
||||
gw_dcb_state2string(dcb->state));
|
||||
if (dcb->session && dcb->session->service)
|
||||
dcb_printf(pdcb, "\tService: %s\n",
|
||||
dcb->session->service->name);
|
||||
if (dcb->remote)
|
||||
dcb_printf(pdcb, "\tConnected to: %s\n",
|
||||
dcb->remote);
|
||||
if (dcb->user)
|
||||
dcb_printf(pdcb, "\tUsername: %s\n",
|
||||
dcb->user);
|
||||
if (dcb->writeq)
|
||||
dcb_printf(pdcb, "\tQueued write data: %d\n",
|
||||
gwbuf_length(dcb->writeq));
|
||||
char *statusname = server_status(dcb->server);
|
||||
if (statusname)
|
||||
{
|
||||
dcb_printf(pdcb, "\tServer status: %s\n", statusname);
|
||||
free(statusname);
|
||||
}
|
||||
char *rolename = dcb_role_name(dcb);
|
||||
if (rolename)
|
||||
{
|
||||
dcb_printf(pdcb, "\tRole: %s\n", rolename);
|
||||
free(rolename);
|
||||
}
|
||||
dcb_printf(pdcb, "\tStatistics:\n");
|
||||
dcb_printf(pdcb, "\t\tNo. of Reads: %d\n", dcb->stats.n_reads);
|
||||
dcb_printf(pdcb, "\t\tNo. of Writes: %d\n", dcb->stats.n_writes);
|
||||
dcb_printf(pdcb, "\t\tNo. of Buffered Writes: %d\n", dcb->stats.n_buffered);
|
||||
dcb_printf(pdcb, "\t\tNo. of Accepts: %d\n", dcb->stats.n_accepts);
|
||||
dcb_printf(pdcb, "\t\tNo. of High Water Events: %d\n", dcb->stats.n_high_water);
|
||||
dcb_printf(pdcb, "\t\tNo. of Low Water Events: %d\n", dcb->stats.n_low_water);
|
||||
if (dcb->flags & DCBF_CLONE)
|
||||
dcb_printf(pdcb, "\t\tDCB is a clone.\n");
|
||||
dcb = dcb->next;
|
||||
dprintOneDCB(pdcb, dcb);
|
||||
dcb = dcb->next;
|
||||
}
|
||||
spinlock_release(&dcbspin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic to print all DCBs in persistent pool for a server
|
||||
*
|
||||
* @param pdcb DCB to print results to
|
||||
* @param server SERVER for which DCBs are to be printed
|
||||
*/
|
||||
void dprintPersistentDCBs(DCB *pdcb, SERVER *server)
|
||||
{
|
||||
DCB *dcb;
|
||||
|
||||
spinlock_acquire(&server->persistlock);
|
||||
#if SPINLOCK_PROFILE
|
||||
dcb_printf(pdcb, "DCB List Spinlock Statistics:\n");
|
||||
spinlock_stats(&dcbspin, spin_reporter, pdcb);
|
||||
dcb_printf(pdcb, "Zombie Queue Lock Statistics:\n");
|
||||
spinlock_stats(&zombiespin, spin_reporter, pdcb);
|
||||
#endif
|
||||
dcb = server->persistent;
|
||||
while (dcb)
|
||||
{
|
||||
dcb_printf(pdcb, "DCB: %p\n", (void *)dcb);
|
||||
dcb_printf(pdcb, "\tDCB state: %s\n",
|
||||
gw_dcb_state2string(dcb->state));
|
||||
if (dcb->session && dcb->session->service)
|
||||
dcb_printf(pdcb, "\tService: %s\n",
|
||||
dcb->session->service->name);
|
||||
if (dcb->remote)
|
||||
dcb_printf(pdcb, "\tConnected to: %s\n",
|
||||
dcb->remote);
|
||||
if (dcb->user)
|
||||
dcb_printf(pdcb, "\tUsername: %s\n",
|
||||
dcb->user);
|
||||
if (dcb->writeq)
|
||||
dcb_printf(pdcb, "\tQueued write data: %d\n",
|
||||
gwbuf_length(dcb->writeq));
|
||||
char *statusname = server_status(dcb->server);
|
||||
if (statusname)
|
||||
{
|
||||
dcb_printf(pdcb, "\tServer status: %s\n", statusname);
|
||||
free(statusname);
|
||||
}
|
||||
char *rolename = dcb_role_name(dcb);
|
||||
if (rolename)
|
||||
{
|
||||
dcb_printf(pdcb, "\tRole: %s\n", rolename);
|
||||
free(rolename);
|
||||
}
|
||||
dcb_printf(pdcb, "\tStatistics:\n");
|
||||
dcb_printf(pdcb, "\t\tNo. of Reads: %d\n", dcb->stats.n_reads);
|
||||
dcb_printf(pdcb, "\t\tNo. of Writes: %d\n", dcb->stats.n_writes);
|
||||
dcb_printf(pdcb, "\t\tNo. of Buffered Writes: %d\n", dcb->stats.n_buffered);
|
||||
dcb_printf(pdcb, "\t\tNo. of Accepts: %d\n", dcb->stats.n_accepts);
|
||||
dcb_printf(pdcb, "\t\tNo. of High Water Events: %d\n", dcb->stats.n_high_water);
|
||||
dcb_printf(pdcb, "\t\tNo. of Low Water Events: %d\n", dcb->stats.n_low_water);
|
||||
if (dcb->flags & DCBF_CLONE)
|
||||
dcb_printf(pdcb, "\t\tDCB is a clone.\n");
|
||||
dcb = dcb->nextpersistent;
|
||||
}
|
||||
spinlock_release(&server->persistlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnotic routine to print DCB data in a tabular form.
|
||||
*
|
||||
|
@ -500,6 +500,31 @@ SERVER_PARAM *param;
|
||||
dcb_printf(dcb, "\tCurrent no. of operations: %d\n", server->stats.n_current_ops);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diagnostic to print all DCBs in persistent pool for a server
|
||||
*
|
||||
* @param pdcb DCB to print results to
|
||||
* @param server SERVER for which DCBs are to be printed
|
||||
*/
|
||||
void
|
||||
dprintPersistentDCBs(DCB *pdcb, SERVER *server)
|
||||
{
|
||||
DCB *dcb;
|
||||
|
||||
spinlock_acquire(&server->persistlock);
|
||||
#if SPINLOCK_PROFILE
|
||||
dcb_printf(pdcb, "DCB List Spinlock Statistics:\n");
|
||||
spinlock_stats(&server->persistlock, spin_reporter, pdcb);
|
||||
#endif
|
||||
dcb = server->persistent;
|
||||
while (dcb)
|
||||
{
|
||||
dprintOneDCB(pdcb, dcb);
|
||||
dcb = dcb->nextpersistent;
|
||||
}
|
||||
spinlock_release(&server->persistlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all servers in a tabular form to a DCB
|
||||
*
|
||||
|
@ -19,6 +19,7 @@
|
||||
*/
|
||||
#include <spinlock.h>
|
||||
#include <buffer.h>
|
||||
#include <server.h>
|
||||
#include <modinfo.h>
|
||||
#include <gwbitmask.h>
|
||||
#include <skygw_utils.h>
|
||||
@ -320,6 +321,7 @@ DCB *dcb_process_zombies(int); /* Process Zombies except the one behind the po
|
||||
void printAllDCBs(); /* Debug to print all DCB in the system */
|
||||
void printDCB(DCB *); /* Debug print routine */
|
||||
void dprintAllDCBs(DCB *); /* Debug to print all DCB in the system */
|
||||
void dprintOneDCB(DCB *, DCB *); /* Debug to print one DCB */
|
||||
void dprintDCB(DCB *, DCB *); /* Debug to print a DCB in the system */
|
||||
void dListDCBs(DCB *); /* List all DCBs in the system */
|
||||
void dListClients(DCB *); /* List al the client DCBs */
|
||||
|
@ -183,6 +183,7 @@ extern void printAllServers();
|
||||
extern void dprintAllServers(DCB *);
|
||||
extern void dprintAllServersJson(DCB *);
|
||||
extern void dprintServer(DCB *, SERVER *);
|
||||
extern void dprintPersistentDCBs(DCB *, SERVER *)
|
||||
extern void dListServers(DCB *);
|
||||
extern char *server_status(SERVER *);
|
||||
extern void server_set_status(SERVER *, int);
|
||||
|
Reference in New Issue
Block a user