using System;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Process[] processes = null;
string machineName = ".";
try
{
processes = Process.GetProcesses(machineName);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
return;
}
int threadscount = 0;
foreach (Process p in processes)
threadscount += p.Threads.Count;
Console.WriteLine("Total threads: {0}", threadscount); // Total threads: 1577
}
}
}
/*
run:
Total threads: 1577
*/