Repository where I mostly put random python scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB

  1. import java.util.*;
  2. /**
  3. * File to test the performance of multi threaded file
  4. * io by reading a large quantity of files in parallel
  5. * using a different amount of threads.
  6. *
  7. * @author Jeffery Russell 1-31-19
  8. */
  9. public class MultiThreadedFileReadTest
  10. {
  11. public static void main(String[] args)
  12. {
  13. List<Integer> x = new ArrayList<>();
  14. List<Double> y = new ArrayList<>();
  15. for(int i = 1; i <= 64; i++)
  16. {
  17. long threadTotal = 0;
  18. for(int w = 0; w < 20; w++)
  19. {
  20. TaskManager boss = new TaskManager(i);
  21. for(int j = 0; j < 500; j++)
  22. {
  23. boss.addTask(new ReadTask("./testData/" + i + ".txt"));
  24. }
  25. long startTime = System.nanoTime();
  26. boss.runTasks();
  27. long endTime = System.nanoTime();
  28. long durationMS = (endTime - startTime)/1000000;
  29. threadTotal+= durationMS;
  30. }
  31. x.add(i);
  32. y.add(threadTotal/20.0); //finds average
  33. }
  34. System.out.println(x);
  35. System.out.println(y);
  36. }
  37. }