31{
34
36 string process;
40
41 try {
42
43 JParser<> zap(
"Auxiliary program to monitor memory and CPU usage of process.");
44
50
52 }
53 catch(const exception &error) {
55 }
56
59
60 const char QUIT =
'q';
61
64 }
65
66 int pid = -1;
67
68 for (int i = 0; ;++i) {
69
70 try {
71
73
74 break;
75 }
76 catch(const exception& error) {
77
80 }
81
84 break;
85 }
86 }
87 }
88 }
89
91
92 if (pid == -1) {
93 FATAL(
"Invalid process identifier " << pid <<
endl);
94 }
95
96 TH1D h0(
"h0",
NULL, 101,-0.5, 100.5);
97 TH1D h1(
"h1",
NULL, 1001,-0.5, 1000.5);
98
102
104
105 for (int i = 0; ;++i) {
106
107 try {
108
109 const double t1 =
double (getLocalTime() - t0) * 1.0e-6;
112
114 h1.Fill(cpu);
115
116 X.push_back(t1);
118 Z.push_back(cpu);
119
122 }
123
126 break;
127 }
128 }
129 }
130 catch(const exception& error) {
131 break;
132 }
133 }
134
135
136 TGraph
g0(X.size(), X.data(), Y.data());
137 TGraph
g1(X.size(), X.data(), Z.data());
138
141
143
144 out << h0 << h1;
146
147 out.Write();
148 out.Close();
149}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define MAKE_CSTRING(A)
Make C-string.
Double_t g1(const Double_t x)
Function.
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
Enable unbuffered terminal input.
The JShell clas can be used to interact with the shell via I/O streams.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
float getMemoryUsage(JShell &shell, const pid_t pid)
Get memory usage in percent of given process identifier.
float getCpuUsage(JShell &shell, const pid_t pid)
Get cpu usage in percent of given process identifier.
pid_t getPID(JShell &shell, const char *process)
Get process identifier.
Auxiliary data structure for floating point format specification.