private CpuInfo GetCpu() { var output = ShellHelper.Bash("top -bn1 | grep \"Cpu(s)\" | sed \"s/.*, *\\([0-9.]*\\)%* id.*/\\1/\" | awk '{print 100 - $1}'"); var lines = ShellHelper.TryReadFileLines("/proc/cpuinfo"); var coreCountRegex = new Regex(@"^cpu cores\s+:\s+(.+)", RegexOptions.IgnoreCase); var cpuCoresString = (lines.FirstOrDefault(o => coreCountRegex.Match(o).Success) ?? string.Empty); var clockSpeedRegex = new Regex(@"^cpu MHz\s+:\s+(.+)", RegexOptions.IgnoreCase); var clockSpeedString = (lines.FirstOrDefault(o => clockSpeedRegex.Match(o).Success) ?? string.Empty); var index = clockSpeedString.IndexOf('.'); if (index != -1) { clockSpeedString = clockSpeedString.Substring(0, index); } var cpu = new CpuInfo(); if (double.TryParse(output.Replace("%", string.Empty), out var totalPercentage)) { cpu.TotalPercentage = totalPercentage; } if (int.TryParse(coreCountRegex.Match(cpuCoresString).Groups[1].Value, out var cpuCores)) { cpu.NumberOfCores = cpuCores; } if (int.TryParse(clockSpeedRegex.Match(clockSpeedString).Groups[1].Value, out var clockSpeed)) { cpu.CurrentClockSpeed = clockSpeed; } return(cpu); }
/// <summary> /// 获取CPU信息 /// </summary> /// <returns></returns> public CpuInfo GetCpuInfo() { CpuInfo cpuInfo = new CpuInfo(); GetSystemInfo(ref cpuInfo); return(cpuInfo); }
public bool Equals([AllowNull] BenchmarkResults other) { return(other != null && GpuInfo.Equals(other.GpuInfo) && CpuInfo.Equals(other.CpuInfo) && EqualityComparer <Dictionary <string, float> > .Default.Equals(Scores, other.Scores)); }
/// <summary> /// Get cpu info /// </summary> /// <returns></returns> public static IEnumerable <CpuInfo> GetCpuInfo() { var result = new List <CpuInfo>(); try { var props = typeof(CpuInfo).GetProperties(); var obj = new CpuInfo(); foreach (var prop in props) { var res = CmdExecute($"wmic cpu get {prop.Name.ToLower()}"); if (string.IsNullOrEmpty(res)) { continue; } var values = res.Split("\n"); typeof(CpuInfo).GetProperty(prop.Name)?.SetValue(obj, values[1].Trim()); } result.Add(obj); } catch { // ignored } return(result); }
public void SerializeTest() { SystemInfo info = new SystemInfo(); info.groupKey = "f31fc79434df8e4b7f9fd1f5bebe5b111baf8571"; info.machineId = null; // quad-core CpuInfo cpu = new CpuInfo(); cpu.unit.Add(15.5f); cpu.unit.Add(0.0f); cpu.unit.Add(0.0f); cpu.unit.Add(0.0f); cpu.total = (float)(15.5 * 0.25); info.cpuUsage = cpu; MemoryInfo memoy = new MemoryInfo(); memoy.max = 8589934592; // 8 * 1024 * 1024 * 1024; memoy.current = 6442450944; // 6 * 1024 * 1024 * 1024; info.memoryUsage = memoy; string json = JsonConvert.SerializeObject(info); Trace.WriteLine(json); }
public static void Show() { SystemInfo systemInfo = new SystemInfo(); Console.WriteLine("操作系统:" + systemInfo.GetOperationSystemInName() + "<br>"); Console.WriteLine("CPU编号:" + systemInfo.GetCpuId() + "<br>"); Console.WriteLine("硬盘编号:" + systemInfo.GetMainHardDiskId() + "<br>"); Console.WriteLine("Windows目录所在位置:" + systemInfo.GetSysDirectory() + "<br>"); Console.WriteLine("系统目录所在位置:" + systemInfo.GetWinDirectory() + "<br>"); MemoryInfo memoryInfo = systemInfo.GetMemoryInfo(); CpuInfo cpuInfo = systemInfo.GetCpuInfo(); Console.WriteLine("dwActiveProcessorMask" + cpuInfo.dwActiveProcessorMask + "<br>"); Console.WriteLine("dwAllocationGranularity" + cpuInfo.dwAllocationGranularity + "<br>"); Console.WriteLine("CPU个数:" + cpuInfo.dwNumberOfProcessors + "<br>"); Console.WriteLine("OEM ID:" + cpuInfo.dwOemId + "<br>"); Console.WriteLine("页面大小" + cpuInfo.dwPageSize + "<br>"); Console.WriteLine("CPU等级" + cpuInfo.dwProcessorLevel + "<br>"); Console.WriteLine("dwProcessorRevision" + cpuInfo.dwProcessorRevision + "<br>"); Console.WriteLine("CPU类型" + cpuInfo.dwProcessorType + "<br>"); Console.WriteLine("lpMaximumApplicationAddress" + cpuInfo.lpMaximumApplicationAddress + "<br>"); Console.WriteLine("lpMinimumApplicationAddress" + cpuInfo.lpMinimumApplicationAddress + "<br>"); Console.WriteLine("CPU类型:" + cpuInfo.dwProcessorType + "<br>"); Console.WriteLine("可用交换文件大小:" + memoryInfo.dwAvailPageFile + "<br>"); Console.WriteLine("可用物理内存大小:" + memoryInfo.dwAvailPhys + "<br>"); Console.WriteLine("可用虚拟内存大小" + memoryInfo.dwAvailVirtual + "<br>"); Console.WriteLine("操作系统位数:" + memoryInfo.dwLength + "<br>"); Console.WriteLine("已经使用内存大小:" + memoryInfo.dwMemoryLoad + "<br>"); Console.WriteLine("交换文件总大小:" + memoryInfo.dwTotalPageFile + "<br>"); Console.WriteLine("总物理内存大小:" + memoryInfo.dwTotalPhys + "<br>"); Console.WriteLine("总虚拟内存大小:" + memoryInfo.dwTotalVirtual + "<br>"); }
public override void Run() { CpuInfoEventArgs e1 = new CpuInfoEventArgs(Client.RemoteEndPoint.ToString(), info); CpuInfoEvent.OnCpuInfo(e1); info = null; //clean memory }
private async Task <Cpu> GetCpuFromCommandOutput() { var cpuLoadOutput = await _commandExecutor.ExecuteAsync(CpuLoadCommand); var loadParameters = cpuLoadOutput.Output.Split(' '); var cpuInfoOutput = await _commandExecutor.ExecuteAsync(CpuInfoCommand); var cpuInfoLines = cpuInfoOutput.Output.Split(Environment.NewLine); // TODO: now we checks only first core var cpuInfo = new CpuInfo { Architecture = _outputParser.Parse(cpuInfoLines, "Architecture"), Cores = int.Parse(_outputParser.Parse(cpuInfoLines, "Cores")), Model = _outputParser.Parse(cpuInfoLines, "Model name") }; var cpu = new Cpu { AverageUsageFor1M = double.Parse(loadParameters[0].Trim()), AverageUsageFor5M = double.Parse(loadParameters[1].Trim()), AverageUsageFor15M = double.Parse(loadParameters[2].Trim()), RunningProcesses = int.Parse(loadParameters[3].Split('/').First()), TotalProcesses = int.Parse(loadParameters[3].Split('/').Last()), CpuInfo = cpuInfo }; return(cpu); }
public void Process_MessageActionUpdateCpu_CallsUpdateCpu() { var cpuInfo = new CpuInfo { Name = "cpu1", Description = "cpu1", IpAddress = "100.2.3.120", }; var m = new Message { Id = guid, Action = MessageAction.UpdateCpu, Data = JsonConvert.SerializeObject(cpuInfo) }; var message = JsonConvert.SerializeObject(m); Mock <IPviApplication> pviApplicationMock = new Mock <IPviApplication>(); pviApplicationMock.Setup(p => p.UpdateCpu(It.IsAny <CpuInfo>())); var proc = new MessageProcessor(pviApplicationMock.Object); var response = proc.Process(message); pviApplicationMock.Verify(p => p.UpdateCpu(It.IsAny <CpuInfo>()), Times.Once); }
static void AppExitCleanUp(object sender, EventArgs e) { WmiEventWatcher.StopHpBiosEventWatcher(); GpuInfo.CloseGpuGroups(); CpuInfo.CloseCpuGroups(); Opcode.Close(); Ring0.Close(); }
public void Test_GetCurrentMhz() { var result = CpuInfo.GetCurrentMhz(); foreach (var item in result) { Output.WriteLine(item); } }
public CpuDetailResponse GetCpuByName(CpuInfo info) { if (info != null && _service.Cpus.ContainsKey(info.Name)) { return(Map(info, _service.Cpus[info.Name])); } return(null); }
public override byte[] GetLocalMachineCode() { try { return(MD5HexToBytesArray(CpuInfo.GetHardwareID())); } catch { } return(null); }
/// <summary> /// Gather all informations about the server and the program /// </summary> /// <param name="servicename">Name of the service from where this is collected</param> /// <param name="programVersion">Versionname of the program/service</param> public void CollectData(string servicename, string programVersion) { this.Servername = Process.GetCurrentProcess().MachineName; this.Disks = DiskInfo.CollectData().ToArray(); this.Uptime = DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime); this.Cpu = CpuInfo.CollectData(this.Uptime); this.Ram = RamInfo.CollectData(); this.Timestamp = DateTime.Now; this.Servicename = servicename; this.ServiceVersion = programVersion; }
private void GetCpuInfo() { try { var cpuList = new ManagementObjectSearcher("select * from Win32_Processor").Get().Cast <ManagementObject>(); if (cpuList != null) { foreach (var cpu in cpuList) { var CPU = new CpuInfo(); CPU.ID = (string)cpu["ProcessorId"]; CPU.Socket = (string)cpu["SocketDesignation"]; CPU.Name = (string)cpu["Name"]; CPU.Description = (string)cpu["Caption"]; CPU.AddressWidth = (ushort)cpu["AddressWidth"]; CPU.DataWidth = (ushort)cpu["DataWidth"]; CPU.SpeedMHz = (uint)cpu["MaxClockSpeed"]; CPU.BusSpeedMHz = (uint)cpu["ExtClock"]; CPU.L2Cache = (uint)cpu["L2CacheSize"] / 1024; CPU.L3Cache = (uint)cpu["L3CacheSize"] / 1024; CPU.Cores = (uint)cpu["NumberOfCores"]; CPU.Threads = (uint)cpu["NumberOfLogicalProcessors"]; CPU.Name = CPU.Name .Replace("(TM)", "™") .Replace("(tm)", "™") .Replace("(R)", "®") .Replace("(r)", "®") .Replace("(C)", "©") .Replace("(c)", "©") .Replace(" ", " ") .Replace(" ", " "); CpuList.Add(CPU); } } else { Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage() { OutputText = "Unable to detect installed CPU. (maybe VM in use)" }); } } catch { Messenger.Default.Send <MinerOutputMessage>(new MinerOutputMessage() { OutputText = "Unable to detect installed CPU. (maybe VM in use)" }); } }
private static CpuInfo GetCpuInfo() { var result = new CpuInfo(); string sig; using (var cpu = new ManagementObject(@"Win32_Processor.DeviceID=""CPU0""")) { cpu.Get(); result.vendor = cpu["Manufacturer"].ToString(); sig = cpu["ProcessorId"].ToString(); } for (byte i = 0; i < 3; i++) result.familyModelStepping[i] = Convert.ToByte(sig.Substring(10 + i * 2, 2), 16); return result; }
public void AmdIsPrettifiedWithDiffFrequencies(string originalName, string prettifiedName, double actualFrequency, int?physicalCoreCount, int?logicalCoreCount) { var cpuInfo = new CpuInfo( originalName, physicalProcessorCount: null, physicalCoreCount, logicalCoreCount, Frequency.FromGHz(actualFrequency), minFrequency: null, maxFrequency: null); Assert.Equal(prettifiedName, ProcessorBrandStringHelper.Prettify(cpuInfo, includeMaxFrequency: true)); }
public async Task Update(CpuInfoRequest request) { var info = new CpuInfo() { Name = request.Name, Description = request.Description, IpAddress = request.IpAddress }; _log.Info($"RequestProcessor Operation=Update request={ToJson(request)}"); await Task.Run(() => _application.UpdateCpu(info)); }
public async Task Update(CpuInfoRequest request) { var info = new CpuInfo() { Name = request.Name, Description = request.Description, IpAddress = request.IpAddress }; logger.Log(new LogEntry(LoggingEventType.Information, $"RequestProcessor Operation=Update request={ToJson(request)}")); await _application.UpdateCpu(info); }
internal CpuInfo GetCpuInfo() { var cpuInfo = new CpuInfo(); var query = new SelectQuery("Win32_processor"); var search = new ManagementObjectSearcher(query); foreach (ManagementObject info in search.Get()) { cpuInfo.Name = info["Name"].ToString(); cpuInfo.NumberOfCores = info["NumberOfCores"].ToString(); cpuInfo.Description = info["Description"].ToString(); } return cpuInfo; }
private void Connect(CpuInfo cpuInfo) { var cpu = new Cpu(_service, cpuInfo.Name); cpu.Connection.DeviceType = DeviceType.TcpIp; cpu.Connection.TcpIp.SourceStation = ConfigurationProvider.SourceStationId; cpu.Connection.TcpIp.DestinationIpAddress = cpuInfo.IpAddress; cpu.Connected += Cpu_Connected; cpu.Error += Cpu_Error; cpu.Disconnected += Cpu_Disconnected; cpu.Connect(); }
private static byte[] MakeEntropy(ulong serial, CpuInfo cpuInfo, string user) { //4 bytes var result = new byte[32]; BitConverter.GetBytes((uint)serial).Reverse().ToArray().CopyTo(result, 0); //12 bytes Encoding.ASCII.GetBytes(cpuInfo.vendor).CopyTo(result, 4); //3 bytes cpuInfo.familyModelStepping.CopyTo(result, 16); //13 bytes Encoding.Unicode.GetBytes(user).Take(26).Where((value, idx) => idx % 2 == 0).ToArray().CopyTo(result, 19); return(result); }
internal CpuInfo GetCpuInfo() { var cpuInfo = new CpuInfo(); var query = new SelectQuery("Win32_processor"); var search = new ManagementObjectSearcher(query); foreach (ManagementObject info in search.Get()) { cpuInfo.Name = info["Name"].ToString(); cpuInfo.NumberOfCores = info["NumberOfCores"].ToString(); cpuInfo.Description = info["Description"].ToString(); } return(cpuInfo); }
private void button1_Click(object sender, EventArgs e) { var cpu = new CpuInfo(); cpu.Name = txtName.Text; cpu.Description = txtDescription.Text; cpu.IpAddress = txtIpAddress.Text; _collection.AddOrUpdate(cpu); txtName.Clear(); txtDescription.Clear(); txtIpAddress.Clear(); }
static void Main() { WmiEventWatcher.StartHpBiosEventWatcher(); Ring0.Open(); Opcode.Open(); GpuInfo.OpenGpuGroups(); CpuInfo.OpenCpuGroups(); Application.ApplicationExit += AppExitCleanUp; Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }
public CrashDebuggerInfo(DbgEngine aDebugEngine) { iDebugEngine = aDebugEngine; iDebugEngineView = aDebugEngine.CreateView("CrashDebugger"); // iTheCurrentProcess = new DProcess(this); iTheCurrentThread = new DThread(this); iCodeSegs = new CodeSegCollection(this); iInfoCpu = new CpuInfo(this); iInfoFault = new FaultInfo(this); iInfoScheduler = new SchedulerInfo(this); iInfoDebugMask = new DebugMaskInfo(this); // MakeEmptyContainers(); }
private CpuDetailResponse Map(CpuInfo setting, Cpu cpu) { var detail = new CpuDetailResponse { Description = setting.Description, HasError = cpu.HasError, IpAddress = setting.IpAddress, IsConnected = cpu.IsConnected, Name = setting.Name, Error = cpu.HasError ? new CpuError { ErrorCode = cpu.ErrorCode, ErrorText = cpu.ErrorText } : null }; return(detail); }
public static CpuInfo GetCpuInfo() { // win32CompSys = new ManagementObjectSearcher("select * from Win32_ComputerSystem") using (ManagementObjectSearcher win32Proc = new ManagementObjectSearcher("select * from Win32_Processor")) { foreach (ManagementObject obj in win32Proc.Get()) { if (obj != null) { CpuInfo info = new CpuInfo(obj); return(info); } } } return(null); }
public void Reconnect(CpuInfo cpuInfo) { Cpu cpu = null; if (_service.Cpus.ContainsKey(cpuInfo.Name)) { cpu = _service.Cpus[cpuInfo.Name]; if (!cpu.IsConnected || cpu.HasError) { CreateCpu(cpuInfo); } } else { CreateCpu(cpuInfo); } }
private static CpuInfo GetCpuInfo() { var result = new CpuInfo(); string sig; using (var cpu = new ManagementObject(@"Win32_Processor.DeviceID=""CPU0""")) { cpu.Get(); result.vendor = cpu["Manufacturer"].ToString(); sig = cpu["ProcessorId"].ToString(); } for (byte i = 0; i < 3; i++) { result.familyModelStepping[i] = Convert.ToByte(sig.Substring(10 + i * 2, 2), 16); } return(result); }
public Task <CpuInfo> ReadCpuInfo() { var cpu = new CpuInfo(); using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Processor")) { foreach (ManagementObject managementObject in searcher.Get()) { cpu.Name = managementObject["Name"] as string; cpu.Cores = Convert.ToInt32(TryGetProperty(managementObject, "NumberOfCores")); cpu.Threads = Convert.ToInt32(TryGetProperty(managementObject, "ThreadCount")); cpu.SpeedMhz = Convert.ToInt32(TryGetProperty(managementObject, "MaxClockSpeed")); break; } } return(Task.FromResult(cpu)); }
public void CreateCpu(CpuInfo cpuInfo) { if (!_cpuInfoLookup.ContainsKey(cpuInfo.Name)) { _cpuInfoLookup.Add(cpuInfo.Name, cpuInfo); } Cpu cpu = null; if (_service.Cpus.ContainsKey(cpuInfo.Name)) { DisconnectCpu(cpuInfo); } else { Connect(cpuInfo); } }
// ��ȡCPU��Ϣ //����GetSystemInfo��������ȡcpu��Ϣ public CpuInfo GetCpuInfo() { CpuInfo cpuInfo = new CpuInfo(); GetSystemInfo(ref cpuInfo); return cpuInfo; }
private static extern void GetSystemInfo(ref CpuInfo cpuInfo);
internal static extern void GetSystemInfo(ref CpuInfo cpuinfo);
/// <summary> /// Mains this instance. /// </summary> public static void Main() { Mosa.Kernel.x86.Kernel.Setup(); Screen.GotoTop(); Screen.Color = Colors.Yellow; Screen.Write(@"MOSA OS Version 0.9 '"); Screen.Color = Colors.Red; Screen.Write(@"Prophecy"); Screen.Color = Colors.Yellow; Screen.Write(@"' Copyright 2008-2011"); Screen.NextLine(); Screen.Color = 0x0F; Screen.Write(new String((char)205, 60)); Screen.Write((char)203); Screen.Write(new String((char)205, 19)); Screen.NextLine(); Screen.Goto(2, 0); Screen.Color = Colors.Green; Screen.Write(@"Multibootaddress: "); Screen.Color = Colors.Gray; Screen.Write(Native.Get32(0x200004), 16, 8); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Magic number: "); Screen.Color = Colors.Gray; Screen.Color = 0x07; Screen.Write(Native.Get32(0x200000), 16, 8); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Multiboot-Flags: "); Screen.Color = Colors.Gray; Screen.Write(Multiboot.Flags, 2, 32); Screen.NextLine(); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Size of Memory: "); Screen.Color = Colors.Gray; Screen.Write((Multiboot.MemoryLower + Multiboot.MemoryUpper) / 1024, 10, -1); Screen.Write(@" MB ("); Screen.Write(Multiboot.MemoryLower + Multiboot.MemoryUpper, 10, -1); Screen.Write(@" KB)"); Screen.NextLine(); Screen.Color = Colors.White; for (uint index = 0; index < 60; index++) Screen.Write((char)205); Screen.NextLine(); /*Screen.Color = Colors.Green; Screen.Write(@"Memory-Map:"); Screen.NextLine(); for (uint index = 0; index < Multiboot.MemoryMapCount; index++) { Screen.Color = Colors.White; Screen.Write(Multiboot.GetMemoryMapBase(index), 16, 10); Screen.Write(@" - "); Screen.Write(Multiboot.GetMemoryMapBase(index) + Multiboot.GetMemoryMapLength(index) - 1, 16, 10); Screen.Write(@" ("); Screen.Color = Colors.Gray; Screen.Write(Multiboot.GetMemoryMapLength(index), 16, 10); Screen.Color = Colors.White; Screen.Write(@") "); Screen.Color = Colors.Gray; Screen.Write(@"Type: "); Screen.Write(Multiboot.GetMemoryMapType(index), 16, 1); Screen.NextLine(); }*/ Screen.Color = Colors.Green; Screen.Write(@"Smbios Info: "); if (SmbiosManager.IsAvailable) { Screen.Color = Colors.White; Screen.Write(@"["); Screen.Color = Colors.Gray; Screen.Write(@"Version "); Screen.Write(SmbiosManager.MajorVersion, 10, -1); Screen.Write(@"."); Screen.Write(SmbiosManager.MinorVersion, 10, -1); Screen.Color = Colors.White; Screen.Write(@"]"); Screen.NextLine(); Screen.Color = Colors.Yellow; Screen.Write(@"[Bios]"); Screen.Color = Colors.White; Screen.NextLine(); BiosInformationStructure biosInformation = new BiosInformationStructure(); Screen.Color = Colors.White; Screen.Write(@"Vendor: "); Screen.Color = Colors.Gray; Screen.Write(biosInformation.BiosVendor); Screen.NextLine(); Screen.Color = Colors.Yellow; Screen.Row = 9; Screen.Column = 25; Screen.Write(@"[Cpu]"); Screen.Color = Colors.White; Screen.NextLine(); Screen.Column = 25; CpuStructure cpuStructure = new CpuStructure(); Screen.Color = Colors.White; Screen.Write(@"Vendor: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.Vendor); Screen.NextLine(); Screen.Column = 25; Screen.Color = Colors.White; Screen.Write(@"Clock Freq.: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.ClockFrequency, 10, -1); Screen.Write(@" MHz"); Screen.NextLine(); Screen.Column = 25; Screen.Color = Colors.White; Screen.Write(@"Max. Speed: "); Screen.Color = Colors.Gray; Screen.Write(cpuStructure.MaxSpeed, 10, -1); Screen.Write(@" MHz"); Screen.NextLine(); Screen.Column = 25; } else { Screen.Color = Colors.Red; Screen.Write(@"No SMBIOS available on this system!"); } Screen.Goto(17, 0); Screen.Color = 0x0F; for (uint index = 0; index < 60; index++) Screen.Write((char)205); Screen.NextLine(); CpuInfo cpuInfo = new CpuInfo(); #region Vendor Screen.Color = Colors.Green; Screen.Write(@"Vendor: "); Screen.Color = Colors.White; cpuInfo.PrintVendorString(); Screen.NextLine(); #endregion #region Brand Screen.Color = Colors.Green; Screen.Write(@"Brand: "); Screen.Color = Colors.White; cpuInfo.PrintBrandString(); Screen.NextLine(); #endregion #region Stepping Screen.Color = Colors.Green; Screen.Write(@"Stepping: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Stepping, 16, 2); #endregion #region Model Screen.Color = Colors.Green; Screen.Write(@" Model: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Model, 16, 2); #endregion #region Family Screen.Color = Colors.Green; Screen.Write(@" Family: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Family, 16, 2); #endregion #region Type Screen.Color = Colors.Green; Screen.Write(@" Type: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.Type, 16, 2); Screen.NextLine(); Screen.Color = Colors.Green; Screen.Write(@"Cores: "); Screen.Color = Colors.White; Screen.Write(cpuInfo.NumberOfCores, 16, 2); #endregion //Multiboot.Dump(4,53); Screen.Row = 22; for (uint index = 0; index < 80; index++) { Screen.Column = index; Screen.Write((char)205); } for (uint index = 2; index < 23; index++) { Screen.Column = 60; Screen.Row = index; Screen.Color = Colors.White; if (index == 7) Screen.Write((char)185); else if (index == 17) Screen.Write((char)185); else if (index == 22) Screen.Write((char)202); else Screen.Write((char)186); } Screen.Goto(24, 29); Screen.Color = Colors.Yellow; Screen.Write(@"www.mosa-project.org"); CMOS cmos = new CMOS(); KernelTest.RunTests(); while (true) { cmos.Dump(2, 65); DisplayTime(cmos); } }
private static byte[] MakeEntropy(ulong serial, CpuInfo cpuInfo, string user) { //4 bytes var result = new byte[32]; BitConverter.GetBytes((uint)serial).Reverse().ToArray().CopyTo(result, 0); //12 bytes Encoding.ASCII.GetBytes(cpuInfo.vendor).CopyTo(result, 4); //3 bytes cpuInfo.familyModelStepping.CopyTo(result, 16); //13 bytes Encoding.Unicode.GetBytes(user).Take(26).Where((value, idx) => idx % 2 == 0).ToArray().CopyTo(result, 19); return result; }