Example #1
0
int main()
{
	std::cout << "Boost.Statechart StopWatch example\n\n";
	std::cout << "s<CR>: Starts/Stops stop watch\n";
	std::cout << "r<CR>: Resets stop watch\n";
	std::cout << "d<CR>: Displays the elapsed time in seconds\n";
	std::cout << "e<CR>: Exits the program\n\n";
	std::cout << "You may chain commands, e.g. rs<CR> resets and starts stop watch\n\n";

	StopWatch stopWatch;
	stopWatch.initiate();

	char key = GetKey();

	while ( key != 'e' )
	{
		switch( key )
		{
			case 'r':
				{
					stopWatch.process_event( EvReset() );
				}
				break;

			case 's':
				{
					stopWatch.process_event( EvStartStop() );
				}
				break;

			case 'd':
				{
					double elapsedTime = 0.0;
					stopWatch.process_event( EvGetElapsedTime( elapsedTime ) );
					std::cout << "Elapsed time: " << elapsedTime << "\n";
				}
				break;

			default:
				{
					std::cout << "Invalid key!\n";
				}
				break;
		}

		key = GetKey();
	}

	return 0;
}
Example #2
0
int _tmain(int argc, _TCHAR* argv[])
{
	 uint32_t goalsize = 6144; // 6GB
	 
	 
    _ASSERTE(create_very_big_file(L"big.txt",goalsize));//목표크기 6GB만큼 파일 생성


    StopWatch sw; 
    sw.Start();
    _ASSERTE(file_copy_using_read_write(L"big.txt", L"big2.txt"));
    sw.Stop();   
    print("info] (Read Write) time elapsed = %f", sw.GetDurationSecond());


	LARGE_INTEGER _Filesize; 
	_Filesize.QuadPart = (LONGLONG)(1024*1024)*(LONGLONG)goalsize;//파일의 크기 6GB 설정하기위해 LARGE_INTEGER
	DWORD bufS = 4096; // read.write에서 buf가 4096이므로 4096설정
	PUCHAR buf = (PUCHAR)malloc(bufS);

	LARGE_INTEGER _Offset;
	_Offset.QuadPart = 0; //파일을 옮겨주는 계산을 하는데 사용한다.



    StopWatch sw2;
	sw2.Start();
    
	FileIoHelper FileHelp;
	FileHelp.FIOpenForRead(L"big.txt");
	FileHelp.FIOCreateFile(L"big3.txt", _Filesize);

	while(_Filesize.QuadPart > _Offset.QuadPart)         
	{
		if((_Filesize.QuadPart - _Offset.QuadPart) > (LONGLONG)bufS)
			bufS = 4096;
		
		else
			bufS = (DWORD)(_Filesize.QuadPart - _Offset.QuadPart);

		FileHelp.FIOReadFromFile(_Offset, bufS, buf);
		FileHelp.FIOWriteToFile(_Offset, bufS, buf);
		_Offset.QuadPart += (LONGLONG)bufS;
	}
    sw2.Stop();
    print("info] (Memory Map) time elapsed = %f", sw2.GetDurationSecond());


    return 0;
}
Example #3
0
boost::shared_ptr<FMainMemoryBTree> loadOneSSBBinFile(
    char *buffer, FSignatureSet &signatureFile, const std::string &dataFolder,
    TableType tableType, int64_t maxSize, const std::string &tblFolder, const std::string &tblName, bool cstore) {
  boost::shared_ptr<FMainMemoryBTree> btreePtr(new FMainMemoryBTree(tableType, maxSize, false));
  FMainMemoryBTree *btree = btreePtr.get();
  scoped_array<char> keyBufferPtr(new char[toKeySize(tableType)]);
  char *keyBuffer = keyBufferPtr.get();
  ::memset (keyBuffer, 0, toKeySize(tableType));
  ExtractKeyFromTupleFunc extractFunc = toExtractKeyFromTupleFunc(tableType);

  StopWatch watch;
  watch.init();
  std::string filename = tblFolder + tblName;
  LOG (INFO) << "reading " << filename << "...";
  std::ifstream file(filename.c_str(), std::ios::in | std::ios::binary);
  if (!file) {
    LOG (ERROR) << "could not open " << filename;
    throw std::exception();
  }
  size_t maxBufCount = IO_BUFFER_SIZE / btree->getDataSize();
  size_t maxBufSize = maxBufCount * btree->getDataSize();
  assert (maxBufSize <= IO_BUFFER_SIZE);
  int count = 0;
  while (true) {
    file.read (buffer, maxBufSize);
    size_t readSize = file.gcount();
    for (size_t pos = 0; pos + btree->getDataSize() <= readSize; pos += btree->getDataSize()) {
      if (++count % 100000 == 0) {
        LOG (INFO) << "reading " << count;
      }
      extractFunc (buffer + pos, keyBuffer);
      btree->insert(keyBuffer, buffer + pos);
    }
    if (readSize < maxBufSize) break;
  }
  LOG(INFO) << "read " << count << " lines";
  btree->finishInserts();
  file.close();
  watch.stop();
  LOG(INFO) << "constructred main memory BTree (" << watch.getElapsed() << " micsosec for reading and constructing). writing to disk...";
  if (cstore) {
    LOG (INFO) << "cstore";
    signatureFile.dumpToNewCStoreFiles(dataFolder, tblName, *btree);
  } else {
    LOG (INFO) << "rowstore";
    signatureFile.dumpToNewRowStoreFile(dataFolder, tblName + ".db", *btree);
  }
  return btreePtr;
}
Example #4
0
void MVC_Model::InitLights(void)
{
#ifdef _DEBUG
    StopWatch initTimer;
    initTimer.startTimer();

    std::cout << "Loading " << m_lightSONFile << "... ";
#endif

    m_lights = LoadLight(m_lightSONFile);

#ifdef _DEBUG
    std::cout << "Loaded! (" << initTimer.getElapsedTime() << "s)" << std::endl;
#endif
}
Example #5
0
void MVC_Model::InitGameObjects()
{
#ifdef _DEBUG
    StopWatch initTimer;
    initTimer.startTimer();

    std::cout << "Loading " << m_goSONFile << "... ";
#endif

    goList = LoadGameObject(m_goSONFile, meshList);

#ifdef _DEBUG
    std::cout << "Loaded! (" << initTimer.getElapsedTime() << "s)" << std::endl;
#endif
}
int TestLoggingOverhead_SingleThreaded_Synchronisation() {
	// First initialization, using defaults from Boost logging.
	BoostLogging::InitAddCommonAttributes();
	BoostLogging::InitSetLogLevelToDebug();
	BoostLogging::InitLogToDevNullSynchronized();
	const int max = 1000000;
	{
	  // debug messages are processed and written to /dev/null, because min level is debug
		StopWatch stopWatch;
		BoostLogging::LogDebugMessageManyTimes(max);
		std::cout << "Writing debug message to /dev/null synchronized): elapsed time: " << stopWatch.ElapsedSeconds().count()
				<< ", max: " << max << std::endl;
	}
	return OutcomeIsOk();
Example #7
0
void MVC_Model::InitSounds()
{
#ifdef _DEBUG
    StopWatch initTimer;
    initTimer.startTimer();

    std::cout << "Loading " << m_soundSONFile << "... ";
#endif

    soundList = LoadSounds(m_soundSONFile);

#ifdef _DEBUG
    std::cout << "Loaded! (" << initTimer.getElapsedTime() << "s)" << std::endl;
#endif
}
bool LZ2DataRunner::run(Globals* g, const vector<string>& args) {
  if(args.size()<2){
    cout << "at least two arguments! " <<endl;
    return false;
  }
  _file = args[0].c_str();
  int testnum = atoi(args[1].c_str());

  cout << "LZ2DataRunner: Running file " << _file << endl;
    	bool success=true;  

  int i=0;
  for (; i< 30; i++)
    if (strncmp(_file+i, "dnatest",7) == 0) {
      break;
    }

  char* temp = new char[30];
  sprintf(temp, "test%dLZ%s", testnum, (_file+i+8));
  char* fn = new char[30];
  sprintf(fn, "test2LZ%s", (_file+i+8));

  StopWatch stopWatch;
  stopWatch.start();
  
  NOBDBAM* am = new NOBDBAM( fn, 1);
  LZDataSource* ds=new LZDataSource(am, false);
  HashSum* hashAgg = new HashSum((Operator*) ds, 0, (Operator*) ds, 0);
  hashAgg->setHashFunction(new IdentityHashFunction(200));
  hashAgg->setHashTableSize(200);
  Operator* srcs[1]={hashAgg};
  int numCols[1]={2};
   
  char* temp3 = new char[30];
  sprintf(temp3, "%s.out", temp);
  BlockPrinter* bPrint=new BlockPrinter(srcs, numCols, 1, temp3);
  bPrint->printColumns();
  
  sprintf(temp3, "test%dLZ.dat", testnum);
  ofstream flStream;
  flStream.open(temp3, ios::out | ios::app);
  flStream.seekp(ios::end);
  flStream << "xval: " << (_file+i+8) << endl;
  stopWatch.stopToFile(temp3);
  
  flStream.close();
  return success;	
}
Example #9
0
int main()
{
	using::Journey::Client;
	using::Journey::ClientError;
	Client client;

	ClientError error = client.geterror();
	if (error == Journey::CLERR_NOERROR)
	{
		uint16_t dpf = 4;
		uint16_t remain = 0;

		using::Util::StopWatch;
		StopWatch swatch;
		while (client.receive())
		{
			remain += swatch.evaluate();
			while (remain > dpf - 1)
			{
				client.update(dpf);
				remain -= dpf;
			}
			client.draw();
		}
	}
	else
	{
		switch (error)
		{
		case Journey::CLERR_NXFILES:
			showerror("Error: Could not find valid game files.");
			break;
		case Journey::CLERR_CONNECTION:
			showerror("Error: Could not connect to server.");
			break;
		case Journey::CLERR_WINDOW:
			showerror("Error: Could not initialize graphics.");
			break;
		case Journey::CLERR_AUDIO:
			showerror("Error: Could not initialize audio.");
			break;
		}

		while (true) {}
	}

	return 0;
}
static double testQueuePop()
{
    StopWatch stopWatch;
    for(std::size_t iter = 0; iter != testing::STANDARD_SPEED_ITERS; ++iter) {
        std::queue<std::size_t> queue;
        for(std::size_t count = 0; count != testing::STANDARD_SPEED_COUNT; ++count) {
            queue.push(count);
        }
        stopWatch.start();
        for(std::size_t count = 0; count != testing::STANDARD_SPEED_COUNT; ++count) {
            queue.pop();
        }
        stopWatch.stop();
    }
    return testing::calcNanosPer(getTimevalAsMicros(stopWatch.elapsed()));
}
Example #11
0
AJValue JSC_HOST_CALL functionRun(ExecState* exec, AJObject*, AJValue, const ArgList& args)
{
    StopWatch stopWatch;
    UString fileName = args.at(0).toString(exec);
    Vector<char> script;
    if (!fillBufferWithContentsOfFile(fileName, script))
        return throwError(exec, GeneralError, "Could not open file.");

    AJGlobalObject* globalObject = exec->lexicalGlobalObject();

    stopWatch.start();
    evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), makeSource(script.data(), fileName));
    stopWatch.stop();

    return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
}
Example #12
0
/*
????TestFloat	1074.285570 / 10000000 = 0.000107
????TestFloat2	30.188889 / 10000000 = 0.000003
*/
void OtherTest::TestFloat()
{
	const int count=10000000;
	float f=1.73f;
	float outi;

	StopWatch watch;
	watch.SetRunTimes(count);
	watch.SetName("TestFloat");

	watch.Start();
	FOR_EACH_SIZE(i,count)
	{
		float r= modf(f,&outi);
		int ii=(int)outi;
	}
Example #13
0
void PercolationStats::run()
{
	int i;
	// perform T independent computational experiments on an N-by-N grid
	StopWatch watch;
	for (int i = 0; i < m_experimentsNumber; i++) {

		watch.start();
		m_threshold[i] = experiment();
		m_time[i] = watch.stop();
		m_percolation->reset();
	}
	// Stats
	m_timeStats = new StatsData(m_time, m_experimentsNumber);
	m_thresholdStats = new StatsData(m_threshold, m_experimentsNumber);
}
Example #14
0
// Initialize the application
// initialize the state of your app here if needed...
static void OnApplicationInit()
{
   // Don't put open GL code here, this func may be called at anytime
   // even before the API is initialized 
   // (like before a graphics context is obtained)
   
   aliases[0].sound.init( "sep" );
   aliases[9].sound.init( "sol" );
   aliases[8].sound.init( "attack" );
   aliases[7].sound.init( "drum" );
   
   snx::SoundInfo si;
   si.ambient = false;
   si.datasource = snx::SoundInfo::FILESYSTEM;
   si.filename = "sep.wav";
   aliases[0].sound.configure( si );
   si.filename = "sol.wav";
   aliases[9].sound.configure( si );
   si.filename = "attack.wav";
   aliases[8].sound.configure( si );
   si.filename = "drum44100.wav";
   aliases[7].sound.configure( si );
   
   kevinSound.init( "kevin" );
   stopWatch.pulse();
}
Example #15
0
File: Log.cpp Project: emdeesee/rct
bool initLogging(const char* ident, Flags<LogMode> mode, LogLevel level,
                 const Path &file, Flags<LogFileFlag> flags, LogLevel logFileLogLevel)
{
    sStart.start();
    sFlags = flags;
    sLevel = level;
    if (mode & LogStderr) {
        std::shared_ptr<StderrOutput> out(new StderrOutput(level));
        out->add();
    }
    if (mode & LogSyslog) {
        std::shared_ptr<SyslogOutput> out(new SyslogOutput(ident, level));
        out->add();
    }
    if (!file.isEmpty()) {
        if (!(flags & (Append|DontRotate)) && file.exists()) {
            int i = 0;
            while (true) {
                const Path rotated = String::format<64>("%s.%d", file.constData(), ++i);
                if (!rotated.exists()) {
                    if (rename(file.constData(), rotated.constData())) {
                        error() << "Couldn't rotate log file" << file << "to" << rotated << Rct::strerror();
                    }
                    break;
                }
            }
        }
        FILE *f = fopen(file.constData(), flags & Append ? "a" : "w");
        if (!f)
            return false;
        std::shared_ptr<FileOutput> out(new FileOutput(logFileLogLevel, f));
        out->add();
    }
    return true;
}
Example #16
0
// run the plan
void Plan::run(bool rosOnly)
{	
	if (m_lpRootNode != NULL)
	{
		StopWatch stopWatch;
		stopWatch.start();
		
		m_lpRootNode->run(rosOnly);
		
		cout << "Query took: " << stopWatch.stop() << " ms" <<  endl;
	}
	else
	{
		cout << "No plan generated" <<  endl;
	}
}
		void
		testGetInSeconds()
		{
            StopWatch sw;

            // 2 s
			timespec delay;
			delay.tv_sec = static_cast<time_t>(2);
			delay.tv_nsec = static_cast<long>(0*1E9);

            sw.start();
            nanosleep(&delay, NULL);
            sw.stop();

            CPPUNIT_ASSERT_EQUAL( 2, static_cast<int>(round(sw.getInSeconds())) );
        }
Example #18
0
File: Log.cpp Project: jmataraz/rct
bool initLogging(const char* ident, int mode, int level, const Path &file, unsigned flags)
{
    sStart.start();
    sFlags = flags;
    sLevel = level;
    if (mode & LogStderr)
        new StderrOutput(level);
    if (mode & LogSyslog)
        new SyslogOutput(ident, level);
    if (!file.isEmpty()) {
        if (!(flags & (Log::Append|Log::DontRotate)) && file.exists()) {
            int i = 0;
            while (true) {
                const Path rotated = String::format<64>("%s.%d", file.constData(), ++i);
                if (!rotated.exists()) {
                    if (rename(file.constData(), rotated.constData())) {
                        char buf[1025];
                        if (!strerror_r(errno, buf, 1024)) {
                            error() << "Couldn't rotate log file" << file << "to" << rotated << buf;
                        }
                    }
                    break;
                }
            }
        }
        FILE *f = fopen(file.constData(), flags & Log::Append ? "a" : "w");
        if (!f)
            return false;
        new FileOutput(f);
    }
    return true;
}
Example #19
0
EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
{
    UString fileName = exec->argument(0).toString(exec)->value(exec);
    Vector<char> script;
    if (!fillBufferWithContentsOfFile(fileName, script))
        return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));

    GlobalObject* globalObject = GlobalObject::create(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), Vector<UString>());

    StopWatch stopWatch;
    stopWatch.start();
    evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), jscSource(script.data(), fileName));
    stopWatch.stop();

    return JSValue::encode(jsNumber(stopWatch.getElapsedMS()));
}
Example #20
0
JSValue* functionRun(ExecState* exec, JSObject*, JSValue*, const ArgList& args)
{
    StopWatch stopWatch;
    UString fileName = args.at(exec, 0)->toString(exec);
    Vector<char> script;
    if (!fillBufferWithContentsOfFile(fileName, script))
        return throwError(exec, GeneralError, "Could not open file.");

    JSGlobalObject* globalObject = exec->dynamicGlobalObject();

    stopWatch.start();
    Interpreter::evaluate(globalObject->globalExec(), globalObject->globalScopeChain(), fileName, 1, script.data());
    stopWatch.stop();

    return jsNumber(globalObject->globalExec(), stopWatch.getElapsedMS());
}
bool LocalClient::connect(const Path& path, int maxTime)
{
    if (!path.isSocket())
        return false;
    StopWatch timer;
    struct sockaddr_un address;
    memset(&address, 0, sizeof(struct sockaddr_un));
    address.sun_family = AF_UNIX;
    const int sz = std::min<int>(sizeof(address.sun_path) - 1, path.size());
    memcpy(address.sun_path, path.constData(), sz);
    address.sun_path[sz] = '\0';
    while (true) {
        mFd = ::socket(PF_UNIX, SOCK_STREAM, 0);
        if (mFd == -1) {
            Path::rm(path);
            return false;
        }
        int ret;
        eintrwrap(ret, ::connect(mFd, (struct sockaddr *)&address, sizeof(struct sockaddr_un)));
        if (!ret) {
#ifdef HAVE_NOSIGPIPE
            ret = 1;
            ::setsockopt(mFd, SOL_SOCKET, SO_NOSIGPIPE, (void *)&ret, sizeof(int));
#endif
            break;
        }
        eintrwrap(ret, ::close(mFd));
        mFd = -1;
        if (maxTime > 0 && timer.elapsed() >= maxTime) {
            Path::rm(path);
            return false;
        }
    }

    assert(mFd != -1);
    int flags;
    eintrwrap(flags, fcntl(mFd, F_GETFL, 0));
    eintrwrap(flags, fcntl(mFd, F_SETFL, flags | O_NONBLOCK));

    unsigned int fdflags = EventLoop::Read;
    if (!mBuffers.empty())
        fdflags |= EventLoop::Write;
    EventLoop::instance()->addFileDescriptor(mFd, fdflags, dataCallback, this);

    mConnected(this);
    return true;
}
Example #22
0
/**
 * \brief Program to compute PI using brute force a niave algorithm.
 */
int main(int argc, const char * argv[])
{

  std::cout << "Calculating pi by computing the of 1/4 unit-circle." << std::endl;

  StopWatch PiTimer;
  PiTimer.StartTimer();
  const double areaUnitCircle = CaluculatePiByEstimatingUnitCircleArea(50000);
  PiTimer.StopTimer();

  std::cout << std::setprecision(17) ;
  std::cout << "Accurate   PI = " << pi() << std::endl;
  std::cout << "Calculated PI = " << areaUnitCircle << std::endl;
  std::cout << "ERROR         = " << areaUnitCircle - pi() << std::endl;
  std::cout << "Seconds       = " << PiTimer.GetElapsedSeconds() << std::endl;
  return EXIT_SUCCESS;
}
Example #23
0
// This main loop calls functions to get input, update and render the game
// at a specific frame rate
void game()
{
	int current = 500;
	createsnake(3);
	cls();
	map();
	g_timer.startTimer();	// Start timer to calculate how long it takes to render this frame
	while (!gameover)      // run this loop until user wants to quit 
	{
		getInput();							// get keyboard input
		current = update(g_timer.getElapsedTime());	// update the game
		render();							 // render the graphics output to screen
		g_timer.waitUntil(current/FPS);		 // Frame rate limiter. Limits each frame to a specified time in ms.      
	}
	highscore();
	gg();
}
Example #24
0
void Dispatcher::dispatchRequest( unsigned int uCommand,PushFramework::LogicalConnection* pClient,IncomingPacket& packet,unsigned int serviceBytes )
{
    //StopWatch dispatchWatch(m_QPFrequency);

    serviceMapT::iterator it = serviceMap.find(uCommand);
    if (it == serviceMap.end())
        return;
    //
    Service* pHandler = it->second->pService;

    //wcout << L"Locating Service : " << dispatchWatch.GetElapsedTime(false) << std::endl;

    //Mark dispatched service :

    setCurrentService(it->second->serviceName);

    StopWatch watch;
    pHandler->handle(pClient, &packet);


    double duration = watch.GetElapsedTime();
    /*	wcout << L"Service Time : " << watch.GetElapsedTime() << std::endl;
     */


    //StopWatch statsClock(m_QPFrequency);
    stats.addToDistribution(ServerStats::PerformanceProcessingTimePerService, it->second->serviceName, duration);
    //wcout << L"Stat 1 : " << statsClock.GetElapsedTime(false) << std::endl;

    stats.addToDuration(ServerStats::PerformanceProcessingTime, duration);
    //wcout << L"Stat 2 : " << statsClock.GetElapsedTime(false) << std::endl;

    UnsetCurrentService();

    //Stats. :

    stats.addToDistribution(ServerStats::BandwidthInboundVolPerRequest, it->second->serviceName, serviceBytes);
    //wcout << L"Stat 3 : " << statsClock.GetElapsedTime(false) << std::endl;


    stats.addToDistribution(ServerStats::PerformanceRequestVolPerRequest, it->second->serviceName, 1);
    //wcout << L"Stat 4 : " << statsClock.GetElapsedTime(false) << std::endl;


    //wcout << L"Dispatch Time : " << dispatchWatch.GetElapsedTime() << std::endl;
}
Example #25
0
	void ThreadBoost::SleepFor(millis_t millis, bool ensureSleepForCorrectTime)
	{
		
		if(ensureSleepForCorrectTime){
			StopWatch sw;
			millis_t remain = millis;
			do{
				boost::this_thread::sleep(boost::posix_time::milliseconds(remain));
				millis_t remain = millis - sw.Elapsed(false);
				if(remain <= 0) break;
				boost::this_thread::yield();
			}while(true);
		}else{
			boost::this_thread::sleep(boost::posix_time::milliseconds(millis));
		}

	}
Example #26
0
void SceneBase::InitMaterials()
{
	const string MATERIAL_FILE_PATH = "SONs//Materials.son";

	StopWatch initTimer;
	initTimer.startTimer();

	std::cout << "Loading " << MATERIAL_FILE_PATH << "... ";

	matList = LoadMaterial(MATERIAL_FILE_PATH);
	// Push the default Material to the 
	Material temp;
	temp.name = "DefaultMaterial";
	matList.insert(std::pair<string, Material>(temp.name, temp));

	std::cout << "Loaded! (" << initTimer.getElapsedTime() << "s)" << std::endl;
}
static double testPriorityQueueAddSequential()
{
    double total(0);
    StopWatch stopWatch;

    for(std::size_t iter = 0; iter != testing::STANDARD_SPEED_ITERS; ++iter) {
        std::priority_queue<FooBar> pq;
        stopWatch.start();
        for(std::size_t count = 0; count != testing::STANDARD_SPEED_COUNT; ++count) {
            pq.push(FooBar(count));
        }
        stopWatch.stop();
        total += getTimevalAsMicros(stopWatch.elapsed());
        stopWatch.reset();
    }
    return testing::calcNanosPer(total);
}
static double testListPushBack()
{
    double total(0);
    StopWatch stopWatch;

    for(std::size_t iter = 0; iter != testing::STANDARD_SPEED_ITERS; ++iter) {
        std::list<std::size_t> list;
        stopWatch.start();
        for(std::size_t count = 0; count != testing::STANDARD_SPEED_COUNT; ++count)
            list.push_back(count);
        stopWatch.stop();
        total += getTimevalAsMicros(stopWatch.elapsed());
        stopWatch.reset();
    }

    return testing::calcNanosPer(total);
}
static double testMapAddSequential()
{
    double total(0);
    StopWatch stopWatch;

    for(std::size_t iter = 0; iter != testing::STANDARD_SPEED_ITERS; ++iter) {
        std::map<std::size_t,std::size_t> map;
        stopWatch.start();
        for(std::size_t count = 0; count != testing::STANDARD_SPEED_COUNT; ++count) {
            map[count] = count;
        }
        stopWatch.stop();
        total += getTimevalAsMicros(stopWatch.elapsed());
        stopWatch.reset();
    }
    return testing::calcNanosPer(total);
}
Example #30
0
void FormatTest::TestInt()
{
	const int count=100000;
	int val = 1000;

	StopWatch watch;
	watch.SetRunTimes(count);
	watch.SetName("TestInt");

	watch.Start();
	std::string str1;
	FOR_EACH_SIZE(i, count)
	{
		char temp[64];
		sprintf_s(temp, "%d", val);
		str1.assign(temp);
	}