git-svn-id: svn://db.shs.com.ru/pip@820 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -375,7 +375,8 @@ void PISystemMonitor::gatherThread(llong id) {
|
|||||||
ts.name = tbid.value(id, "<PIThread>");
|
ts.name = tbid.value(id, "<PIThread>");
|
||||||
#else
|
#else
|
||||||
ts.name = tbid.value(id, "<non-PIThread>");
|
ts.name = tbid.value(id, "<non-PIThread>");
|
||||||
#ifndef WINDOWS
|
PISystemTime ct = PISystemTime::current();
|
||||||
|
# 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();
|
||||||
if (!f.open(PIIODevice::ReadOnly))
|
if (!f.open(PIIODevice::ReadOnly))
|
||||||
@@ -394,11 +395,11 @@ void PISystemMonitor::gatherThread(llong id) {
|
|||||||
PIStringList sl = str.split(" ");
|
PIStringList sl = str.split(" ");
|
||||||
if (sl.size_s() < 14) return;
|
if (sl.size_s() < 14) return;
|
||||||
//piCout << sl[0] << sl[12] << sl[13];
|
//piCout << sl[0] << sl[12] << sl[13];
|
||||||
|
ts.work_time = ct - ts.created.toSystemTime();
|
||||||
ts.user_time = PISystemTime::fromMilliseconds(sl[12].toInt() * 10.);
|
ts.user_time = PISystemTime::fromMilliseconds(sl[12].toInt() * 10.);
|
||||||
ts.kernel_time = PISystemTime::fromMilliseconds(sl[13].toInt() * 10.);
|
ts.kernel_time = PISystemTime::fromMilliseconds(sl[13].toInt() * 10.);
|
||||||
#else
|
# else
|
||||||
FILETIME times[4];
|
FILETIME times[4];
|
||||||
PISystemTime ct = PISystemTime::current();
|
|
||||||
HANDLE thdl = OpenThread(THREAD_QUERY_INFORMATION, FALSE, DWORD(id));
|
HANDLE thdl = OpenThread(THREAD_QUERY_INFORMATION, FALSE, DWORD(id));
|
||||||
if (thdl == NULL) {
|
if (thdl == NULL) {
|
||||||
piCout << "[PISystemMonitor] gatherThread(" << id << "):: OpenThread() error:" << errorString();
|
piCout << "[PISystemMonitor] gatherThread(" << id << "):: OpenThread() error:" << errorString();
|
||||||
@@ -413,7 +414,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
|
#endif
|
||||||
//cur_ts << ts;
|
//cur_ts << ts;
|
||||||
cur_tm[id] = ts;
|
cur_tm[id] = ts;
|
||||||
|
|||||||
@@ -338,6 +338,7 @@ void usage() {
|
|||||||
|
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
|
sys_mon.startOnSelf();
|
||||||
PIINTROSPECTION_START
|
PIINTROSPECTION_START
|
||||||
//piDebug = false;
|
//piDebug = false;
|
||||||
PICLI cli(argc, argv);
|
PICLI cli(argc, argv);
|
||||||
@@ -395,7 +396,6 @@ int main(int argc, char * argv[]) {
|
|||||||
screen->setMouseEnabled(true);
|
screen->setMouseEnabled(true);
|
||||||
Daemon * daemon = new Daemon();
|
Daemon * daemon = new Daemon();
|
||||||
if (!sip.isEmpty()) daemon->setTcpServerIP(sip);
|
if (!sip.isEmpty()) daemon->setTcpServerIP(sip);
|
||||||
sys_mon.startOnSelf();
|
|
||||||
//sys_mon.startOnProcess(12404);
|
//sys_mon.startOnProcess(12404);
|
||||||
screen->enableExitCapture(PIKbdListener::F10);
|
screen->enableExitCapture(PIKbdListener::F10);
|
||||||
if (!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
|
|||||||
Reference in New Issue
Block a user