protected void ButtomBenchmark_Click(object sender, EventArgs e) { // Create new stopwatch Stopwatch stopwatch = new Stopwatch(); // Begin timing stopwatch.Start(); Parallel.For(0, 100000, x => { CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.StatsBucket], "COOKIE_PERO" + x.ToString()); cuser.CookieName = "NOVO_IME"; cuser.CookieValue = "2222"; cuser.NumUsers = x; cuser.Add(); cuser.InSync = false; cuser.Refresh(); cuser.CookieName = "ime " + x.ToString(); cuser.Set(); }); // Stop timing stopwatch.Stop(); LabelTime.Text = stopwatch.ElapsedMilliseconds.ToString() + " ms"; }
protected void Page_Load(object sender, EventArgs e) { int x = new Random().Next(100); CookieUsers cuser = new CookieUsers(Global.ClientPool.ClientList[Global.PropertiesBucket], "COOKIE" + x.ToString()); cuser.CookieName = "NOVO_IME"; cuser.CookieValue = "2222"; cuser.NumUsers = x; cuser.Add(); cuser.InSync = false; cuser.Refresh(); cuser.CookieName = "ime " + x.ToString(); cuser.Set(); CookieCounter counter = new CookieCounter(Global.ClientPool.ClientList[Global.WordBucket]); counter.Key = CookieCounter.GetFullKey(x, Convert.ToByte(DateTime.Now.Day)); counter.Increment(1); counter.Refresh(); Response.Write("// " + counter.Value.ToString()); }