當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetCounter函數代碼示例

本文整理匯總了C++中GetCounter函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCounter函數的具體用法?C++ GetCounter怎麽用?C++ GetCounter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetCounter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetCounter

void Instrument::InstrumentLoadStore(const Instruction* instr) {
    static Counter* load_int_counter = GetCounter("Load Integer");
    static Counter* store_int_counter = GetCounter("Store Integer");
    static Counter* load_fp_counter = GetCounter("Load FP");
    static Counter* store_fp_counter = GetCounter("Store FP");

    switch (instr->Mask(LoadStoreOpMask)) {
    case STRB_w:    // Fall through.
    case STRH_w:    // Fall through.
    case STR_w:     // Fall through.
    case STR_x:
        store_int_counter->Increment();
        break;
    case STR_s:     // Fall through.
    case STR_d:
        store_fp_counter->Increment();
        break;
    case LDRB_w:    // Fall through.
    case LDRH_w:    // Fall through.
    case LDR_w:     // Fall through.
    case LDR_x:     // Fall through.
    case LDRSB_x:   // Fall through.
    case LDRSH_x:   // Fall through.
    case LDRSW_x:   // Fall through.
    case LDRSB_w:   // Fall through.
    case LDRSH_w:
        load_int_counter->Increment();
        break;
    case LDR_s:     // Fall through.
    case LDR_d:
        load_fp_counter->Increment();
        break;
    }
}
開發者ID:logicoftekk,項目名稱:cyberfox,代碼行數:34,代碼來源:Instrument-vixl.cpp

示例2: switch

void
Control::Substitute(map<string,string>* __mapping){
switch(GetControlKind()){
   case ADaAn_FOR      :
            if(__mapping->find(GetCounter()) != __mapping->end())
               SetCounterName(__mapping->operator[](GetCounter()));
            GetForLowerBound()->Substitute(__mapping);
            GetForUpperBound()->Substitute(__mapping);
            return;
   case ADaAn_WHILE   :
            if(__mapping->find(GetCounter()) != __mapping->end())
               SetCounterName(__mapping->operator[](GetCounter()));
            GetCondition()->Substitute(__mapping);
            return;
   case ADaAn_IF      :
            GetCondition()->Substitute(__mapping);
            return;
   case ADaAn_IF_ELSE   :
            GetCondition()->Substitute(__mapping);
            return;
   }

cerr<<"Control::Rename, Fatal error(unhandled operator)";
throw(UNHANDLED_CASE);
exit(EXIT_FAILURE);
}
開發者ID:mbelaoucha,項目名稱:fadalib,代碼行數:26,代碼來源:controlstructure.cpp

示例3: Run

	void Run()
	{
		LOG_INFO("Thread [%s] Start...", m_threadName);
		int ret = 0;
		for(int i= GetCounter(); i <= m_requestCount; i= GetCounter()){
			ClientCtx* ctx = GetCtx();

			ret = m_requestCb(i, ctx, m_args);
			
			if(ret== 0){
				AtomInt_Inc(&g_errors[0]);
			}else{
				if(ret < 0){
					AtomInt_Inc(&g_errors[ERRNO_UNKNOW]);
				}else{
					AtomInt_Inc(&g_errors[ret%0xFFFF]);
				}
			}

			if(i % m_num == 0){
				double usedtime = g_now_second -g_start;
				//LOG_DEBUG("start:%.3f - now:%.3f", g_start, g_now_second);
				printf("Request %d time:%.3f\n", i, usedtime);
			}
			if(g_stop) break;
		}
		
		LOG_INFO("Thread [%s] Stop...", m_threadName);
	}
開發者ID:fast01,項目名稱:nginx-tcp-server,代碼行數:29,代碼來源:TcpTestClient.cpp

示例4: i386

/****************************************************************************
REMARKS:
If processor does not support time stamp reading, but is at least a 386 or
above, utilize method of timing a loop of BSF instructions which take a
known number of cycles to run on i386(tm), i486(tm), and Pentium(R)
processors.
****************************************************************************/
static ulong GetBSFCpuSpeed(
    ulong cycles)
{
    CPU_largeInteger t0,t1,count_freq;
    ulong   ticks;              /* Microseconds elapsed during test     */
    ulong   current;            /* Variable to store time elapsed       */
    int     i,j,iPriority;
    ulong   lowest  = (ulong)-1;

    iPriority = SetMaxThreadPriority();
    GetCounterFrequency(&count_freq);
    for (i = 0; i < SAMPLINGS; i++) {
	GetCounter(&t0);
	for (j = 0; j < INNER_LOOPS; j++)
	    _CPU_runBSFLoop(ITERATIONS);
	GetCounter(&t1);
	current = t1.low - t0.low;
	if (current < lowest)
	    lowest = current;
	}
    RestoreThreadPriority(iPriority);

    /* Compute frequency */
    ticks = _CPU_mulDiv(lowest,1000000,count_freq.low);
    if ((ticks % count_freq.low) > (count_freq.low/2))
	ticks++;            /* Round up if necessary */
    if (ticks == 0)
	return 0;
    return ((cycles*INNER_LOOPS)/ticks);
}
開發者ID:A1DEVS,項目名稱:lenovo_a1_07_uboot,代碼行數:37,代碼來源:cpuinfo.c

示例5: operator

 uint32_t operator()()
 {
     uint32_t const counter = GetCounter();
     if ((counter % 3) == 0)
         return m_startIndex;
     return m_startIndex + counter - 2 * (counter / 3);
 }
開發者ID:65apps,項目名稱:omim,代碼行數:7,代碼來源:batcher_helpers.cpp

示例6: InitGL

/* Initialize OpenGL Graphics */
void InitGL()
{
	StartCounter();
	gLastTime = GetCounter();
	// Set "clearing" or background color
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Black and opaque
}
開發者ID:darren-moore,項目名稱:pinball-physics,代碼行數:8,代碼來源:main.cpp

示例7: GetCounter

unsigned int HighPerfTick::Tick()
{
	__int64 counter = GetCounter();
	unsigned int elapsed = (unsigned int)(counter - lastTick);
	lastTick = counter;
	return elapsed;
}
開發者ID:Valrandir,項目名稱:KirbyCore,代碼行數:7,代碼來源:HighPerfTick.cpp

示例8: Idle

//---------------------------------------------------------------------------------
// Update from glut. Called when no more event handling.
//---------------------------------------------------------------------------------
void Idle()
{	
	static double prevTime = GetCounter();
	double tick = GetCounter() - prevTime;
	double currentTime = GetCounter();
	double deltaTime = currentTime - gLastTime;
	// Update.
	if (deltaTime > (UPDATE_MAX))
	{	
		gUpdateDeltaTime.Stop();
		glutPostRedisplay(); //everytime you are done 
		CSimpleControllers::GetInstance().Update();

		gUserUpdateProfiler.Start();
		if (gEditorMode)
		{
			EditorUpdate((float)deltaTime);			// Call user defined update.
		}
		else
		{
			Update((float)deltaTime);				// Call user defined update.
		}
		gUserUpdateProfiler.Stop();
		
		gLastTime = currentTime;		
		RECT tileClientArea;
		if (GetClientRect( MAIN_WINDOW_HANDLE, &tileClientArea))
		{
			WINDOW_WIDTH = tileClientArea.right - tileClientArea.left;
			WINDOW_HEIGHT = tileClientArea.bottom - tileClientArea.top;
		}

		if (App::GetController().CheckButton(APP_ENABLE_DEBUG_INFO_BUTTON) )
		{
			gRenderUpdateTimes = !gRenderUpdateTimes;
		}

		if (App::IsKeyPressed(APP_QUIT_KEY))
		{		
			glutLeaveMainLoop();
		}
		gUpdateDeltaTime.Start();
	}
	
}
開發者ID:darren-moore,項目名稱:pinball-physics,代碼行數:48,代碼來源:main.cpp

示例9: GetTypeName

std::string ObjectGuid::GetString() const
{
    std::ostringstream str;
    str << GetTypeName() << " (";
    if (HasEntry())
        str << "Entry: " << GetEntry() << " ";
    str << "Guid: " << GetCounter() << ")";
    return str.str();
}
開發者ID:japtenks,項目名稱:blizzlikecore,代碼行數:9,代碼來源:ObjectGuid.cpp

示例10: GetFreeBfRaid

// ****************************************************
// ******************* Group System *******************
// ****************************************************
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
{
    for (auto itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
        if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
            if (!group->IsFull())
                return group;

    return nullptr;
}
開發者ID:Refuge89,項目名稱:TrinityCore,代碼行數:12,代碼來源:Battlefield.cpp

示例11: GetGroupPlayer

Group* Battlefield::GetGroupPlayer(ObjectGuid guid, TeamId TeamId)
{
    for (auto itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
        if (Group* group = sGroupMgr->GetGroupByGUID(itr->GetCounter()))
            if (group->IsMember(guid))
                return group;

    return nullptr;
}
開發者ID:Refuge89,項目名稱:TrinityCore,代碼行數:9,代碼來源:Battlefield.cpp

示例12: operator

  uint32_t operator()()
  {
    uint32_t const counter = GetCounter();
    uint32_t const result = m_startIndex + m_counter;
    if (counter % 2 == 0)
      m_counter++;

    return result;
  }
開發者ID:syershov,項目名稱:omim,代碼行數:9,代碼來源:batcher_helpers.cpp

示例13: Update

void Instrument::VisitMoveWideImmediate(const Instruction* instr) {
    Update();
    static Counter* counter = GetCounter("Move Immediate");

    if (instr->IsMovn() && (instr->Rd() == kZeroRegCode)) {
        unsigned imm = instr->ImmMoveWide();
        HandleInstrumentationEvent(imm);
    } else {
        counter->Increment();
    }
}
開發者ID:logicoftekk,項目名稱:cyberfox,代碼行數:11,代碼來源:Instrument-vixl.cpp

示例14: GetTypeName

std::string ObjectGuid::ToString() const
{
    std::ostringstream str;
    str << "GUID Full: 0x" << std::hex << std::setw(16) << std::setfill('0') << _guid << std::dec;
    str << " Type: " << GetTypeName();
    if (HasEntry())
        str << (IsPet() ? " Pet number: " : " Entry: ") << GetEntry() << " ";

    str << " Low: " << GetCounter();
    return str.str();
}
開發者ID:Aravu,項目名稱:Talador-Project,代碼行數:11,代碼來源:ObjectGuid.cpp

示例15: Pwm_Step

void Pwm_Step(void)
{
	unsigned long cur = GetCounter();
	unsigned long delta_timer = cur - gs_pwm_timer;
	unsigned int vkl_time = gs_current_percent <= 0 ? 0 :(gs_current_percent >= 100 ? g_settings.pwm_mlsec : gs_current_percent * g_settings.pwm_mlsec / 100);
	if(delta_timer >= g_settings.pwm_mlsec)
	{
		delta_timer = 0;
		gs_pwm_timer = cur;
	}
	SetRelayState(delta_timer < vkl_time);
}
開發者ID:klkn,項目名稱:w1209,代碼行數:12,代碼來源:main.c


注:本文中的GetCounter函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。