• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dcb_printf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: dprintFilter

/**
 * Print filter details to a DCB
 *
 * Designed to be called within a debug CLI in order
 * to display all active filters in MaxScale
 */
void
dprintFilter(DCB *dcb, FILTER_DEF *filter)
{
int	i;

	dcb_printf(dcb, "Filter %p (%s)\n", filter, filter->name);
	dcb_printf(dcb, "\tModule:	%s\n", filter->module);
	if (filter->options)
	{
		dcb_printf(dcb, "\tOptions:	");
		for (i = 0; filter->options && filter->options[i]; i++)
			dcb_printf(dcb, "%s ", filter->options[i]);
		dcb_printf(dcb, "\n");
	}
	if (filter->obj && filter->filter)
		filter->obj->diagnostics(filter->filter, NULL, dcb);
}
开发者ID:AAAAAK,项目名称:MaxScale,代码行数:23,代码来源:filter.c


示例17: dcb_PrintAdminUsers

/**
 * Print the statistics and user names of the administration users
 *
 * @param dcb	A DCB to send the output to
 */
void
dcb_PrintAdminUsers(DCB *dcb)
{
	if (users)
		dcb_usersPrint(dcb, users);
	else
		dcb_printf(dcb, "No administration users have been defined.\n");
}
开发者ID:littleyang,项目名称:MaxScale,代码行数:13,代码来源:adminusers.c


示例18: diagnostics

/**
 * Diagnostic interface
 *
 * @param dcb	DCB to send output
 * @param arg	The monitor handle
 */
static void
diagnostics(DCB *dcb, void *arg)
{
MYSQL_MONITOR   *handle = (MYSQL_MONITOR *)arg;
MONITOR_SERVERS	*db;
char		*sep;

	switch (handle->status)
	{
	case MONITOR_RUNNING:
		dcb_printf(dcb, "\tMonitor running\n");
		break;
	case MONITOR_STOPPING:
		dcb_printf(dcb, "\tMonitor stopping\n");
		break;
	case MONITOR_STOPPED:
		dcb_printf(dcb, "\tMonitor stopped\n");
		break;
	}

	dcb_printf(dcb,"\tSampling interval:\t%lu milliseconds\n", handle->interval);
	dcb_printf(dcb, "\tMonitored servers:	");

	db = handle->databases;
	sep = "";
	while (db)
	{
		dcb_printf(dcb, "%s%s:%d", sep, db->server->name, db->server->port);
		sep = ", ";
		db = db->next;
	}
	dcb_printf(dcb, "\n");
}
开发者ID:markus456,项目名称:MaxScale,代码行数:39,代码来源:ndbcluster_mon.c


示例19: 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)
{
TEE_INSTANCE	*my_instance = (TEE_INSTANCE *)instance;
TEE_SESSION	*my_session = (TEE_SESSION *)fsession;

	if (my_instance->source)
		dcb_printf(dcb, "\t\tLimit to connections from 		%s\n",
				my_instance->source);
	dcb_printf(dcb, "\t\tDuplicate statements to service		%s\n",
				my_instance->service->name);
	if (my_instance->userName)
		dcb_printf(dcb, "\t\tLimit to user			%s\n",
				my_instance->userName);
	if (my_instance->match)
		dcb_printf(dcb, "\t\tInclude queries that match		%s\n",
				my_instance->match);
	if (my_instance->nomatch)
		dcb_printf(dcb, "\t\tExclude queries that match		%s\n",
				my_instance->nomatch);
	if (my_session)
	{
		dcb_printf(dcb, "\t\tNo. of statements duplicated:	%d.\n",
			my_session->n_duped);
		dcb_printf(dcb, "\t\tNo. of statements rejected:	%d.\n",
			my_session->n_rejected);
	}
}
开发者ID:jhnwkmn,项目名称:MaxScale,代码行数:39,代码来源:tee.c


示例20: dprintSession

/**
 * Print a particular session to a DCB
 *
 * Designed to be called within a debugger session in order
 * to display all active sessions within the gateway
 *
 * @param dcb	The DCB to print to
 * @param ptr	The session to print
 */
void
dprintSession(DCB *dcb, SESSION *ptr)
{
int	i;

	dcb_printf(dcb, "Session %p\n", ptr);
	dcb_printf(dcb, "\tState:    		%s\n", session_state(ptr->state));
	dcb_printf(dcb, "\tService:		%s (%p)\n", ptr->service->name, ptr->service);
	dcb_printf(dcb, "\tClient DCB:		%p\n", ptr->client);
	if (ptr->client && ptr->client->remote)
		dcb_printf(dcb, "\tClient Address:		%s\n", ptr->client->remote);
	dcb_printf(dcb, "\tConnected:		%s", asctime(localtime(&ptr->stats.connect)));
	if (ptr->n_filters)
	{
		for (i = 0; i < ptr->n_filters; i++)
		{
			dcb_printf(dcb, "\tFilter: %s\n",
					ptr->filters[i].filter->name);
			ptr->filters[i].filter->obj->diagnostics(
					ptr->filters[i].instance,
					ptr->filters[i].session,
					dcb);
		}
	}
}
开发者ID:abiratsis,项目名称:MaxScale,代码行数:34,代码来源:session.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dccp_hdr函数代码示例发布时间:2022-05-30
下一篇:
C++ dcassert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap