Get machine details information.

        :returns: Mapping of hardware details.
324090
async def get_details(self):
        
        data = await self._handler.details(system_id=self.system_id)
        return bson.decode_all(data)[0]
592478
def GetInfo(self):
        """"""
        return {
            'vendor': self.vendor,
            'product': self.product,
            'version': self.version,
            'url': self.url,
            'interfaces': list(self.interfaces.keys())
        }
1026932
def get_platform_info():
        

        try:
            system_name = platform.system()
            release_name = platform.release()
        except:
            system_name = "Unknown"
            release_name = "Unknown"

        return {
            'system': system_name,
            'release': release_name,
        }
176347
private function _cpuinfo()
    {
        $allCpus = $this->_get_Win32_Processor();
        if (!$allCpus) {
            if (CommonFunctions::executeProgram('reg', 'query HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor /s', $strBuf, false) && (strlen($strBuf) > 0)) {
                $lines = preg_split('/\n/', $strBuf);
                $coreCount = -1;
                foreach ($lines as $line) {
                    if (preg_match('/^HKEY_LOCAL_MACHINE\\\\HARDWARE\\\\DESCRIPTION\\\\System\\\\CentralProcessor\\\\\d+/i', $line)) {
                        $coreCount++;
                    } elseif ($coreCount >= 0) {
                        if (preg_match("/^\s*ProcessorNameString\s+REG_SZ\s+(.+)\s*$/i", $line, $buffer2)) {
                            $allCpus[$coreCount]['Name'] = $buffer2[1];
                        } elseif (preg_match("/^\s*~MHz\s+REG_DWORD\s+(0x.+)\s*$/i", $line, $buffer2)) {
                            $allCpus[$coreCount]['CurrentClockSpeed'] = hexdec($buffer2[1]);
                        }
                    }
                }
            }
        }

        $globalcpus = 0;
        foreach ($allCpus as $oneCpu) {
            $cpuCount = 1;
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
            } elseif (isset($oneCpu['NumberOfCores'])) {
                $cpuCount = $oneCpu['NumberOfCores'];
            }
            $globalcpus+=$cpuCount;
        }

        foreach ($allCpus as $oneCpu) {
            $cpuCount = 1;
            if (isset($oneCpu['NumberOfLogicalProcessors'])) {
                $cpuCount = $oneCpu['NumberOfLogicalProcessors'];
            } elseif (isset($oneCpu['NumberOfCores'])) {
                $cpuCount = $oneCpu['NumberOfCores'];
            }
            for ($i = 0; $i < $cpuCount; $i++) {
                $cpu = new CpuDevice();
                if (isset($oneCpu['Name'])) $cpu->setModel($oneCpu['Name']);
                if (isset($oneCpu['L3CacheSize']) && ($oneCpu['L3CacheSize'] > 0)) {
                    $cpu->setCache($oneCpu['L3CacheSize'] * 1024);
                } elseif (isset($oneCpu['L2CacheSize'])) {
                    $cpu->setCache($oneCpu['L2CacheSize'] * 1024);
                }
                if (isset($oneCpu['CurrentClockSpeed'])) {
                    $cpu->setCpuSpeed($oneCpu['CurrentClockSpeed']);
                    if (isset($oneCpu['MaxClockSpeed']) && ($oneCpu['CurrentClockSpeed'] < $oneCpu['MaxClockSpeed'])) $cpu->setCpuSpeedMax($oneCpu['MaxClockSpeed']);
                }
                if (isset($oneCpu['ExtClock'])) $cpu->setBusSpeed($oneCpu['ExtClock']);
                if (PSI_LOAD_BAR) {
                    if ((count($allCpus) == 1) && ($globalcpus > 1)) {
                        if (($cpubuffer = $this->_get_Win32_PerfFormattedData_PerfOS_Processor()) && (count($cpubuffer) == ($cpuCount+1)) && isset($cpubuffer['cpu'.$i])) {
                            $cpu->setLoad($cpubuffer['cpu'.$i]);
                        }
                    } elseif (count($allCpus) == $globalcpus) {
                        if (isset($oneCpu['LoadPercentage'])) $cpu->setLoad($oneCpu['LoadPercentage']);
                    }
                }
                $this->sys->setCpus($cpu);
            }
        }
    }
1229743
def get_cpu_info():
	'''
	
	'''

	import json

	output = get_cpu_info_json()

	# Convert JSON to Python with non unicode strings
	output = json.loads(output, object_hook = _utf_to_str)

	return output
1252255
def device_info(self):
        
        info = {
            'serial': self.serial,
            'model': self.model,
            'build_info': self.build_info,
            'user_added_info': self._user_added_device_info
        }
        return info
559173
def get_info(self):
        '''
        
        '''
        if not self.info:
            ci = win32pdh.GetCounterInfo(self.handle, 0)
            self.info = {
                'type': ci[0],
                'version': ci[1],
                'scale': ci[2],
                'default_scale': ci[3],
                'user_data': ci[4],
                'query_user_data': ci[5],
                'full_path': ci[6],
                'machine_name': ci[7][0],
                'object_name': ci[7][1],
                'instance_name': ci[7][2],
                'parent_instance': ci[7][3],
                'instance_index': ci[7][4],
                'counter_name': ci[7][5],
                'explain_text': ci[8]
            }
        return self.info
1076062
def get_processor_name():
    
    if platform.system() == "Linux":
        with open("/proc/cpuinfo", "rb") as cpuinfo:
            all_info = cpuinfo.readlines()
            for line in all_info:
                if b'model name' in line:
                    return re.sub(b'.*model name.*:', b'', line, 1)

    return platform.processor()
106127
private function _machine()
    {
        $buffer = $this->_get_Win32_ComputerSystem();
        if ($buffer) {
            $buf = "";
            if (isset($buffer[0]['Manufacturer']) && !preg_match("/^To be filled by O\.E\.M\.$|^System manufacturer$|^Not Specified$/i", $buf2=$buffer[0]['Manufacturer'])) {
                $buf .= ' '.$buf2;
            }

            if (isset($buffer[0]['Model']) && !preg_match("/^To be filled by O\.E\.M\.$|^System Product Name$|^Not Specified$/i", $buf2=$buffer[0]['Model'])) {
                $buf .= ' '.$buf2;
            }
            if (trim($buf) != "") {
                $this->sys->setMachine(trim($buf));
            }
        }
    }
1255302
def get_machine_stats(self):
        '''
        
        '''
        self.logger.debug("Gathering machine stats")
        the_dict = {}
        keys = self.redis_conn.keys('stats:crawler:*:*:*:*')

        for key in keys:
            # break down key
            elements = key.split(":")
            machine = elements[2]
            spider = elements[3]
            response = elements[4]
            end = elements[5]

            # we only care about the machine, not spider type
            if machine not in the_dict:
                the_dict[machine] = {}

            if response not in the_dict[machine]:
                the_dict[machine][response] = {}

            if end in the_dict[machine][response]:
                the_dict[machine][response][end] = the_dict[machine][response][end] + \
                    self._get_key_value(key, end == 'lifetime')
            else:
                the_dict[machine][response][end] = self._get_key_value(key, end == 'lifetime')

        # simple count
        the_dict['count'] = len(list(the_dict.keys()))

        ret_dict = {}
        ret_dict['machines'] = the_dict

        return ret_dict
854108
def get_cpu_info(self):
        
        info = snap7.snap7types.S7CpuInfo()
        result = self.library.Cli_GetCpuInfo(self.pointer, byref(info))
        check_error(result, context="client")
        return info
1104838
def cpustats():
    '''
    
    '''
    # Tries to gather information similar to that returned by a Linux machine
    # Avoid using WMI as there's a lot of overhead

    # Time related info
    user, system, idle, interrupt, dpc = psutil.cpu_times()
    cpu = {'user': user,
           'system': system,
           'idle': idle,
           'irq': interrupt,
           'dpc': dpc}
    # Count related info
    ctx_switches, interrupts, soft_interrupts, sys_calls = psutil.cpu_stats()
    intr = {'irqs': {'irqs': [],
                     'total': interrupts}}
    soft_irq = {'softirqs': [],
               'total': soft_interrupts}
    return {'btime': psutil.boot_time(),
            'cpu': cpu,
            'ctxt': ctx_switches,
            'intr': intr,
            'processes': len(psutil.pids()),
            'softirq': soft_irq,
            'syscalls': sys_calls}
743423
def _GetHWInfos(client_list, batch_size=10000, token=None):
  """"""

  # This function returns a dict mapping each client_id to a set of reported
  # hardware serial numbers reported by this client.
  hw_infos = {}

  logging.info("%d clients to process.", len(client_list))

  c = 0

  for batch in collection.Batch(client_list, batch_size):
    logging.info("Processing batch: %d-%d", c, c + batch_size)
    c += len(batch)

    client_objs = aff4.FACTORY.MultiOpen(batch, age=aff4.ALL_TIMES, token=token)

    for client in client_objs:
      hwi = client.GetValuesForAttribute(client.Schema.HARDWARE_INFO)

      hw_infos[client.urn] = set(["%s" % x.serial_number for x in hwi])

  return hw_infos
1215881
def server_hardware(self):
        
        if not self.__server_hardware:
            self.__server_hardware = ServerHardware(self.__connection)
        return self.__server_hardware
690694
def getallhwinfo():
    """"""
    hwinfo = meminfo()
    hwinfo.update(cpuinfo())
    hwinfo.update(uname())
    hwinfo.update(vgadata())
    hwinfo.update(distro())
    hwinfo.update(diskdata())
    hwinfo.update(hostname())
    hwinfo.update(serial_number())
    ip = ip_address()
    hwinfo.update(mac_address(ip))
    hwinfo.update({'IP': ip})
    hwinfo.update(system_model())
    return hwinfo
146731
def get_essential_properties(self):
        
        sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID)
        try:
            # TODO(nisha): Add local_gb here and return after
            # local_gb changes are merged.
            # local_gb = sushy_system.storage_summary
            prop = {'memory_mb': (sushy_system.memory_summary.size_gib * 1024),
                    'cpus': sushy_system.processors.summary.count,
                    'cpu_arch': sushy_map.PROCESSOR_ARCH_VALUE_MAP_REV.get(
                    sushy_system.processors.summary.architecture),
                    'local_gb': common_storage.get_local_gb(sushy_system)}
            return {'properties': prop,
                    'macs': sushy_system.ethernet_interfaces.summary}
        except sushy.exceptions.SushyError as e:
            msg = (self._('The Redfish controller failed to get the '
                          'resource data. Error %(error)s')
                   % {'error': str(e)})
            LOG.debug(msg)
            raise exception.IloError(msg)
43326
def get_details(self):
        
        data = []
        if isinstance(self.model, vCenterCloneVMFromVMResourceModel):
            data.append(VmDetailsProperty(key='Cloned VM Name', value=self.model.vcenter_vm))

        if isinstance(self.model, VCenterDeployVMFromLinkedCloneResourceModel):
            template = self.model.vcenter_vm
            snapshot = self.model.vcenter_vm_snapshot
            data.append(VmDetailsProperty(key='Cloned VM Name',value= '{0} (snapshot: {1})'.format(template, snapshot)))

        if isinstance(self.model, vCenterVMFromImageResourceModel):
            data.append(VmDetailsProperty(key='Base Image Name', value=self.model.vcenter_image.split('/')[-1]))

        if isinstance(self.model, vCenterVMFromTemplateResourceModel):
            data.append(VmDetailsProperty(key='Template Name', value=self.model.vcenter_template))

        return data