31 int main(
int argc,
char **argv)
44 JParser<> zap(
"Auxiliary program to monitor memory and CPU usage of process.");
47 zap[
'P'] =
make_field(process,
"name of process");
48 zap[
'T'] =
make_field(T_us,
"interval time [us]") = 100000;
49 zap[
'u'] =
make_field(interactive,
"run in interactive mode");
54 catch(
const exception &error) {
55 FATAL(error.what() << endl);
59 JKeypress keypress(
false);
61 const char QUIT =
'q';
64 cout <<
"Press '" << QUIT <<
"' to quit." << endl;
69 for (
int i = 0; ;++i) {
73 pid =
getPID(shell, process.c_str());
77 catch(
const exception& error) {
80 cout <<
"No process " << setw(8) << i << endl;
83 if (keypress.timeout(T_us)) {
84 if (keypress.get() == QUIT && interactive) {
91 NOTICE(
"Process identifier " << pid << endl);
94 FATAL(
"Invalid process identifier " << pid << endl);
97 TH1D h0(
"h0", NULL, 101,-0.5, 100.5);
98 TH1D h1(
"h1", NULL, 101,-0.5, 100.5);
106 for (
int i = 0; ;++i) {
121 cout << setw(8) << i <<
' ' <<
FIXED(7,3) << mem <<
' ' <<
FIXED(7,3) << cpu << endl;
124 if (keypress.timeout(T_us)) {
125 if (keypress.get() == QUIT && interactive) {
130 catch(
const exception& error) {
136 TGraph g0(X.size(), X.data(), Y.data());
137 TGraph
g1(X.size(), X.data(), Z.data());