|
@@ -10,7 +10,7 @@
|
|
#define _IS_POWER_OF_2(x) (!!(x) && !((x) & ((x) - 1)))
|
|
#define _IS_POWER_OF_2(x) (!!(x) && !((x) & ((x) - 1)))
|
|
#define _IS_VALID_APP_ID(i) _IS_POWER_OF_2(i)
|
|
#define _IS_VALID_APP_ID(i) _IS_POWER_OF_2(i)
|
|
#define _TIMESPEC_2_US(ts) (((clock64_t)(ts).tv_sec) * 1000000LL + ((clock64_t)(ts).tv_nsec) / 1000LL)
|
|
#define _TIMESPEC_2_US(ts) (((clock64_t)(ts).tv_sec) * 1000000LL + ((clock64_t)(ts).tv_nsec) / 1000LL)
|
|
-#define _TIMESPEC_DIFF(ts1, ts2) (_TIMESPEC_2_US(ts1) - _TIMESPEC_2_US(ts2))
|
|
|
|
|
|
+#define _TIMESPEC_DIFF_US(ts1, ts2) (_TIMESPEC_2_US(ts1) - _TIMESPEC_2_US(ts2))
|
|
#define _MIN_TIMER_INT 20
|
|
#define _MIN_TIMER_INT 20
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
@@ -20,9 +20,13 @@
|
|
QGfaAppInfo::QGfaAppInfo(int nIndex, QObject *pParent) : QObject(pParent),
|
|
QGfaAppInfo::QGfaAppInfo(int nIndex, QObject *pParent) : QObject(pParent),
|
|
m_state(GIAS_StateNotRunning),
|
|
m_state(GIAS_StateNotRunning),
|
|
m_nIndex(nIndex),
|
|
m_nIndex(nIndex),
|
|
|
|
+ m_cycInt(0),
|
|
m_cycCur(0),
|
|
m_cycCur(0),
|
|
m_cycMin(0),
|
|
m_cycMin(0),
|
|
m_cycMax(0),
|
|
m_cycMax(0),
|
|
|
|
+ m_wktCur(0),
|
|
|
|
+ m_wktMin(0),
|
|
|
|
+ m_wktMax(0),
|
|
m_upTime(0),
|
|
m_upTime(0),
|
|
m_cpuTime(0.0),
|
|
m_cpuTime(0.0),
|
|
m_cpuPercCur(0.0),
|
|
m_cpuPercCur(0.0),
|
|
@@ -92,6 +96,11 @@ void QGfaAppInfo::setName(const QString &val)
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
+quint64 QGfaAppInfo::cycInt(void) const
|
|
|
|
+{
|
|
|
|
+ return m_cycInt;
|
|
|
|
+}
|
|
|
|
+
|
|
quint64 QGfaAppInfo::cycCur(void) const
|
|
quint64 QGfaAppInfo::cycCur(void) const
|
|
{
|
|
{
|
|
return m_cycCur;
|
|
return m_cycCur;
|
|
@@ -107,6 +116,23 @@ quint64 QGfaAppInfo::cycMax(void) const
|
|
return m_cycMax;
|
|
return m_cycMax;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+quint64 QGfaAppInfo::wktCur(void) const
|
|
|
|
+{
|
|
|
|
+ return m_wktCur;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+quint64 QGfaAppInfo::wktMin(void) const
|
|
|
|
+{
|
|
|
|
+ return m_wktMin;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+quint64 QGfaAppInfo::wktMax(void) const
|
|
|
|
+{
|
|
|
|
+ return m_wktMax;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
quint64 QGfaAppInfo::upTime(void) const
|
|
quint64 QGfaAppInfo::upTime(void) const
|
|
{
|
|
{
|
|
return m_upTime;
|
|
return m_upTime;
|
|
@@ -131,6 +157,12 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
{
|
|
{
|
|
if(pat)
|
|
if(pat)
|
|
{
|
|
{
|
|
|
|
+ if(m_cycInt != (quint64)pat->nCyclePresetUs)
|
|
|
|
+ {
|
|
|
|
+ m_cycInt = (quint64)pat->nCyclePresetUs;
|
|
|
|
+ emit cycIntChanged(m_cycInt);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(state == GIAS_Running)
|
|
if(state == GIAS_Running)
|
|
{
|
|
{
|
|
if(m_cycMin != (quint64)pat->nCycleMinUs)
|
|
if(m_cycMin != (quint64)pat->nCycleMinUs)
|
|
@@ -144,6 +176,18 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
m_cycMax = (quint64)pat->nCycleMaxUs;
|
|
m_cycMax = (quint64)pat->nCycleMaxUs;
|
|
emit cycMaxChanged(m_cycMax);
|
|
emit cycMaxChanged(m_cycMax);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(m_wktMin != (quint64)pat->nWorkMinUs)
|
|
|
|
+ {
|
|
|
|
+ m_wktMin = (quint64)pat->nWorkMinUs;
|
|
|
|
+ emit wktMinChanged(m_wktMin);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(m_wktMax != (quint64)pat->nWorkMaxUs)
|
|
|
|
+ {
|
|
|
|
+ m_wktMax = (quint64)pat->nWorkMaxUs;
|
|
|
|
+ emit wktMaxChanged(m_wktMax);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -152,6 +196,12 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
m_cycCur = 0;
|
|
m_cycCur = 0;
|
|
emit cycCurChanged(m_cycCur);
|
|
emit cycCurChanged(m_cycCur);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(m_wktCur != 0)
|
|
|
|
+ {
|
|
|
|
+ m_wktCur = 0;
|
|
|
|
+ emit wktCurChanged(m_wktCur);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if(bDoHeavyLoadUpdate)
|
|
if(bDoHeavyLoadUpdate)
|
|
@@ -171,6 +221,12 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
m_cycCur = (quint64)pat->nCycleLastUs;
|
|
m_cycCur = (quint64)pat->nCycleLastUs;
|
|
emit cycCurChanged(m_cycCur);
|
|
emit cycCurChanged(m_cycCur);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(m_wktCur != (quint64)pat->nWorkLastUs)
|
|
|
|
+ {
|
|
|
|
+ m_wktCur = (quint64)pat->nWorkLastUs;
|
|
|
|
+ emit wktCurChanged(m_wktCur);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if(state != GIAS_Hanging)
|
|
if(state != GIAS_Hanging)
|
|
@@ -197,12 +253,24 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ if(m_cycInt != 0)
|
|
|
|
+ {
|
|
|
|
+ m_cycInt = 0;
|
|
|
|
+ emit cycIntChanged(m_cycInt);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(m_cycCur != 0)
|
|
if(m_cycCur != 0)
|
|
{
|
|
{
|
|
m_cycCur = 0;
|
|
m_cycCur = 0;
|
|
emit cycCurChanged(m_cycCur);
|
|
emit cycCurChanged(m_cycCur);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(m_wktCur != 0)
|
|
|
|
+ {
|
|
|
|
+ m_wktCur = 0;
|
|
|
|
+ emit wktCurChanged(m_wktCur);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(state == GIAS_Hanging)
|
|
if(state == GIAS_Hanging)
|
|
{
|
|
{
|
|
if(m_cpuTime != -1)
|
|
if(m_cpuTime != -1)
|
|
@@ -237,6 +305,18 @@ void QGfaAppInfo::setAppTimes(LPCGFA_APPCTRL_APPTIMES pat, GfaIpcAppStates state
|
|
emit cycMaxChanged(m_cycMax);
|
|
emit cycMaxChanged(m_cycMax);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(m_wktMin != 0)
|
|
|
|
+ {
|
|
|
|
+ m_wktMin = 0;
|
|
|
|
+ emit wktMinChanged(m_wktMin);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(m_wktMax != 0)
|
|
|
|
+ {
|
|
|
|
+ m_wktMax = 0;
|
|
|
|
+ emit wktMaxChanged(m_wktMax);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(m_upTime != 0)
|
|
if(m_upTime != 0)
|
|
{
|
|
{
|
|
m_upTime = 0;
|
|
m_upTime = 0;
|
|
@@ -330,7 +410,7 @@ bool QGfaAppCtrl::Create(appid_t nAppID, const char *pszDisplayName, int nTimerI
|
|
if(nHeavyLoadUpdateIntervalMs < (nTimerIntMs * 50))
|
|
if(nHeavyLoadUpdateIntervalMs < (nTimerIntMs * 50))
|
|
nHeavyLoadUpdateIntervalMs = (nTimerIntMs * 50);
|
|
nHeavyLoadUpdateIntervalMs = (nTimerIntMs * 50);
|
|
|
|
|
|
- if((m_hAC = ::GfaIpcAppCtrlAcquire(nAppID, pszDisplayName, (clock64_t)(nTimerIntMs * 1000 * 2))))
|
|
|
|
|
|
+ if((m_hAC = ::GfaIpcAppCtrlAcquire(nAppID, pszDisplayName, 0, (clock64_t)(nTimerIntMs * 1000 * 2))))
|
|
{
|
|
{
|
|
m_nAppID = nAppID;
|
|
m_nAppID = nAppID;
|
|
m_nHeavyLoadUpdateIntervalUs = nHeavyLoadUpdateIntervalMs * 1000;
|
|
m_nHeavyLoadUpdateIntervalUs = nHeavyLoadUpdateIntervalMs * 1000;
|
|
@@ -388,6 +468,7 @@ bool QGfaAppCtrl::SubscribeStateEvents(appid_t nAppMask)
|
|
|
|
|
|
void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
{
|
|
{
|
|
|
|
+ static clock64_t nCurPass = 0;
|
|
struct timespec tsEnterUpdate, tsLeaveUpdate;
|
|
struct timespec tsEnterUpdate, tsLeaveUpdate;
|
|
::clock_gettime(CLOCK_MONOTONIC, &tsEnterUpdate);
|
|
::clock_gettime(CLOCK_MONOTONIC, &tsEnterUpdate);
|
|
|
|
|
|
@@ -395,7 +476,7 @@ void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
{
|
|
{
|
|
HAPPINFO hAI;
|
|
HAPPINFO hAI;
|
|
|
|
|
|
- if((hAI = ::GfaIpcAppCtrlInfoUpdate(m_hAC)))
|
|
|
|
|
|
+ if((hAI = ::GfaIpcAppCtrlInfoUpdate(m_hAC, nCurPass)))
|
|
{
|
|
{
|
|
int b;
|
|
int b;
|
|
appid_t app, nAppIdSrc;
|
|
appid_t app, nAppIdSrc;
|
|
@@ -445,7 +526,7 @@ void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
}
|
|
}
|
|
|
|
|
|
nAppIdSrc = m_nEvtSrcs;
|
|
nAppIdSrc = m_nEvtSrcs;
|
|
- bool bDontSaveLast = false, bUpdate = (_TIMESPEC_DIFF(tsEnterUpdate, m_tsLastHeavyLoadUpdate) >= m_nHeavyLoadUpdateIntervalUs);
|
|
|
|
|
|
+ bool bDontSaveLast = false, bUpdate = (_TIMESPEC_DIFF_US(tsEnterUpdate, m_tsLastHeavyLoadUpdate) >= m_nHeavyLoadUpdateIntervalUs);
|
|
|
|
|
|
while(nAppIdSrc)
|
|
while(nAppIdSrc)
|
|
{
|
|
{
|
|
@@ -473,7 +554,7 @@ void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
}
|
|
}
|
|
|
|
|
|
::clock_gettime(CLOCK_MONOTONIC, &tsLeaveUpdate);
|
|
::clock_gettime(CLOCK_MONOTONIC, &tsLeaveUpdate);
|
|
- m_curPass = _TIMESPEC_DIFF(tsLeaveUpdate, tsEnterUpdate);
|
|
|
|
|
|
+ m_curPass = nCurPass = _TIMESPEC_DIFF_US(tsLeaveUpdate, tsEnterUpdate);
|
|
|
|
|
|
if(m_minPass > m_curPass)
|
|
if(m_minPass > m_curPass)
|
|
{
|
|
{
|
|
@@ -496,8 +577,8 @@ void QGfaAppCtrl::timerEvent(QTimerEvent *event)
|
|
{
|
|
{
|
|
static uint64_t nPasses = 0;
|
|
static uint64_t nPasses = 0;
|
|
++nPasses;
|
|
++nPasses;
|
|
-// clock64_t avgPass = (m_avgPass + m_curPass) / 2;
|
|
|
|
- clock64_t avgPass = (clock64_t)sqrt(double((m_avgPass * m_avgPass + m_curPass * m_curPass) / 2));
|
|
|
|
|
|
+ clock64_t avgPass = (m_avgPass + m_curPass) / 2;
|
|
|
|
+// clock64_t avgPass = (clock64_t)sqrt(double((m_avgPass * m_avgPass + m_curPass * m_curPass) / 2));
|
|
if(m_avgPass != avgPass)
|
|
if(m_avgPass != avgPass)
|
|
{
|
|
{
|
|
m_avgPass = avgPass;
|
|
m_avgPass = avgPass;
|