mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
isParallel in performance tests
This commit is contained in:
@@ -40,7 +40,7 @@ public class PsiConcurrencyStressTest extends PsiTestCase {
|
||||
private volatile boolean writeActionInProgress;
|
||||
public void testStress() throws Exception {
|
||||
int numOfThreads = 10;
|
||||
int iterations = Timings.adjustAccordingToMySpeed(20);
|
||||
int iterations = Timings.adjustAccordingToMySpeed(20, true);
|
||||
System.out.println("iterations = " + iterations);
|
||||
final int readIterations = iterations * 3;
|
||||
final int writeIterations = iterations;
|
||||
|
||||
@@ -878,7 +878,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
final int N = 100;
|
||||
|
||||
final Random gen = new Random();
|
||||
int N_TRIES = Timings.adjustAccordingToMySpeed(7000);
|
||||
int N_TRIES = Timings.adjustAccordingToMySpeed(7000, false);
|
||||
System.out.println("N_TRIES = " + N_TRIES);
|
||||
DocumentEx document = null;
|
||||
for (int tryn=0; tryn < N_TRIES;tryn++) {
|
||||
|
||||
+1
-2
@@ -451,8 +451,7 @@ public class VirtualFilePointerTest extends PlatformLangTestCase {
|
||||
}
|
||||
};
|
||||
VirtualFileManager.getInstance().addVirtualFileListener(listener, getTestRootDisposable());
|
||||
|
||||
int N = Timings.adjustAccordingToMySpeed(1000);
|
||||
int N = Timings.adjustAccordingToMySpeed(1000, false);
|
||||
System.out.println("N = " + N);
|
||||
for (int i=0;i< N;i++) {
|
||||
assertNotNull(pointer.getFile());
|
||||
|
||||
@@ -110,11 +110,12 @@ public class Timings {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value
|
||||
* @param value the value (e.g. number of iterations) which needs to be adjusted according to my machine speed
|
||||
* @param isParallelizable true if the test load is scalable with the CPU cores
|
||||
* @return value calibrated according to this machine speed. For slower machine, lesser value will be returned
|
||||
*/
|
||||
public static int adjustAccordingToMySpeed(int value) {
|
||||
return Math.max(1, (int)(1.0 * value * ETALON_TIMING / MACHINE_TIMING) / 8 * JobSchedulerImpl.CORES_COUNT);
|
||||
public static int adjustAccordingToMySpeed(int value, boolean isParallelizable) {
|
||||
return Math.max(1, (int)(1.0 * value * ETALON_TIMING / MACHINE_TIMING) / 8 * (isParallelizable ? JobSchedulerImpl.CORES_COUNT : 1));
|
||||
}
|
||||
|
||||
public static String getStatistics() {
|
||||
|
||||
Reference in New Issue
Block a user