|
9 | 9 | """Per-CPU plugin."""
|
10 | 10 |
|
11 | 11 | from glances.cpu_percent import cpu_percent
|
| 12 | +from glances.globals import BSD, LINUX, MACOS, WINDOWS |
12 | 13 | from glances.plugins.plugin.model import GlancesPluginModel
|
13 | 14 |
|
14 | 15 | # Fields description
|
|
76 | 77 | 'description': '*(Linux)*: percent of time spent handling software interrupts.',
|
77 | 78 | 'unit': 'percent',
|
78 | 79 | },
|
| 80 | + 'dpc': { |
| 81 | + 'description': '*(Windows)*: percent of time spent handling deferred procedure calls.', |
| 82 | + 'unit': 'percent', |
| 83 | + }, |
| 84 | + 'interrupt': { |
| 85 | + 'description': '*(Windows)*: percent of time spent handling software interrupts.', |
| 86 | + 'unit': 'percent', |
| 87 | + }, |
79 | 88 | }
|
80 | 89 |
|
81 | 90 | # Define the history items list
|
@@ -140,11 +149,17 @@ def msg_curse(self, args=None, max_width=None):
|
140 | 149 | if not self.stats or not self.args.percpu or self.is_disabled():
|
141 | 150 | return ret
|
142 | 151 |
|
143 |
| - # Define the default header |
144 |
| - all_headers = ['user', 'system', 'idle', 'iowait', 'steal'] |
145 |
| - |
146 |
| - # Determine applicable headers |
147 |
| - header = [h for h in all_headers if self.stats[0].get(h) is not None] |
| 152 | + # Define the headers based on OS |
| 153 | + header = ['user', 'system'] |
| 154 | + |
| 155 | + if LINUX: |
| 156 | + header.extend(['iowait', 'idle', 'irq', 'nice', 'steal', 'guest']) |
| 157 | + elif MACOS: |
| 158 | + header.extend(['idle', 'nice']) |
| 159 | + elif BSD: |
| 160 | + header.extend(['idle', 'irq', 'nice']) |
| 161 | + elif WINDOWS: |
| 162 | + header.extend(['dpc', 'interrupt']) |
148 | 163 |
|
149 | 164 | # Build the string message
|
150 | 165 | if self.is_disabled('quicklook'):
|
|
0 commit comments