Archive

Archive for January, 2012

How to find the Number of Cores and Logical Processors using C#.net

January 30th, 2012

This is a pre cusrsor to something more that we are trying to achieve. The goal is to develop a simple code that will find the processor and memory details and then will benchmark the computer. We will then let users run this program to help him benchmark and compare the processors.

Today we will show you how to get the information about the number of processors. Here is the code that has been compiled in C#.Net ( 2010 Express Edition).

A note on compilation.

- Copy paste this code in console application and then go to Projects -> Add reference - > .NET - > System.Management

Happy coding.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_ComputerSystem").Get())
{
Console.WriteLine("Number Of Physical Processors: {0} ", item["NumberOfProcessors"]);
}

// Number of Cores

int coreCount = 0;
foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
{
coreCount += int.Parse(item["NumberOfCores"].ToString());
}
Console.WriteLine("Number Of Cores: {0}", coreCount);

// Number of Logical Processors

foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_ComputerSystem").Get())
{
Console.WriteLine("Number Of Logical Processors: {0}", item["NumberOfLogicalProcessors"]);
}

Console.ReadLine();
}
}
}

Uncategorized

Allegro PCB Viewer

January 29th, 2012

If you have been given an Allegro PCB Design to review and you do not have the access to complete Allegro Design Suites, you may like to download the Allegro PCB Viewer from http://www.cadence.com/products/pcb/Pages/downloads.aspx. The Allegro PCB viewer is a free tool to view the Allegro PCB Design files.

If you have the complete tool available to you, you may like to check the Allegro PCB tutorial.

Uncategorized

New Calculators - Post errors in Comment

January 21st, 2012