diff --git a/src_main/system/pisystemmonitor.cpp b/src_main/system/pisystemmonitor.cpp index 18e3a281..9051949c 100755 --- a/src_main/system/pisystemmonitor.cpp +++ b/src_main/system/pisystemmonitor.cpp @@ -375,7 +375,8 @@ void PISystemMonitor::gatherThread(llong id) { ts.name = tbid.value(id, ""); #else ts.name = tbid.value(id, ""); -#ifndef WINDOWS + PISystemTime ct = PISystemTime::current(); +# ifndef WINDOWS PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat"); //piCout << f.path(); if (!f.open(PIIODevice::ReadOnly)) @@ -394,11 +395,11 @@ void PISystemMonitor::gatherThread(llong id) { PIStringList sl = str.split(" "); if (sl.size_s() < 14) return; //piCout << sl[0] << sl[12] << sl[13]; + ts.work_time = ct - ts.created.toSystemTime(); ts.user_time = PISystemTime::fromMilliseconds(sl[12].toInt() * 10.); ts.kernel_time = PISystemTime::fromMilliseconds(sl[13].toInt() * 10.); -#else +# else FILETIME times[4]; - PISystemTime ct = PISystemTime::current(); HANDLE thdl = OpenThread(THREAD_QUERY_INFORMATION, FALSE, DWORD(id)); if (thdl == NULL) { piCout << "[PISystemMonitor] gatherThread(" << id << "):: OpenThread() error:" << errorString(); @@ -413,7 +414,7 @@ void PISystemMonitor::gatherThread(llong id) { ts.work_time = ct - ts.created.toSystemTime(); ts.kernel_time = FILETIME2PISystemTime(times[2]); ts.user_time = FILETIME2PISystemTime(times[3]); -#endif +# endif #endif //cur_ts << ts; cur_tm[id] = ts; diff --git a/utils/system_daemon/main.cpp b/utils/system_daemon/main.cpp index 9a8b449e..a2c432b8 100755 --- a/utils/system_daemon/main.cpp +++ b/utils/system_daemon/main.cpp @@ -338,6 +338,7 @@ void usage() { int main(int argc, char * argv[]) { + sys_mon.startOnSelf(); PIINTROSPECTION_START //piDebug = false; PICLI cli(argc, argv); @@ -395,7 +396,6 @@ int main(int argc, char * argv[]) { screen->setMouseEnabled(true); Daemon * daemon = new Daemon(); if (!sip.isEmpty()) daemon->setTcpServerIP(sip); - sys_mon.startOnSelf(); //sys_mon.startOnProcess(12404); screen->enableExitCapture(PIKbdListener::F10); if (!name.isEmpty())