15.10.2012 - version 0.2.0 - PIIODevice - base of file, ethernet, serial and packets extractor. PIEthernet now support also TCP (client and server). PIConsole now can align labels in each column individually.

This commit is contained in:
peri4
2012-10-15 23:36:18 +04:00
parent 5558add03e
commit cfc5eed75e
64 changed files with 1879 additions and 867 deletions

12
pisystemmonitor.cpp Normal file → Executable file
View File

@@ -1,7 +1,7 @@
/*
PIP - Platform Independent Primitives
Process resource monitor
Copyright (C) 2011 Ivan Pelipenko peri4ko@gmail.com
Copyright (C) 2012 Ivan Pelipenko peri4ko@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -39,10 +39,10 @@ bool PISystemMonitor::startOnProcess(int pID) {
stop();
pID_ = pID;
#ifndef WINDOWS
file.open("/proc/" + PIString::fromNumber(pID_) + "/stat", PIFile::Read);
filem.open("/proc/" + PIString::fromNumber(pID_) + "/statm", PIFile::Read);
file.open("/proc/" + PIString::fromNumber(pID_) + "/stat", PIIODevice::ReadOnly);
filem.open("/proc/" + PIString::fromNumber(pID_) + "/statm", PIIODevice::ReadOnly);
if (!file.isOpened()) {
cout << "[PISystemMonitor] Can`t find process with ID = " << pID_ << "!" << endl;
piCout << "[PISystemMonitor] Can`t find process with ID = " << pID_ << "!" << endl;
return false;
}
cycle = -1;
@@ -92,7 +92,7 @@ void PISystemMonitor::run() {
}
stat.priority = sl[16].toInt();
stat.threads = sl[18].toInt();
str = filem.readAll(true);
sl = str.split(" ");
if (sl.size_s() < 5) return;
@@ -101,7 +101,7 @@ void PISystemMonitor::run() {
stat.share_memsize = sl[2].toLong() * page_size;
stat.data_memsize = sl[5].toLong() * page_size;
stat.physical_memsize = stat.resident_memsize - stat.share_memsize;
stat.physical_memsize_readable = PIString::readableSize(stat.physical_memsize);
stat.resident_memsize_readable = PIString::readableSize(stat.resident_memsize);
stat.share_memsize_readable = PIString::readableSize(stat.share_memsize);