当前位置: 首页>>代码示例>>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;未经允许,请勿转载。