alnzng commented on code in PR #1636:
URL: https://github.com/apache/samza/pull/1636#discussion_r1014527935
##########
samza-core/src/main/java/org/apache/samza/container/host/PosixCommandBasedStatisticsGetter.java:
##########
@@ -85,4 +86,10 @@ public SystemMemoryStatistics getSystemMemoryStatistics() {
return null;
}
}
+
+ @Override
+ public ProcessCPUStatistics getProcessCPUStatistics() {
+ throw new NotImplementedException(
+ "No appropriate Posix command available for getting recent CPU usage
information. For example, the CPU information exposed by ps command 'ps -o
%cpu= -p <PID>' represents the percentage of time spent running during the
entire lifetime of a process not for the recent CPU usage");
+ }
Review Comment:
Yes, `top` can give the instant/recent CPU usage information for a given
process, but it has below cons so that I didn't choose it:
- Need to have operating system specific implementation, since the top
command is not a POSIX command and its input and output format in Linux and
macOS are different.
- Slower than ps command. Especially, on macOS the top command needs to get
at least two samples to get the right CPU usage, which takes longer time(~ 2
seconds) than 1 sample.
- not clear the reason, but it shows the consistent behavior that one
sample(-l1) always return 0.0 on my macOS
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]