int main(int argc, char *argv[]) { Fg_Struct *fg; int w,h; double e; for(e = MIN_EXP; e <= MAX_EXP; e *= 10) { for(w = MIN_WIDTH; w <= MAX_WIDTH; w += 4) { for(h = MIN_HEIGHT; h <= MAX_HEIGHT; h++) { if(open_cam(&fg, ASYNC_SOFTWARE_TRIGGER, NUM_IMGS, w, h) == FG_OK) { method2(fg, NUM_IMGS, w, h, e, e); close_cam(fg); } } } } /* if(open_cam(&fg, GRABBER_CONTROLLED, NUM_IMGS, w, h) == FG_OK) { method1(fg, NUM_IMGS, w, h, EXPOSURE, EXPOSURE); close_cam(fg); } */ /* if(open_cam(&fg, GRABBER_CONTROLLED, NUM_IMGS, WIDTH, HEIGHT) == FG_OK) { method3(fg, NUM_IMGS, WIDTH, HEIGHT, EXPOSURE, FRAME_TIME); close_cam(fg); } */ return FG_OK; }
int main() { method1(); method2(); method3(); method4(); method5(); // On some platforms std::locale::classic() works // faster than std::locale() boost::iequals(str1, str2, std::locale::classic()); }
void test_dispatcher() { RefCountedPtr<SysContext> ctx(new SysContext); RefCountedPtr<iSysComponent> cpt( new StdLogger( StdLogger::LOGC_DEBUG) ); ctx->addComponent( cpt ); // create the interfaces RefCountedPtr<RpcInterface> intf( new RpcInterface( NTEXT("interface"), ctx )); RefCountedPtr<RpcInterface> intf1( new RpcInterface( NTEXT("interface"), ctx )); RefCountedPtr<RpcInterface> intf2( new RpcInterface( NTEXT("interface"), ctx )); // create the methods RefCountedPtr<Object1Method1> method( new Object1Method1(NTEXT("method"), NTEXT("default")) ); intf->addMethod( (RefCountedPtr<iRpcMethod>&)method ); RefCountedPtr<Object1Method1> method1( new Object1Method1(NTEXT("method"), NTEXT("apache")) ); intf1->addMethod( (RefCountedPtr<iRpcMethod>&)method1 ); RefCountedPtr<Object1Method1> method2( new Object1Method1(NTEXT("method"), NTEXT("cslib")) ); intf2->addMethod( (RefCountedPtr<iRpcMethod>&)method2 ); RpcDispatcher disp( NTEXT("test-dispatcher"), ctx ); disp.addInterface( intf ); disp.addInterface( intf1, APACHE_TENANT ); disp.addInterface( intf2, CSLIB_TENANT ); DOMDocument* requestDoc = DomUtils::getDocument( NTEXT("rpc_dispatcher.xml") ); if (requestDoc != NULL) { StreamFormatTarget targ(COUT); DOMDocument* responseDoc = DomUtils::createDocument( NTEXT("default") ); if (responseDoc != NULL) { disp.dispatch( requestDoc, responseDoc ); disp.dispatch( requestDoc, responseDoc, APACHE_TENANT ); disp.dispatch( requestDoc, responseDoc, CSLIB_TENANT ); disp.dispatch( requestDoc, responseDoc, INVALID_TENANT ); DomUtils::print( responseDoc, NTEXT("UTF-8"), targ ); responseDoc->release(); } requestDoc->release(); } }
void FakeClassForNode::activeFunction(int id) { switch(id) { case 0: method1(); break; case 1: method2(0); break; case 2: method3(0,0); break; } }
int main(int argc, char **argv) { QCoreApplication app(argc, argv); if (!QDBusConnection::sessionBus().isConnected()) { fprintf(stderr, "Cannot connect to the D-Bus session bus.\n" "To start it, run:\n" "\teval `dbus-launch --auto-syntax`\n"); return 1; } method1(); method2(); method3(); return 0; }
// defining and selecting our external user client methods IOReturn SamplePCIUserClientClassName::externalMethod( uint32_t selector, IOExternalMethodArguments* arguments, IOExternalMethodDispatch * dispatch, OSObject * target, void * reference ) { IOReturn result; if (fDriver == NULL || isInactive()) { // Return an error if we don't have a provider. This could happen if the user process // called either method without calling IOServiceOpen first. Or, the user client could be // in the process of being terminated and is thus inactive. result = kIOReturnNotAttached; } else if (!fDriver->isOpen(this)) { // Return an error if we do not have the driver open. This could happen if the user process // did not call openUserClient before calling this function. result = kIOReturnNotOpen; } IOReturn err; IOLog("The Leopard and later way to route external methods\n"); switch (selector) { case kSampleMethod1: err = method1( (UInt32 *) arguments->structureInput, (UInt32 *) arguments->structureOutput, arguments->structureInputSize, (IOByteCount *) &arguments->structureOutputSize ); break; case kSampleMethod2: err = method2( (SampleStructForMethod2 *) arguments->structureInput, (SampleResultsForMethod2 *) arguments->structureOutput, arguments->structureInputSize, (IOByteCount *) &arguments->structureOutputSize ); break; default: err = kIOReturnBadArgument; break; } IOLog("externalMethod(%d) 0x%x", selector, err); return (err); }
int main(void){ static int val1=1; int i=0; for(i=0;i<5;i++){ method0(); method1(); } printf("main:val2=%d\n", val2); /* a=1 always b=1,2,3,4,5 */ method2(); //method3(); method3 is defined as static in method1.c return 1; }
void method3() const { Foo foo; int I=0; Bar bar; foo.func1(i_); foo.func1(ci_); foo.func1(ir_); foo.func1(icr_); foo.func1(I); foo.func2(ir_); foo.func2(I); foo.func6(i_); foo.func6(ir_); foo.func6(I); foo_.nonConstRefAccess(); foo_.constRefAccess(); // foo_.nonConstFunc(); foo_.nonConstAccess(); foo_.constAccess(); if (i_) method2(i_); bar.produce(); // will produce a warning only by ConstCastAwayChecker int & ir = (int &) (icr_); int & cir = const_cast<int &>(icr_); int * ip = (int *) (icp_); int * cip = const_cast<int *>(icp_); // must not produce a warning int const& ira = (int const&)(icr_); // will produce a warning by StaticLocalChecker static int evilStaticLocal = 0; static int & intRef = evilStaticLocal; static int * intPtr = & evilStaticLocal; // no warnings here static const int c_evilStaticLocal = 0; static int const& c_intRef = evilStaticLocal; static int const* c_intPtr = &evilStaticLocal; static const int * c_intPtr_equivalent = &evilStaticLocal; static int const* const* c_intPtrPtr = &( c_intPtr); g_static=23; si_=23; modifyStatic(I); }
int main(void) { method2(); return 0; }
int main(int argc, char *argv[]) { //QCoreApplication a(argc, argv); srand(time(NULL)); long M=511; //number of channels long T=20; //convolution kernel size long N=5e9/(M*T); //number of timepoints double *Xin=(double *)malloc(sizeof(double)*M*N); double *Xout=(double *)malloc(sizeof(double)*M*N); double *Kern=(double *)malloc(sizeof(double)*T); printf("Note: Each operation consists of a multiply and an add.\n\n"); printf("Preparing...\n"); for (int ii=0; ii<M*N; ii++) { Xin[ii]=ii%183; } for (int t=0; t<T; t++) { Kern[t]=rand()*1.0/rand(); } if (1) { printf("\nMethod 1 (simple loops)...\n"); QTime timer; timer.start(); method1(M,N,T,Xin,Xout,Kern); double elapsed=timer.elapsed()*1.0/1000; printf("%g,%g,%g\n",Xout[1],Xout[1000],Xout[100000]); double mops=M*N*T/elapsed/1e6; printf("Method 1: Elapsed time: %.5f sec\n",elapsed); printf(" *** %g million operations per second ***\n\n",mops); } if (1) { printf("\nMethod 2 (simple loops - method 2)...\n"); QTime timer; timer.start(); method2(M,N,T,Xin,Xout,Kern); double elapsed=timer.elapsed()*1.0/1000; printf("%g,%g,%g\n",Xout[1],Xout[1000],Xout[100000]); double mops=M*N*T/elapsed/1e6; printf("Method 2: Elapsed time: %.5f sec\n",elapsed); printf(" *** %g million operations per second ***\n\n",mops); } if (1) { printf("\nMethod 3 (cblas level 1)...\n"); QTime timer; timer.start(); method3(M,N,T,Xin,Xout,Kern); double elapsed=timer.elapsed()*1.0/1000; printf("%g,%g,%g\n",Xout[1],Xout[1000],Xout[100000]); double mops=M*N*T/elapsed/1e6; printf("Method 3: Elapsed time: %.5f sec\n",elapsed); printf(" *** %g million operations per second ***\n\n",mops); } if (1) { printf("\nMethod 4 (cblas level 2)...\n"); QTime timer; timer.start(); method4(M,N,T,Xin,Xout,Kern); double elapsed=timer.elapsed()*1.0/1000; printf("%g,%g,%g\n",Xout[1],Xout[1000],Xout[100000]); double mops=M*N*T/elapsed/1e6; printf("Method 4: Elapsed time: %.5f sec\n",elapsed); printf(" *** %g million operations per second ***\n\n",mops); } if (1) { printf("\nMethod 5 (cblas level 2, multiple threads)...\n"); QTime timer; timer.start(); method5(M,N,T,Xin,Xout,Kern); double elapsed=timer.elapsed()*1.0/1000; printf("%g,%g,%g\n",Xout[1],Xout[1000],Xout[100000]); double mops=M*N*T/elapsed/1e6; printf("Method 5: Elapsed time: %.5f sec\n",elapsed); printf(" *** %g million operations per second ***\n\n",mops); } free(Xin); free(Xout); free(Kern); return 0; }
int main(int argc, char const *argv[]) { method1(); method2(); return 0; }
int addDigits(int num) { return method2(num); }
void SVT_ThreadMother::run() { int counter=0; while(!mCore->mCoreExit) { counter++; SLEEP(200); // continue; SVT_NodePoolRef lazyDelete; mMutex.lock(); SVT_NodePoolRef waitpool=mNodePoolWaited; mNodePoolWaited=NULL; mMutex.unlock(); if(!waitpool.isNull() && mNodePool!=waitpool) { // wantStart=true; if(!mNodePool.isNull()) { mNodePool->mPoolExit=true; mNodePool->stop(); } waitpool->mPoolExit=true; waitpool->stop(); mThreadPool.waitForDone(); lazyDelete=mNodePool; mNodePool=waitpool; CORE_LOCK(); #if USE_NETBIOS_METHOD if(sMapFlags &MF_USE_NETBIOS_SCAN) { SVT_TopoMethodRef method1(new SVT_NetbiosMethod(mNodePool.asPointer())); mNodePool->addMethod(method1); } #endif if(sMapFlags & MF_USE_ARP_SCAN) { SVT_TopoMethodRef method2(new SVT_NetscanMethod(mNodePool.asPointer())); mNodePool->addMethod(method2); } #if USE_UPNP_METHOD if(sMapFlags & MF_USE_UPNP_SCAN) { SVT_TopoMethodRef method3(new SVT_UpnpMethod(mNodePool.asPointer())); mNodePool->addMethod(method3); } #endif #if USE_NETGEARSPECIFIC_METHOD if(sMapFlags & MF_USE_NETGEARSPECIFIC_SCAN) { SVT_TopoMethodRef method4(new SVT_NetgearSpecificMethod(mNodePool.asPointer())); mNodePool->addMethod(method4); } #endif #if USE_AFP_METHOD if(sMapFlags & MF_USE_AFP_SCAN) { SVT_TopoMethodRef method5(new SVT_AfpMethod(mNodePool.asPointer())); mNodePool->addMethod(method5); } #endif #ifdef USE_RDP if(sMapFlags & MF_USE_RDP_SCAN) { SVT_TopoMethodRef method6(new SVT_RdpMethod(mNodePool.asPointer())); mNodePool->addMethod(method6); } #endif #ifdef USE_PUTTY if(sMapFlags & MF_USE_PUTTY_SCAN) { SVT_TopoMethodRef method7(new SVT_PuttyMethod(mNodePool.asPointer())); mNodePool->addMethod(method7); } #endif mNodePool->start(); CORE_UNLOCK(); } lazyDelete=NULL; } mMutex.lock(); if(!mNodePool.isNull()) { mNodePool->mPoolExit=true; } if(!mNodePoolWaited.isNull()) { mNodePoolWaited->mPoolExit=true; } mMutex.unlock(); mThreadPool.waitForDone(); }