30int main(
int argc,
char **argv)
43 JParser<> zap(
"Auxiliary program to monitor memory and CPU usage of process.");
46 zap[
'P'] =
make_field(process,
"name of process");
47 zap[
'T'] =
make_field(T_us,
"interval time [us]") = 100000;
48 zap[
'u'] =
make_field(interactive,
"run in interactive mode");
53 catch(
const exception &error) {
54 FATAL(error.what() << endl);
60 const char QUIT =
'q';
63 cout <<
"Press '" << QUIT <<
"' to quit." << endl;
68 for (
int i = 0; ;++i) {
72 pid = getPID(shell, process.c_str());
76 catch(
const exception& error) {
78 if (interactive ||
debug >= debug_t) {
79 cout <<
"No process " << setw(8) << i << endl;
83 if (keypress.
get() == QUIT && interactive) {
90 NOTICE(
"Process identifier " << pid << endl);
93 FATAL(
"Invalid process identifier " << pid << endl);
96 TH1D h0(
"h0", NULL, 101,-0.5, 100.5);
97 TH1D h1(
"h1", NULL, 1001,-0.5, 1000.5);
105 for (
int i = 0; ;++i) {
109 const double t1 = double (getLocalTime() - t0) * 1.0e-6;
110 const double mem = getMemoryUsage(shell, pid);
111 const double cpu = getCpuUsage (shell, pid);
120 if (interactive ||
debug >= debug_t) {
121 cout << setw(8) << i <<
' ' <<
FIXED(12,3) << t1 <<
' ' <<
FIXED(7,3) << mem <<
' ' <<
FIXED(7,3) << cpu << endl;
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());