Tuesday, November 25, 2014

How to see how many thread is working to complete my task TPL?


suppose i want to download multiple files with task parallel library and now i want to visualize how many threads are working at the time of debugging from VS2010 IDE ? here is one code snippet which download many files using TPL.



var list = new[]
{
"http://google.com",
"http://yahoo.com",
"http://ift.tt/1npNc58;
};

var tasks = Parallel.ForEach(list,
s
=>
{
using (var client = new WebClient())
{
Console.WriteLine("starting to download {0}", s);
string result = client.DownloadString((string)s);
Console.WriteLine("finished downloading {0}", s);
}
});

is there any visualizer exist in VS2010 or 2012?


please guide me or redirect me to any article from where i can acquire the knowledge to see how many thread is running to complete my task.



No comments:

Post a Comment