Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

void Impala::Application::Client::TestBandwidth ( Util::Channel *  chanP  ) 

Definition at line 160 of file mainDataClient.cpp.

References Impala::atol(), Impala::Util::Channel::Buffer(), Impala::CmdOptions::GetArg(), Impala::Util::Database::GetInstance(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetNrArg(), gNrIter, ILOG_DEBUG, ILOG_INFO, ILOG_VAR, Impala::MakeString(), Impala::Core::Array::RGB2Intensity(), Impala::Util::Channel::SendRequest(), Impala::Core::Array::Set(), Impala::Timer::SplitTime(), and Impala::Core::Array::WriteRaw().

Referenced by mainClient().

00161 {
00162     ILOG_VAR(Impala.Application.Client.TestBandwidth);
00163     CmdOptions& options = CmdOptions::GetInstance();
00164 
00165     Util::Channel& chan = *chanP;
00166     char* buf = chan.Buffer();
00167 
00168     int width = 352;
00169     if (options.GetNrArg() > 2)
00170         width = atol(options.GetArg(2));
00171     int height = 288;
00172     if (options.GetNrArg() > 3)
00173         height = atol(options.GetArg(3));
00174     ILOG_INFO("sizes : " << width << " x " << height);
00175 
00176     bool doWrite = false;
00177     Timer theTimer(1);
00178     for (int i=1 ; i<gNrIter ; i++)
00179     {
00180         // ask server for data
00181         ILOG_DEBUG("requesting testdata");
00182         int nrBytes = width * height * 3;
00183         sprintf(buf, "testdata %d\0", nrBytes);
00184         int len = chan.SendRequest(strlen(buf)+1);
00185 
00186         if (doWrite)
00187         {
00188             // convert data to a Array
00189             Array2dVec3UInt8* srcWrap =
00190                 ArrayCreate<Array2dVec3UInt8>(width, height, 0, 0, (UInt8*) buf,
00191                                               true);
00192             Array2dVec3Real64* srcV3R64 = 0;
00193             Set(srcV3R64, srcWrap);
00194 
00195             // do some processing
00196             Array2dScalarReal64* srcSR64 = 0;
00197             RGB2Intensity(srcSR64, srcV3R64);
00198 
00199             // write result to disc
00200             if (i < 5)
00201                 WriteRaw(srcSR64, "res.raw" + MakeString(i),
00202                          &Util::Database::GetInstance(), false);
00203 
00204             delete srcWrap;
00205             delete srcV3R64;
00206             delete srcSR64;
00207         }
00208         double timeVal = theTimer.SplitTime();
00209         double fps = (double) i / timeVal;
00210         double bps = (1.0*i * width*height*3) / (1024.0*1024 * timeVal);
00211         std::cout << "Did " << i << " frames in " <<  std::setw(8) << std::left 
00212                   << timeVal << " sec = " << std::setw(8) << fps << " fps and "
00213                   << std::setw(8) << bps << " Mb/sec" << std::endl;
00214     }
00215 }

Here is the call graph for this function:


Generated on Fri Mar 19 10:39:00 2010 for ImpalaSrc by  doxygen 1.5.1