Ejemplo n.º 1
0
 def enable(self):
     try:
         self.card_name = self._fetch_card_name()
         result = utils.get_stdout('%s --version' % NVIDIA_SETTINGS)
         assert 'NVIDIA' in result, 'nvidia-settings not found.'
         super(Plugin, self).enable()
     except Exception as err:
         log.warning('NVIDIA plugin disabled: %s', err)
         return self.disable()
Ejemplo n.º 2
0
 def enable(self):
     try:
         self.card_name = self._fetch_card_name()
         result = utils.get_stdout('%s --version' % NVIDIA_SETTINGS)
         assert 'NVIDIA' in result, 'nvidia-settings not found.'
         super(Plugin, self).enable()
     except Exception as err:
         log.warning('NVIDIA plugin disabled: %s', err)
         return self.disable()
Ejemplo n.º 3
0
 def update(self):
     self.data['card'] = self.card_name or 'Unknown'
     output = utils.get_stdout(NVIDIA_QUERY)
     for attr, value in self._parse_attributes(output):
         self.data[attr] = value
     # Calculate used and percent memory
     mem_total = utils.to_int(self.data['totaldedicatedgpumemory'], 0)
     mem_used = utils.to_int(self.data['useddedicatedgpumemory'], 0)
     self.data['freededicatedgpumemory'] = mem_total - mem_used
     self.data['percentuseddedicatedgpumemory'] = utils.percent(mem_used, mem_total, 0)
     super(Plugin, self).update()
Ejemplo n.º 4
0
 def update(self):
     self.data['card'] = self.card_name or 'Unknown'
     output = utils.get_stdout(NVIDIA_QUERY)
     for attr, value in self._parse_attributes(output):
         self.data[attr] = value
     # Calculate used and percent memory
     mem_total = utils.to_int(self.data['totaldedicatedgpumemory'], 0)
     mem_used = utils.to_int(self.data['useddedicatedgpumemory'], 0)
     self.data['freededicatedgpumemory'] = mem_total - mem_used
     self.data['percentuseddedicatedgpumemory'] = utils.percent(
         mem_used, mem_total, 0)
     super(Plugin, self).update()
Ejemplo n.º 5
0
 def _fetch_card_name(self):
     for line in utils.get_stdout('%s --glxinfo' % NVIDIA_SETTINGS).split('\n'):
         if line.strip().lower().startswith('opengl renderer string:'):
             return line.split(':', 1)[1].split('/')[0].strip()
Ejemplo n.º 6
0
 def _fetch_card_name(self):
     for line in utils.get_stdout('%s --glxinfo' %
                                  NVIDIA_SETTINGS).split('\n'):
         if line.strip().lower().startswith('opengl renderer string:'):
             return line.split(':', 1)[1].split('/')[0].strip()