Commit 80774861 authored by Yixian Jiang's avatar Yixian Jiang Committed by Facebook Github Bot

Remove dependency on fbzmq::ResourceMonitor & sigar

Summary:
Replace the methods to get CPU and memory usage statistics:
- For the memory: use `VmRSS` of `/proc/[pid]/status`: http://man7.org/linux/man-pages/man5/proc.5.html
- For the CPU%: calculate the process is occupied how much percentage of the CPU time, use `getrusage()`: http://man7.org/linux/man-pages/man2/getrusage.2.html
   - Implemented like the sigar: https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/third-party/sigar/src/sigar.c?commit=4f945812675131ea64cb3d143350b1414f34a351&lines=111-169
  - Formula:
    - CPU% = `process used time` during the period / `time period` * 100
    -  `time period` = current query timestamp - last query timestamp
    - `process used time` = current `process total time` - last query `process total time`
    - `process total time` = CPU time used in user mode + CPU time used in system mode // get from the API `ru_utime` and `ru_stime`

Remove the `fbzmq::ResourceMonitor` and `sigar`:
- Change and rename the UT
  - `ResourceMonitorTest.cpp` -> `SystemMetricsTest.cpp`
  - `ResourceMonitor` -> `SystemMetricsTest` in `openr/tests/OpenrSystemTest.cpp`
- Remove `ResourceMonitor` code and dependency for `Watchdog` and `ZmqMonitor`
- Remove `sigar` dependency used in building

Reviewed By: saifhhasan

Differential Revision: D20049944

fbshipit-source-id: 00b90c8558dc5f0fb18cc31a09b9666a47b096fe
parent 27d015c7
...@@ -20,7 +20,6 @@ boost ...@@ -20,7 +20,6 @@ boost
folly folly
fbthrift fbthrift
googletest googletest
sigar
libzmq libzmq
[shipit.pathmap] [shipit.pathmap]
......
...@@ -10,7 +10,6 @@ import specs.fmt as fmt ...@@ -10,7 +10,6 @@ import specs.fmt as fmt
import specs.folly as folly import specs.folly as folly
import specs.gmock as gmock import specs.gmock as gmock
import specs.sodium as sodium import specs.sodium as sodium
import specs.sigar as sigar
from shell_quoting import ShellQuoted from shell_quoting import ShellQuoted
...@@ -18,7 +17,7 @@ from shell_quoting import ShellQuoted ...@@ -18,7 +17,7 @@ from shell_quoting import ShellQuoted
def fbcode_builder_spec(builder): def fbcode_builder_spec(builder):
builder.add_option('zeromq/libzmq:git_hash', 'v4.2.2') builder.add_option('zeromq/libzmq:git_hash', 'v4.2.2')
return { return {
'depends_on': [fmt, folly, fbthrift, gmock, sodium, sigar], 'depends_on': [fmt, folly, fbthrift, gmock, sodium],
'steps': [ 'steps': [
builder.github_project_workdir('zeromq/libzmq', '.'), builder.github_project_workdir('zeromq/libzmq', '.'),
builder.step('Build and install zeromq/libzmq', [ builder.step('Build and install zeromq/libzmq', [
...@@ -39,4 +38,3 @@ def fbcode_builder_spec(builder): ...@@ -39,4 +38,3 @@ def fbcode_builder_spec(builder):
]), ]),
], ],
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment