当前位置: 首页>>代码示例>>C++>>正文


C++ dcb_printf函数代码示例

本文整理汇总了C++中dcb_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ dcb_printf函数的具体用法?C++ dcb_printf怎么用?C++ dcb_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dcb_printf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: newSession

/**
 * Associate a new session with this instance of the router.
 *
 * @param instance	The router instance data
 * @param session	The session itself
 * @return Session specific data for this session
 */
static	void	*
newSession(ROUTER *instance, SESSION *session)
{
CLI_INSTANCE	*inst = (CLI_INSTANCE *)instance;
CLI_SESSION	*client;

	if ((client = (CLI_SESSION *)malloc(sizeof(CLI_SESSION))) == NULL)
	{
		return NULL;
	}
	client->session = session;

	memset(client->cmdbuf, 0, 80);

	spinlock_acquire(&inst->lock);
	client->next = inst->sessions;
	inst->sessions = client;
	spinlock_release(&inst->lock);

	session->state = SESSION_STATE_READY;

	dcb_printf(session->client, "Welcome the SkySQL MaxScale Debug Interface (%s).\n",
		version_str);
	dcb_printf(session->client, "WARNING: This interface is meant for developer usage,\n");
	dcb_printf(session->client, "passing incorrect addresses to commands can endanger your MaxScale server.\n\n");
	dcb_printf(session->client, "Type help for a list of available commands.\n\n");

	return (void *)client;
}
开发者ID:huangzhiyong,项目名称:MaxScale,代码行数:36,代码来源:debugcli.c

示例2: monitorShow

/**
 * Show a single monitor
 *
 * @param dcb	DCB for printing output
 */
void
monitorShow(DCB *dcb, MONITOR *monitor)
{

	dcb_printf(dcb, "Monitor: %p\n", monitor);
	dcb_printf(dcb, "\tName:		%s\n", monitor->name);
	if (monitor->module->diagnostics)
		monitor->module->diagnostics(dcb, monitor->handle);
}
开发者ID:balsdorf,项目名称:MaxScale,代码行数:14,代码来源:monitor.c

示例3: dprintAllServices

/**
 * Print all services to a DCB
 *
 * Designed to be called within a debugger session in order
 * to display all active services within the gateway
 */
void
dprintAllServices(DCB *dcb)
{
SERVICE	*ptr;

	spinlock_acquire(&service_spin);
	ptr = allServices;
	while (ptr)
	{
		SERVER	*server = ptr->databases;
		dcb_printf(dcb, "Service %p\n", ptr);
		dcb_printf(dcb, "\tService:		%s\n", ptr->name);
		dcb_printf(dcb, "\tRouter:			%s (%p)\n", ptr->routerModule,
										ptr->router);
		if (ptr->router)
			ptr->router->diagnostics(ptr->router_instance, dcb);
		dcb_printf(dcb, "\tStarted:		%s",
						asctime(localtime(&ptr->stats.started)));
		dcb_printf(dcb, "\tBackend databases\n");
		while (server)
		{
			dcb_printf(dcb, "\t\t%s:%d  Protocol: %s\n", server->name, server->port,
									server->protocol);
			server = server->nextdb;
		}
		dcb_printf(dcb, "\tUsers data:        	%p\n", ptr->users);
		dcb_printf(dcb, "\tTotal connections:	%d\n", ptr->stats.n_sessions);
		dcb_printf(dcb, "\tCurrently connected:	%d\n", ptr->stats.n_current);
		ptr = ptr->next;
	}
	spinlock_release(&service_spin);
}
开发者ID:huangzhiyong,项目名称:MaxScale,代码行数:38,代码来源:service.c

示例4: diagnostic

/**
 * Diagnostics routine
 *
 * If fsession is NULL then print diagnostics on the filter
 * instance as a whole, otherwise print diagnostics for the
 * particular session.
 *
 * @param	instance	The filter instance
 * @param	fsession	Filter session, may be NULL
 * @param	dcb		The DCB for diagnostic output
 */
static	void
diagnostic(FILTER *instance, void *fsession, DCB *dcb)
{
TEST_INSTANCE	*my_instance = (TEST_INSTANCE *)instance;
TEST_SESSION	*my_session = (TEST_SESSION *)fsession;

	if (my_session)
		dcb_printf(dcb, "\t\tNo. of queries routed by filter: %d\n",
			my_session->count);
	else
		dcb_printf(dcb, "\t\tNo. of sessions created: %d\n",
			my_instance->sessions);
}
开发者ID:bigshuai,项目名称:MaxScale,代码行数:24,代码来源:testfilter.c

示例5: dListFilters

/**
 * List all filters in a tabular form to a DCB
 *
 */
void
dListFilters(DCB *dcb)
{
FILTER_DEF	*ptr;
int	i;

	spinlock_acquire(&filter_spin);
	ptr = allFilters;
	if (ptr)
	{
		dcb_printf(dcb, "Filters\n");
		dcb_printf(dcb, "--------------------+-----------------+----------------------------------------\n");
		dcb_printf(dcb, "%-19s | %-15s | Options\n",
			"Filter", "Module");
		dcb_printf(dcb, "--------------------+-----------------+----------------------------------------\n");
	}
	while (ptr)
	{
		dcb_printf(dcb, "%-19s | %-15s | ",
				ptr->name, ptr->module);
		for (i = 0; ptr->options && ptr->options[i]; i++)
			dcb_printf(dcb, "%s ", ptr->options[i]);
		dcb_printf(dcb, "\n");
		ptr = ptr->next;
	}
	if (allFilters)
		dcb_printf(dcb, "--------------------+-----------------+----------------------------------------\n\n");
	spinlock_release(&filter_spin);
}
开发者ID:AAAAAK,项目名称:MaxScale,代码行数:33,代码来源:filter.c

示例6: dprintAllModules

/**
 * Print Modules to a DCB
 *
 * Diagnostic routine to display all the loaded modules
 */
void
dprintAllModules(DCB *dcb)
{
MODULES	*ptr = registered;

	dcb_printf(dcb, "Modules.\n");
	dcb_printf(dcb, "----------------+-------------+---------+-------+-------------------------\n");
	dcb_printf(dcb, "%-15s | %-11s | Version | API   | Status\n", "Module Name", "Module Type");
	dcb_printf(dcb, "----------------+-------------+---------+-------+-------------------------\n");
	while (ptr)
	{
		dcb_printf(dcb, "%-15s | %-11s | %-7s ", ptr->module, ptr->type, ptr->version);
		if (ptr->info)
			dcb_printf(dcb, "| %d.%d.%d | %s",
					ptr->info->api_version.major,
					ptr->info->api_version.minor,
					ptr->info->api_version.patch,
				ptr->info->status == MODULE_IN_DEVELOPMENT
					? "In Development"
				: (ptr->info->status == MODULE_ALPHA_RELEASE
					? "Alpha"
				: (ptr->info->status == MODULE_BETA_RELEASE
					? "Beta"
				: (ptr->info->status == MODULE_GA
					? "GA"
				: (ptr->info->status == MODULE_EXPERIMENTAL
					? "Experimental" : "Unknown")))));
		dcb_printf(dcb, "\n");
		ptr = ptr->next;
	}
	dcb_printf(dcb, "----------------+-------------+---------+-------+-------------------------\n\n");
}
开发者ID:abiratsis,项目名称:MaxScale,代码行数:37,代码来源:load_utils.c

示例7: send_monitors

/**
 * Send the monitors page. This iterates on all the monitors and send
 * the rows via the monitor_monitor.
 *
 * @param session	The router session
 */
static void
send_monitors(WEB_SESSION *session)
{
DCB	*dcb = session->session->client;

	send_html_header(dcb);
	dcb_printf(dcb, "<HTML><HEAD>");
	dcb_printf(dcb, "<LINK REL=\"stylesheet\" type=\"text/css\" href=\"styles.css\">");
	dcb_printf(dcb, "<BODY><H2>Monitors</H2><P>");
	dcb_printf(dcb, "<TABLE><TR><TH>Monitor</TH><TH>State</TH></TR>\n");
	monitorIterate(monitor_row, dcb);
	dcb_printf(dcb, "</TABLE></BODY></HTML>\n");
	dcb_close(dcb);
}
开发者ID:art-spilgames,项目名称:MaxScale,代码行数:20,代码来源:webserver.c

示例8: send_html_header

/**
 * Send the standard HTTP headers for an HTML file
 */
static void
send_html_header(DCB *dcb)
{
char date[64] = "";
const char *fmt = "%a, %d %b %Y %H:%M:%S GMT";

	time_t httpd_current_time = time(NULL);

	strftime(date, sizeof(date), fmt, localtime(&httpd_current_time));

	dcb_printf(dcb, "HTTP/1.1 200 OK\r\nDate: %s\r\nServer: %s\r\nConnection: close\r\nContent-Type: text/html\r\n", date, "MaxScale");

	dcb_printf(dcb, "\r\n");
}
开发者ID:art-spilgames,项目名称:MaxScale,代码行数:17,代码来源:webserver.c

示例9: telnetdAddUser

/**
 * Add a new maxscale admin user
 *
 * @param dcb		The DCB for messages
 * @param user		The user name
 * @param passwd	The Password of the user
 */
static void
telnetdAddUser(DCB *dcb, char *user, char *passwd)
{
char	*err;

	if (admin_search_user(user))
	{
		dcb_printf(dcb, "User %s already exists.\n", user);
		return;
	}
	if ((err = admin_add_user(user, passwd)) == NULL)
		dcb_printf(dcb, "User %s has been successfully added.\n", user);
	else
		dcb_printf(dcb, "Failed to add new user. %s\n", err);
}
开发者ID:MassimilianoPinto,项目名称:MaxScale,代码行数:22,代码来源:debugcmd.c

示例10: diagnostic

/**
 * Diagnostics routine
 *
 * If fsession is NULL then print diagnostics on the filter
 * instance as a whole, otherwise print diagnostics for the
 * particular session.
 *
 * @param   instance    The filter instance
 * @param   fsession    Filter session, may be NULL
 * @param   dcb     The DCB for diagnostic output
 */
static void
diagnostic(FILTER *instance, void *fsession, DCB *dcb)
{
    TOPN_INSTANCE *my_instance = (TOPN_INSTANCE *) instance;
    TOPN_SESSION *my_session = (TOPN_SESSION *) fsession;
    int i;

    dcb_printf(dcb, "\t\tReport size            %d\n",
               my_instance->topN);
    if (my_instance->source)
    {
        dcb_printf(dcb, "\t\tLimit logging to connections from  %s\n",
                   my_instance->source);
    }
    if (my_instance->user)
    {
        dcb_printf(dcb, "\t\tLimit logging to user      %s\n",
                   my_instance->user);
    }
    if (my_instance->match)
    {
        dcb_printf(dcb, "\t\tInclude queries that match     %s\n",
                   my_instance->match);
    }
    if (my_instance->exclude)
    {
        dcb_printf(dcb, "\t\tExclude queries that match     %s\n",
                   my_instance->exclude);
    }
    if (my_session)
    {
        dcb_printf(dcb, "\t\tLogging to file %s.\n",
                   my_session->filename);
        dcb_printf(dcb, "\t\tCurrent Top %d:\n", my_instance->topN);
        for (i = 0; i < my_instance->topN; i++)
        {
            if (my_session->top[i]->sql)
            {
                dcb_printf(dcb, "\t\t%d place:\n", i + 1);
                dcb_printf(dcb, "\t\t\tExecution time: %.3f seconds\n",
                           (double) ((my_session->top[i]->duration.tv_sec * 1000)
                                     + (my_session->top[i]->duration.tv_usec / 1000)) / 1000);
                dcb_printf(dcb, "\t\t\tSQL: %s\n",
                           my_session->top[i]->sql);
            }
        }
    }
}
开发者ID:DBMSRmutl,项目名称:MaxScale,代码行数:59,代码来源:topfilter.c

示例11: monitor_row

/**
 * Print a table row for the monitors table
 *
 * @param monitor	The monitor to print
 * @param dcb		The DCB to print to
 */
static void
monitor_row(MONITOR *monitor, DCB *dcb)
{
	dcb_printf(dcb, "<TR><TD>%s</TD><TD>%s</TD></TR>\n",
		monitor->name, monitor->state & MONITOR_STATE_RUNNING
			? "Running" : "Stopped");
}
开发者ID:art-spilgames,项目名称:MaxScale,代码行数:13,代码来源:webserver.c

示例12: server_row

/**
 * Display a table row for a particular server. This is called via the
 * serverIterate call in send_servers.
 *
 * @param server	The server to print
 * @param dcb		The DCB to send the HTML to
 */
static void
server_row(SERVER *server, DCB *dcb)
{
	dcb_printf(dcb, "<TR><TD>%s</TD><TD>%s</TD><TD>%d</TD><TD>%s</TD><TD>%d</TD></TR>\n",
		server->unique_name, server->name, server->port,
		server_status(server), server->stats.n_current);
}
开发者ID:art-spilgames,项目名称:MaxScale,代码行数:14,代码来源:webserver.c

示例13: service_row

/**
 * Write a table row for a service. This is called using the service
 * iterator function
 *
 * @param service	The service to display
 * @param dcb		The DCB to print the HTML to
 */
static void
service_row(SERVICE *service, DCB *dcb)
{
	dcb_printf(dcb, "<TR><TD>%s</TD><TD>%s</TD><TD>%d</TD><TD>%d</TD></TR>\n",
		service->name, service->routerModule,
		service->stats.n_current, service->stats.n_sessions);
}
开发者ID:art-spilgames,项目名称:MaxScale,代码行数:14,代码来源:webserver.c

示例14: fail_accept

static void fail_accept(
        DCB*  dcb,
        char* arg1,
        char* arg2)
{
        int failcount = MIN(atoi(arg2), 100);
        fail_accept_errno = atoi(arg1);


        switch(fail_accept_errno) {
                case EAGAIN:
//                case EWOULDBLOCK:
                case EBADF:
                case EINTR:
                case EINVAL:
                case EMFILE:
                case ENFILE:
                case ENOTSOCK:
                case EOPNOTSUPP:
                case ENOBUFS:
                case ENOMEM:
                case EPROTO:
                        fail_next_accept = failcount;
        break;

                default:
                        dcb_printf(dcb,
                                   "[%d, %s] is not valid errno for accept.\n",
                                   fail_accept_errno,
                                   strerror(fail_accept_errno));
                return ;
        }
}
开发者ID:MassimilianoPinto,项目名称:MaxScale,代码行数:33,代码来源:debugcmd.c

示例15: monitorShowAll

/**
 * Show all monitors
 *
 * @param dcb	DCB for printing output
 */
void
monitorShowAll(DCB *dcb)
{
MONITOR	*ptr;

	spinlock_acquire(&monLock);
	ptr = allMonitors;
	while (ptr)
	{
		dcb_printf(dcb, "Monitor: %p\n", ptr);
		dcb_printf(dcb, "\tName:		%s\n", ptr->name);
		if (ptr->module->diagnostics)
			ptr->module->diagnostics(dcb, ptr->handle);
		ptr = ptr->next;
	}
	spinlock_release(&monLock);
}
开发者ID:balsdorf,项目名称:MaxScale,代码行数:22,代码来源:monitor.c


注:本文中的dcb_printf函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。