I have a small windows application where the click on a button will display the list of users in a datagrid starting with a name that is entered in a textbox..
I would like to find out how much it takes if there are 30 users uses this search page simultaneously and find out the time it takes to fetch the results on to datagrid of my windows application..
sample code:
private void btnseacrh_Click(object sender, EventArgs e)
{
var name=txttextbox.Text;
var Resultdataset= Fecthresultfromdb(name);
// retchresultfromdb method calls the database and fetches all the people whose name //starts with 'name' value entered in a textbox
//finally result set is bind to datagrid for display
datagrid.datasource=Resultdataset;
}
Now I would like to know if there are 30 users concurrently using this seacrher window,how much time it takes..This is one of non functional requirement that has to be met within 3 secs.
PLease tell what modifications i need to do..PLease share the modified code snippet as well.
Loading

Dhirendra MisraPosted Jan 10, 2014, 6:04 AM
You can make use of Stopwatch to get the time difference between the functionality.
Like the below example:
var s2 = Stopwatch.StartNew();
for (int i = 0; i < max; i++)
{
var pair = new KeyValuePair
}
s2.Stop();
Console.WriteLine(((double)(s1.Elapsed.TotalMilliseconds * 1000000) / max).ToString("0.00 ns"));
For concurrency you can use TPL (Task Parallel Library)
Details:
http://msdn.microsoft.com/en-us/library/dd537609(v=vs.110).aspx
mahesh kumar B MPosted Jan 12, 2014, 2:24 AM
Javeed M ShaikhPosted Jan 9, 2014, 4:33 PM
http://stackoverflow.com/questions/2676310/c-sharp-stress-test-simulate-multiple-access-to-a-given-shared-resource/2676665#2676665