git-svn-id: svn://db.shs.com.ru/pip@689 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -109,13 +109,20 @@ bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
|
|||||||
#endif
|
#endif
|
||||||
return start(interval_ms);
|
return start(interval_ms);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool PISystemMonitor::startOnSelf(int interval_ms) {
|
bool PISystemMonitor::startOnSelf(int interval_ms) {
|
||||||
|
#ifdef FREERTOS
|
||||||
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
|
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
|
||||||
|
#else
|
||||||
|
self_ = false;
|
||||||
|
cycle = -1;
|
||||||
|
ret = start(interval_ms);
|
||||||
|
#endif
|
||||||
self_ = true;
|
self_ = true;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
|
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
|
||||||
mutex_.lock();
|
mutex_.lock();
|
||||||
@@ -153,6 +160,7 @@ void PISystemMonitor::run() {
|
|||||||
if (t->isPIObject())
|
if (t->isPIObject())
|
||||||
tbid[t->tid()] = t->name();
|
tbid[t->tid()] = t->name();
|
||||||
pitc->unlock();
|
pitc->unlock();
|
||||||
|
#ifndef FREERTOS
|
||||||
//piCout << tbid.keys().toType<uint>();
|
//piCout << tbid.keys().toType<uint>();
|
||||||
stat.ID = pID_;
|
stat.ID = pID_;
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
@@ -289,6 +297,7 @@ void PISystemMonitor::run() {
|
|||||||
stat.cpu_load_user = 0.f;
|
stat.cpu_load_user = 0.f;
|
||||||
}
|
}
|
||||||
PRIVATE->tm.reset();
|
PRIVATE->tm.reset();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stat.cpu_load_system = piClampf(stat.cpu_load_system, 0.f, 100.f);
|
stat.cpu_load_system = piClampf(stat.cpu_load_system, 0.f, 100.f);
|
||||||
@@ -325,6 +334,7 @@ void PISystemMonitor::gatherThread(llong id) {
|
|||||||
PISystemMonitor::ThreadStats ts;
|
PISystemMonitor::ThreadStats ts;
|
||||||
ts.id = id;
|
ts.id = id;
|
||||||
ts.name = tbid.value(id, "<non-PIThread>");
|
ts.name = tbid.value(id, "<non-PIThread>");
|
||||||
|
#ifndef FREERTOS
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
||||||
//piCout << f.path();
|
//piCout << f.path();
|
||||||
@@ -363,6 +373,7 @@ void PISystemMonitor::gatherThread(llong id) {
|
|||||||
ts.work_time = ct - ts.created.toSystemTime();
|
ts.work_time = ct - ts.created.toSystemTime();
|
||||||
ts.kernel_time = FILETIME2PISystemTime(times[2]);
|
ts.kernel_time = FILETIME2PISystemTime(times[2]);
|
||||||
ts.user_time = FILETIME2PISystemTime(times[3]);
|
ts.user_time = FILETIME2PISystemTime(times[3]);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
//cur_ts << ts;
|
//cur_ts << ts;
|
||||||
cur_tm[id] = ts;
|
cur_tm[id] = ts;
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ public:
|
|||||||
};
|
};
|
||||||
#ifndef FREERTOS
|
#ifndef FREERTOS
|
||||||
bool startOnProcess(int pID, int interval_ms = 1000);
|
bool startOnProcess(int pID, int interval_ms = 1000);
|
||||||
bool startOnSelf(int interval_ms = 1000);
|
|
||||||
#endif
|
#endif
|
||||||
|
bool startOnSelf(int interval_ms = 1000);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
const ProcessStats & statistic() const {return stat;}
|
const ProcessStats & statistic() const {return stat;}
|
||||||
|
|||||||
Reference in New Issue
Block a user