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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.3
2
+
3
+ * Assuming 100 jiffies/second vs. reading from /proc/timer_list
4
+
1
5
  ## 1.0.2
2
6
 
3
7
  * Also grouping under kthread (one d vs. 2 ds)
@@ -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
- # Relies on the /proc directory (/proc/timer_list). We need this because the process CPU utilization is measured in jiffies.
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
- # if /proc/timer_list isn't available, fall back to the assumption of 100 jiffies/second (10 milliseconds/jiffy)
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
- if File.exist?('/proc/timer_list')
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.
@@ -1,3 +1,3 @@
1
1
  module ServerMetrics
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: