主要是对所占内存的设置,执行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");
}