Guest User

Untitled

a guest
Oct 17th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. class Program {
  2.  
  3. static DateTime firstdate, lastdate;
  4.  
  5. const int CHUNKSIZE = 10 * 1024 * 1024; // 10 MB.
  6. const int TRIALS = 10000;
  7.  
  8. static void startmeasure() {
  9.  
  10. firstdate = DateTime.Now;
  11.  
  12. }
  13.  
  14. static void stopmeasure() {
  15.  
  16. lastdate = DateTime.Now;
  17.  
  18. var duration = lastdate.Subtract(firstdate);
  19.  
  20. Console.WriteLine("Test duration:" + duration.TotalSeconds.ToString());
  21.  
  22. }
  23.  
  24. static void Main(string[] args) {
  25.  
  26. string input;
  27.  
  28. do {
  29.  
  30. input = Console.ReadLine();
  31.  
  32. switch (input) {
  33.  
  34. case "test":
  35.  
  36. handletest();
  37.  
  38. break;
  39.  
  40. }
  41.  
  42. } while (input != "exit");
  43.  
  44. }
  45.  
  46. static void handletest() {
  47.  
  48. startmeasure();
  49.  
  50. byte[] data;
  51.  
  52. for (int i = 0; i < TRIALS; i++) {
  53.  
  54. data = getdata(CHUNKSIZE);
  55.  
  56. }
  57.  
  58. stopmeasure();
  59.  
  60. }
  61.  
  62. static byte[] getdata(int size) {
  63.  
  64. return new byte[size];
  65.  
  66. }
  67.  
  68. }
Add Comment
Please, Sign In to add comment