int parsing(char *string,LinkPtr headContact,LinkPtr headCallLog) { int i=0,j=0,k=0; k=11; j=k; k=j; char *choice; choice=strtok(string," "); if(strcmp(choice,"cpu")==0) { getCpuLoad(headContact,headCallLog); return 0; } UartPrint("\r\n"); for(i=0;i<9;i++) { if(strcmp(array[i],choice)==0) { funRetValue=ptrFxn[i].fun(headContact,headCallLog); strcpy(previousCommand,choice); return 0; } } printingError(6); return 0; }
int calcLoad(){ uint32_t queuelen; double cpuload, load; queuelen = (uint32_t)readFormattedCounter("\\System\\Processor Queue Length"); cpuload = getCpuLoad(); if(queuelen > 2) load = cpuload + queuelen - 2; else load = cpuload; load_1 = load_1 * 0.9200 + load * 0.0800; load_5 = load_5 * 0.9835 + load * 0.0165; load_15 = load_15 * 0.9945 + load * 0.0055; return 0; }
int QgcsThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QQuickItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 37) qt_static_metacall(this, _c, _id, _a); _id -= 37; } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) { if (_id < 37) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 37; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< int*>(_v) = getAPStatus(); break; case 1: *reinterpret_cast< double*>(_v) = getVoltage(); break; case 2: *reinterpret_cast< double*>(_v) = getCpuLoad(); break; case 3: *reinterpret_cast< QString*>(_v) = getStatus(); break; case 4: *reinterpret_cast< QString*>(_v) = getUartStatus(); break; case 5: *reinterpret_cast< QString*>(_v) = getViconStatus(); break; case 6: *reinterpret_cast< QString*>(_v) = getCurrMode(); break; case 7: *reinterpret_cast< double*>(_v) = getState(); break; case 8: *reinterpret_cast< double*>(_v) = getInput(); break; case 9: *reinterpret_cast< double*>(_v) = getVicon(); break; case 10: *reinterpret_cast< double*>(_v) = getImu(); break; case 11: *reinterpret_cast< double*>(_v) = getDMC(); break; case 12: *reinterpret_cast< QString*>(_v) = getDesMode(); break; case 13: *reinterpret_cast< bool*>(_v) = haveNewFrame(); break; default: break; } _id -= 14; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 12: setDesMode(*reinterpret_cast< QString*>(_v)); break; default: break; } _id -= 14; } else if (_c == QMetaObject::ResetProperty) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 14; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 14; } else if (_c == QMetaObject::RegisterPropertyMetaType) { if (_id < 14) *reinterpret_cast<int*>(_a[0]) = -1; _id -= 14; } #endif // QT_NO_PROPERTIES return _id; }