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