2014_03_20周四工作日志:不错的调试代码1

主要是对所占内存的设置,执行1000次,看看是所占的内存大小为多少。
void main()
{
	char cGet='\n';
	do 
	{
		if (cGet=='\n')
		{
			printf("\n");
			printf("Robert:MultiThreadTest>>Please Select>>\n");
			printf("1:\tSingle Thread Runs Task 6 Times\n");
			printf("2:\tEach Thread Runs Task 1 Times Using 6 Threads\n");
			printf("3:\tExit\n");
		}
		
		cGet=getchar();
		if(cGet=='1')
		{
			TestSingleThread();
			continue;
		}
		else if(cGet=='2')
		{
			TestMultiThread();
			continue;
		}
		else if(cGet=='3')
		{
			break;
		}
		else
		{
			continue;
		}

	} while(TRUE);
	
	return;
}

运用到实际:

void maintest()//将原来的main改为
{
	CHttpClient client;
	string url="http://192.168.0.116/lanyun/?option=ajax2&a=plan_result&type=1&nologin=1";//
	string post="type=3&mac=10:00:00:00:00:00&name=111";
	string psend;
	client.SetDebug(FALSE);
	int a=client.Post(url,post,psend);
	printf("结果是:%s\n\n",psend.c_str());
	return;
}

void main()
{
	char cGet='\n';
	do 
	{
		if (cGet=='\n')
		{
			printf("\n\n");
			printf("Robert:>>Please Select>>\n");
			printf("1:\tmaintest\n");
			printf("2:\tmaintest\n");
			printf("3:\tExit\n\n");
		}
		
		cGet=getchar();
		if(cGet=='1')
		{
			for(int i=0;i<1000;i++)
			{
				maintest();
			}
			continue;
		}
		else if(cGet=='2')
		{
			for(int j=0;j<1000;j++)
			{
				maintest();
			}
			continue;
		}
		else if(cGet=='3')
		{
			break;
		}
		else
		{
			continue;
		}
		
	} while(TRUE);
	
	return;
}

运用到实际;
void main()
{

	char cGet='\n';
	do 
	{
		if (cGet=='\n')
		{
			printf("\n\n");
			printf("Robert:>>Please Select>>\n");
			printf("1:\tmaintest\n");
			printf("2:\tmaintest\n");
			printf("3:\tExit\n\n");
		}
		
		cGet=getchar();
		if(cGet=='1')
		{
			for(int i=0;i<1000;i++)
			{
				maintest("192.168.0.116","1","1","type=3&mac=10:00:00:00:00:00&name=111");
			}
			continue;
		}
		else if(cGet=='2')
		{
			for(int j=0;j<1000;j++)
			{
				maintest("192.168.0.116","1","1","type=3&mac=10:00:00:00:00:00&name=111");
			}
			continue;
		}
		else if(cGet=='3')
		{
			break;
		}
		else
		{
			continue;
		}
		
	} while(TRUE);
	
	return;
	//maintest("192.168.0.116","1","1","type=3&mac=10:00:00:00:00:00&name=111");
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值