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


C++ TestWindow::TestMsg方法代码示例

本文整理汇总了C++中TestWindow::TestMsg方法的典型用法代码示例。如果您正苦于以下问题:C++ TestWindow::TestMsg方法的具体用法?C++ TestWindow::TestMsg怎么用?C++ TestWindow::TestMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestWindow的用法示例。


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

示例1: watch

TestApplication::TestApplication()
	: BApplication("application/x-vnd.ARP-layoutest")
{
	TestWindow		*aWindow;

	// Instantiate the test window, and make it visible.	
	aWindow = new TestWindow(this);
	aWindow->Show();
	
	fflush(stdout);
	fflush(stderr);
	
	{
		DB(DBALL,cdb << "Testing messages..." << endl);
		BMessage testMsg;
		status_t res = testMsg.AddInt32("A param...",65);
		DB(DBALL,cdb << "Added an int32; result=" << res << endl);
		res = testMsg.AddFloat("A param...",103.4);
		DB(DBALL,cdb << "Added a float; result=" << res << endl);
		DB(DBALL,cdb << "Final message = " << testMsg << endl);
		DB(DBALL,cdb.flush());
	}
	
	{
		BStopWatch watch("FuncCall StopWatch");
		watch.Reset();
	
		printf("Testing virtual function calls...\n");
		int64 i;
		watch.Resume();
		const int fcount = 10000000;
		for( i=0; i<fcount; i++ ) {
			aWindow->TestFunc("a string",23);
		}
		watch.Suspend();
	
		bigtime_t el = watch.ElapsedTime();
		printf("Operations per second: %f\n",
			(((float)fcount)*1000000.0)/(float)el);
	}

	{
		BStopWatch watch("BMessage StopWatch");
		watch.Reset();
	
		printf("Testing BMessage invocation...\n");
		int64 i;
		watch.Resume();
		const int fcount = 10000000;
		for( i=0; i<fcount; i++ ) {
			BMessage testMsg;
			aWindow->TestMsg(testMsg);
		}
		watch.Suspend();
	
		bigtime_t el = watch.ElapsedTime();
		printf("Operations per second: %f\n",
			(((float)fcount)*1000000.0)/(float)el);
	}

	{
		BStopWatch watch("BMessage init StopWatch");
		watch.Reset();
	
		printf("Testing BMessage initialization...\n");
		int64 i;
		watch.Resume();
		const int fcount = 10000;
		for( i=0; i<fcount; i++ ) {
			BMessage testMsg;
			testMsg.AddInt32("A param...",65);
			aWindow->TestMsg(testMsg);
		}
		watch.Suspend();
	
		bigtime_t el = watch.ElapsedTime();
		printf("Operations per second: %f\n",
			(((float)fcount)*1000000.0)/(float)el);
	}
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:80,代码来源:Profile.cpp


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