server_metrics 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/server_metrics/collectors/processes.rb +4 -12
- data/lib/server_metrics/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
@@ -26,11 +26,7 @@ class ServerMetrics::Processes
|
|
26
26
|
|
27
27
|
|
28
28
|
# This is the main method to call. It returns a hash of processes, keyed by the executable name.
|
29
|
-
# Processes are returned either because they are a top 10 CPU consumer, or a top 10 memory consumer.
|
30
29
|
#
|
31
|
-
# The exact number or processes returned depends on the overlap between the two lists (cpu and memory consumers).
|
32
|
-
# The list will always be between 10 and 20 items long.
|
33
|
-
|
34
30
|
# {'mysqld' =>
|
35
31
|
# {
|
36
32
|
# :cmd => "mysqld", # the command (without the path of arguments being run)
|
@@ -111,17 +107,13 @@ class ServerMetrics::Processes
|
|
111
107
|
grouped
|
112
108
|
end
|
113
109
|
|
114
|
-
#
|
110
|
+
# We need this because the process CPU utilization is measured in jiffies.
|
115
111
|
# In order to calculate the process' % usage of total CPU resources, we need to know how many jiffies have passed.
|
116
|
-
# Unfortunately, jiffies isn't a fixed value (it can vary between 100 and 250 per second), so we need to calculate it ourselves.
|
117
112
|
#
|
118
|
-
#
|
113
|
+
# While jiffies isn't a fixed value (it can vary between 100 and 250 per second),
|
114
|
+
# we assume it is 100 jiffies/second (10 milliseconds/jiffy) because that is most common.
|
119
115
|
def get_jiffies
|
120
|
-
|
121
|
-
`cat /proc/timer_list`.match(/^jiffies: (\d+)$/)[1].to_i
|
122
|
-
else
|
123
|
-
(Time.now.to_f*100).to_i
|
124
|
-
end
|
116
|
+
(Time.now.to_f*100).to_i
|
125
117
|
end
|
126
118
|
|
127
119
|
# Sys::ProcTable.ps returns +rss+ in pages, not in bytes.
|