这篇教程C++ GetCounter函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetCounter函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCounter函数的具体用法?C++ GetCounter怎么用?C++ GetCounter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetCounter函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetCountervoid 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,
示例2: switchvoidControl::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,
示例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,
示例4: i386/****************************************************************************REMARKS:If processor does not support time stamp reading, but is at least a 386 orabove, utilize method of timing a loop of BSF instructions which take aknown 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,
示例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,
示例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,
示例7: GetCounterunsigned int HighPerfTick::Tick(){ __int64 counter = GetCounter(); unsigned int elapsed = (unsigned int)(counter - lastTick); lastTick = counter; return elapsed;}
开发者ID:Valrandir,项目名称:KirbyCore,代码行数:7,
示例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,
示例9: GetTypeNamestd::string ObjectGuid::GetString() const{ std::ostringstream str; str << GetTypeName() << " ("; if (HasEntry()) str << "Entry: " << GetEntry() << " "; str << "Guid: " << GetCounter() << ")"; return str.str();}
开发者ID:japtenks,项目名称:blizzlikecore,代码行数:9,
示例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,
示例11: GetGroupPlayerGroup* 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,
示例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,
示例13: Updatevoid 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,
示例14: GetTypeNamestd::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,
示例15: Pwm_Stepvoid 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,
示例16: Down_Taskvoid Down_Task(void){ switch(GetGrapCount())//层次 { case 1: AddCounter(); if(GetCounter() > 4) SetCounter(1); GetMainGrap(GetCounter()); break; case 2: Level2_Down(); break; case 3: Level3_Down(); break; case 4: Level4_Down(); break; default:break; }}
开发者ID:yjduoduo,项目名称:LPC1768_V1.3,代码行数:23,
示例17: Pid_Stepvoid Pid_Step(void){ float pid_value; unsigned long cur = GetCounter(); float delta_temperature = gs_current_temperature - g_settings.pid_level; if((cur - gs_pid_timer) < g_settings.pid_mlsec) return; gs_pid_timer = cur; gs_intergrator_value += delta_temperature*g_settings.pid_I; if(gs_intergrator_value > g_settings.pid_I_limit) gs_intergrator_value = g_settings.pid_I_limit; pid_value = gs_current_percent + g_settings.pid_P*delta_temperature + gs_intergrator_value + g_settings.pid_D*delta_temperature; gs_current_percent = (pid_value > 100) ? 100 : pid_value;}
开发者ID:klkn,项目名称:w1209,代码行数:14,
示例18: Up_Taskvoid Up_Task(void){ switch(GetGrapCount())//层次 { case 1: if(GetCounter() > 1) SubCounter(); else SetCounter(4); GetMainGrap(GetCounter()); break; case 2: Level2_Up(); break; case 3: Level3_Up(); break; case 4: Level4_Up(); break; default:break; } }
开发者ID:yjduoduo,项目名称:LPC1768_V1.3,代码行数:24,
示例19: get_sort_timedouble get_sort_time(int *pa, int len, void (fsort)(int * , int )){# if 0 // 计时方法1 const clock_t begin = clock(); fsort(pa, len); const clock_t end = clock(); return (double)(end-begin)/CLOCKS_PER_SEC ;#endif#if 0 // 计时方法2 DWORD begin = GetTickCount(); fsort(pa, len); DWORD end = GetTickCount(); return end - begin;#endif StartCounter(); fsort(pa, len); return GetCounter() ; }
开发者ID:xiaoyu1107,项目名称:DATA_STRUCT,代码行数:21,
示例20: InequationCondition*Control::GetRegularDomain(void){Condition* result;if(IsIf() || IsIfElse() || IsWhileLoop()) { if(IsWhileLoop()){ Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(1)); Condition* count_ge_0 = new Condition (ineq); result=new Condition(count_ge_0,FADA_AND,GetCondition()); return result; } return GetCondition(); }if(IsForLoop()){ Inequation* ineq1=new Inequation ( new Expression(GetLoopCounter( )),FADA_GREATER_EQ,GetForLowerBound( )); Inequation* ineq2=new Inequation ( new Expression(GetLoopCounter( )),FADA_LESS_EQ,GetForUpperBound( )); result = new Condition( new Condition(ineq1), FADA_AND , new Condition(ineq2)); return result; }cout<<"/nControl::GetRegularDomain(void) .... inappropriate case /n";throw(10);}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:22,
示例21: GetCounterValues// Use the object index to find the object in the performance data. Then, use the// counter index to find the counter definition. The definition contains the offset// to the counter data in the counter block. The location of the counter block // depends on whether the counter is a single instance counter or multiple instance counter.// After finding the counter block, retrieve the counter data.BOOL GetCounterValues(DWORD dwObjectIndex, DWORD dwCounterIndex, LPWSTR pInstanceName, RAW_DATA* pRawData){ PERF_OBJECT_TYPE* pObject = NULL; PERF_COUNTER_DEFINITION* pCounter = NULL; PERF_COUNTER_BLOCK* pCounterDataBlock = NULL; BOOL fSuccess = FALSE; pObject = GetObject(dwObjectIndex); if (NULL == pObject) { wprintf(L"Object %d not found./n", dwObjectIndex); goto cleanup; } pCounter = GetCounter(pObject, dwCounterIndex); if (NULL == pCounter) { wprintf(L"Counter %d not found./n", dwCounterIndex); goto cleanup; } // Retrieve a pointer to the beginning of the counter data block. The counter data // block contains all the counter data for the object. pCounterDataBlock = GetCounterBlock(pObject, pInstanceName); if (NULL == pCounterDataBlock) { wprintf(L"Instance %s not found./n", pInstanceName); goto cleanup; } ZeroMemory(pRawData, sizeof(RAW_DATA)); pRawData->CounterType = pCounter->CounterType; fSuccess = GetValue(pObject, pCounter, pCounterDataBlock, pRawData);cleanup: return fSuccess;}
开发者ID:scheah,项目名称:os-bench-windows,代码行数:43,
示例22: OP_ASSERTOP_STATUS Counters::SetCounters(HTML_Element* element, CSS_decl* cp, BOOL reset){ if (cp && cp->GetDeclType() == CSS_DECL_GEN_ARRAY) { short gen_arr_len = cp->ArrayValueLen(); const CSS_generic_value* gen_arr = cp->GenArrayValue(); for (int i = 0; i < gen_arr_len; i++) { if (gen_arr[i].value_type == CSS_STRING_LITERAL && gen_arr[i].value.string) { OP_ASSERT(*gen_arr[i].value.string || !"Only non-empty strings (identifiers) should be allowed by the css parser"); Counter* counter = GetCounter(gen_arr[i].value.string, uni_strlen(gen_arr[i].value.string)); if (!counter) { counter = OP_NEW(Counter, (gen_arr[i].value.string)); if (counter) counter->Into(&counter_list); else return OpStatus::ERR_NO_MEMORY; } if (!counter->GetName() || !counter->SetCounter(element, reset ? COUNTER_RESET : COUNTER_INCREMENT, i + 1 < gen_arr_len && gen_arr[i + 1].value_type == CSS_INT_NUMBER ? gen_arr[++i].value.number : (reset ? 0 : 1), add_only)) { counter->Out(); OP_DELETE(counter); return OpStatus::ERR_NO_MEMORY; } } } } return OpStatus::OK;}
开发者ID:prestocore,项目名称:browser,代码行数:37,
示例23: MenuOnKeyvoid MenuOnKey(void){ keys_t cur_key = GetKeys(); unsigned long cur = GetCounter(); if(cur_key == KEY_NONE && gs_menu_level != 0) { if((cur - gs_menu_timer) > 5000) gs_menu_level = 0; return; } gs_menu_timer = cur; switch(gs_menu_level) { case 1: { if(cur_key & KEY_SET) gs_menu_level = cur_key & KEY_LONG ? 0 : 2; else if(cur_key == KEY_MINUS) { if(--gs_menu_param >= MENU_END) gs_menu_param = MENU_END-1; } else if(cur_key == KEY_PLUS) { if(++gs_menu_param >= MENU_END) gs_menu_param = 0; } break; } case 2: { switch(gs_menu_param) { case MENU_PID_LEVEL: MenuFloatOnKey(cur_key, &g_settings.pid_level, 0.1, 0, 100); break; case MENU_PID_DEFAULT_PERCENT: MenuUIntOnKey(cur_key, &g_settings.pid_default_percent, 1, 0, 100); break; case MENU_PID_MLSEC: MenuUIntOnKey(cur_key, &g_settings.pid_mlsec, 100, 100, 60000); break; case MENU_PID_P: MenuFloatOnKey(cur_key, &g_settings.pid_P, 0.1, 0.1, 100); break; case MENU_PID_I: MenuFloatOnKey(cur_key, &g_settings.pid_I, 0.1, 0.1, 1); break; case MENU_PID_D: MenuFloatOnKey(cur_key, &g_settings.pid_D, 0.1, 0.1, 10); break; case MENU_PID_I_LIMIT: MenuFloatOnKey(cur_key, &g_settings.pid_I_limit, 1, 1, 40); break; case MUNU_PWM_MLSEC: MenuUIntOnKey(cur_key, &g_settings.pwm_mlsec, 100, 100, 60000); break; case MENU_CALIBR: if(cur_key == KEY_MINUS || cur_key == KEY_PLUS) gs_menu_param_2 = !gs_menu_param_2; else if(cur_key == KEY_SET) { if(gs_menu_param_2) g_settings.calibr_100 = gs_current_adc; else g_settings.calibr_0 = gs_current_adc; } break; } break; } default: if(cur_key & (KEY_SET | KEY_LONG)) { gs_menu_level = 1; } break; }}
开发者ID:klkn,项目名称:w1209,代码行数:77,
示例24: NormalizeConditionsCondition*Control::GetRegularDomain(int __id, vector<string>* __loop_counters, vector<string>* __param,LDemonstrator* __loop_ppts){vector<string> variables=*__loop_counters;if(IsLoop()) variables.push_back(GetLoopCounter());NormalizeConditions(__id,&variables,__param);switch(GetNonAffineDomain()->size()){ case 0: goto simple_case; case 1: { vector<Inequation*> v=*GetNonAffineDomain()->begin(); if(v.size() <= 1) goto simple_case; } default: goto complicated_case; }simple_case:cout<<"/nSimple case";exit(0);if(IsIf() || IsIfElse() || IsWhileLoop()) { if(IsWhileLoop()){ cout<<"/nComplicated domain"; exit(0); Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(0)); Condition* count_ge_0 = new Condition (ineq); return new Condition(GetCondition(),FADA_AND,count_ge_0); } return GetCondition(); }if(IsForLoop()){ Inequation* ineq1=new Inequation ( new Expression(GetLoopCounter( )),FADA_GREATER_EQ,GetForLowerBound( )); Inequation* ineq2=new Inequation ( new Expression(GetLoopCounter( )),FADA_LESS_EQ,GetForUpperBound( )); return new Condition( new Condition(ineq1), FADA_AND , new Condition(ineq2)); }cout<<"/nControl::GetRegularDomain ... inappropriate case 1";exit(0);complicated_case: cout<<"/nComplicated domain"; exit(0);Condition* result=new Condition(new Inequation(true));for(vector<vector<Inequation*> >::iterator it=GetAffineDomain()->begin(); it != GetAffineDomain()->end(); ++it){ result=new Condition(ToDNFTerm(&(*it)),FADA_AND,result); }if(IsWhileLoop()){ Inequation* ineq=new Inequation(new Expression(GetCounter()),FADA_GREATER_EQ,new Expression(1)); Condition* count_ge_0 = new Condition (ineq); result=new Condition(count_ge_0,FADA_AND,result); }ostringstream ch;ch<<"domain_"<<__id;Expression* non_affine=new Expression(ch.str());for(vector<string>::iterator it=__loop_counters->begin(); it != __loop_counters->end();++it) non_affine->AddArgument(new Expression(*it));if(IsLoop()) non_affine->AddArgument(new Expression(GetLoopCounter()));if(non_affine->IsVariable()) __param->push_back(non_affine->GetVariableName());return new Condition(new Condition(new Inequation(non_affine,FADA_NEQ,new Expression(0))),FADA_AND,result);}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:68,
示例25: updatervoid ExclusivePoolMgr::ExecuteEvent(ExclusivePool& pool){ sLog.outBasic("ExclusivePool: Shuffling pool %u...", pool.poolID); // Get the spawn points and shuffle them. std::vector<ExclusivePoolSpot> poolSpotList; poolSpotList.insert(poolSpotList.begin(), m_poolSpots[pool.poolID].begin(), m_poolSpots[pool.poolID].end()); std::random_shuffle(poolSpotList.begin(), poolSpotList.end()); for (std::pair<const uint32, std::list<ObjectGuid> >& poolPair : pool.m_objects) { // If we have run out of spawn positions we stop spawning creatures. if (poolSpotList.empty()) break; std::list<ObjectGuid> poolObjectList = poolPair.second; // Check if any creatures in the current group are alive. // If they are the group should be skipped. bool foundAlive = false; for (ObjectGuid currentCreature : poolObjectList) { const CreatureData* pData = sObjectMgr.GetCreatureData(currentCreature.GetCounter()); if (pData) { Map* pMap = sMapMgr.FindMap(pData->mapid); if (pMap) { if (!pMap->IsLoaded(pData->posX, pData->posY)) { MaNGOS::ObjectUpdater updater(0); // for creature TypeContainerVisitor<MaNGOS::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater); // for pets TypeContainerVisitor<MaNGOS::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater); // Make sure that the creature is loaded before checking its status. CellPair cellPair = MaNGOS::ComputeCellPair(pData->posX, pData->posY); Cell cell(cellPair); pMap->Visit(cell, grid_object_update); pMap->Visit(cell, world_object_update); } Creature* pCreature = pMap->GetCreature(currentCreature); if (pCreature) { // If the creature is alive or being looted we don't include it in the randomisation. if (pCreature->isAlive() || pCreature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE)) { sLog.outBasic("ExclusivePool: Skipping creature with guid %u.", currentCreature.GetCounter()); auto itr = std::find_if(poolSpotList.begin(), poolSpotList.end(), [&](const ExclusivePoolSpot& spot) { if (spot.x == pData->posX && spot.y == pData->posY && spot.z == pData->posZ && spot.mapID == pData->mapid) { return true; } else return false; }); // If we found the spot on which the living creature is standing // we remove that spot since it's occupied. if (itr != poolSpotList.end()) { poolSpotList.erase(itr); foundAlive = true; } else { sLog.outBasic("ExclusivePool: Could not find the pool position for creature %u. Moving it to avoid double spawns!", currentCreature.GetCounter()); } DespawnAllExcept(poolObjectList, currentCreature); break; } } } } } // If a creature in the current group was alive we skip it. if (foundAlive) continue; // Pick a random creature from the current group. auto itr = poolObjectList.begin(); std::advance(itr, urand(0, poolObjectList.size() - 1)); // Get a spawn point for the creature. ExclusivePoolSpot spot = poolSpotList.back(); poolSpotList.pop_back(); CreatureData& rData = sObjectMgr.mCreatureDataMap[itr->GetCounter()]; // If the creature is already in the correct spot we skip it. if (rData.posX == spot.x && rData.posY == spot.y && //.........这里部分代码省略.........
开发者ID:Phatcat,项目名称:mangos,代码行数:101,
示例26: WaitCounterdouble WaitCounter(double _time){ while ((double)((GetCounter() - i64CounterStart)/PCFreq) < _time); return ((double)GetCounter());} // end WaitCounter()
开发者ID:freesynapse,项目名称:NetworkVisualization,代码行数:6,
示例27: if/********************************************************************************* **** FUNC-NAME : **** **** DESCRIPTION : **** **** PRECONDITIONS : **** **** PARAMETER : **** **** RETURN : **** **** REMARKS : **** *********************************************************************************/StatusType SetAbsAlarm( AlarmType AlarmID, TickType Start, TickType Cycle){ /* /req OSEK_SYS_3.22 The system service StatusType ** SetAbsAlarm ( AlarmType AlarmID, TickType Start, TickType Cycle ) ** shall be defined */ /* /req OSEK_SYS_3.22.3-1/2 Possible return values in Standard mode are E_OK, ** E_OS_STATE */ StatusType ret = E_OK;#if (ERROR_CHECKING_TYPE == ERROR_CHECKING_EXTENDED) /* check if the alarm id is in range */ if(AlarmID >= ALARMS_COUNT) { /* /req OSEK_SYS_3.22.4-1/2 Extra possible return values in Extended mode ** are E_OS_ID, E_OS_VALUE */ ret = E_OS_ID; } /* check that increment and cycle are in range */ else if( (Start > CountersConst[AlarmsConst[AlarmID].Counter].MaxAllowedValue) || ( ( Cycle != 0 ) && ( (Cycle > CountersConst[AlarmsConst[AlarmID].Counter].MaxAllowedValue) || (Cycle < CountersConst[AlarmsConst[AlarmID].Counter].MinCycle) ) ) ) { /* /req OSEK_SYS_3.22.4-2/2 Extra possible return values in Extended mode ** are E_OS_ID, E_OS_VALUE */ ret = E_OS_VALUE; } else#endif /* check if the alarm is disable */ if(AlarmsVar[AlarmID].AlarmState != 0) { /* /req OSEK_SYS_3.22.3-2/2 Possible return values in Standard mode are E_OK, ** E_OS_STATE */ ret = E_OS_STATE; } else { IntSecure_Start(); /* enable alarm */ AlarmsVar[AlarmID].AlarmState = 1; /* set abs alarm */ AlarmsVar[AlarmID].AlarmTime = GetCounter(AlarmsConst[AlarmID].Counter) + Start; AlarmsVar[AlarmID].AlarmCycleTime = Cycle; IntSecure_End(); }#if (HOOK_ERRORHOOK == ENABLE) /* /req OSEK_ERR_1.3-14/xx The ErrorHook hook routine shall be called if a ** system service returns a StatusType value not equal to E_OK.*/ /* /req OSEK_ERR_1.3.1-14/xx The hook routine ErrorHook is not called if a ** system service is called from the ErrorHook itself. */ if ( ( ret != E_OK ) && (ErrorHookRunning != 1)) { SetError_Api(OSServiceId_SetAbsAlarm); SetError_Param1(AlarmID); SetError_Param2(Start); SetError_Param3(Cycle); SetError_Ret(ret); SetError_Msg("SetAbsAlarm returns != than E_OK"); SetError_ErrorHook(); }#endif return ret;}
开发者ID:janiex,项目名称:OSEK_GENERATOR,代码行数:91,
注:本文中的GetCounter函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetCreateHealth函数代码示例 C++ GetCount函数代码示例 |