Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Williams2015-11-04 18:16:30 +0000
committerDavid Williams2015-11-04 18:16:46 +0000
commit128ff6e0f791611865e3feac06e4eca68e271190 (patch)
tree5e0cdd24d31b520d2150f17abe3f819c9e351d94
parent0da9764e06056d3eeebe04ff1ca8a0c471ebaea6 (diff)
downloadeclipse.platform.releng-128ff6e0f791611865e3feac06e4eca68e271190.tar.gz
eclipse.platform.releng-128ff6e0f791611865e3feac06e4eca68e271190.tar.xz
eclipse.platform.releng-128ff6e0f791611865e3feac06e4eca68e271190.zip
[releng] formatted, and removed "temporary code" for old DB
-rw-r--r--bundles/org.eclipse.test.performance/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.test.performance/pom.xml2
-rw-r--r--bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitor.java58
-rw-r--r--bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java303
-rw-r--r--bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorMac.java168
-rw-r--r--bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java654
7 files changed, 577 insertions, 621 deletions
diff --git a/bundles/org.eclipse.test.performance/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.test.performance/.settings/org.eclipse.jdt.core.prefs
index 488612ce..318ad11d 100644
--- a/bundles/org.eclipse.test.performance/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.test.performance/.settings/org.eclipse.jdt.core.prefs
@@ -129,7 +129,7 @@ org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=132
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
@@ -147,7 +147,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.indentation.size=2
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@@ -158,7 +158,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
@@ -337,14 +337,14 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=132
+org.eclipse.jdt.core.formatter.lineSplit=256
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
@@ -352,3 +352,4 @@ org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=false
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.incompatibleJDKLevel=ignore
org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF b/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF
index a7c08bb7..e0cc5f5e 100644
--- a/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.test.performance
-Bundle-Version: 3.11.0.qualifier
+Bundle-Version: 3.12.0.qualifier
Bundle-Activator: org.eclipse.test.internal.performance.PerformanceTestPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.test.performance/pom.xml b/bundles/org.eclipse.test.performance/pom.xml
index a51066ee..33e81dd8 100644
--- a/bundles/org.eclipse.test.performance/pom.xml
+++ b/bundles/org.eclipse.test.performance/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.test</groupId>
<artifactId>org.eclipse.test.performance</artifactId>
- <version>3.11.0-SNAPSHOT</version>
+ <version>3.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitor.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitor.java
index 46b245a8..bcceb058 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitor.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitor.java
@@ -15,36 +15,32 @@ import org.eclipse.test.internal.performance.data.Scalar;
class PerformanceMonitor {
- private static PerformanceMonitor fgPerformanceMonitor;
-
- public static PerformanceMonitor getPerformanceMonitor() {
- if (fgPerformanceMonitor == null) {
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- if (os.startsWith("Windows")) //$NON-NLS-1$
- fgPerformanceMonitor = new PerformanceMonitorWindows();
- else if (os.startsWith("Mac OS X")) //$NON-NLS-1$
- fgPerformanceMonitor = new PerformanceMonitorMac();
- else
- fgPerformanceMonitor = new PerformanceMonitorLinux();
- }
- return fgPerformanceMonitor;
- }
-
- protected void collectOperatingSystemCounters(Map scalars) {
- if (PerformanceTestPlugin.isOldDB()) {
- addScalar(scalars, InternalDimensions.SYSTEM_TIME, System.currentTimeMillis());
- } else {
- Runtime runtime = Runtime.getRuntime();
- // runtime.gc();
- addScalar(scalars, InternalDimensions.USED_JAVA_HEAP, runtime.totalMemory() - runtime.freeMemory());
- }
- }
-
- protected void collectGlobalPerformanceInfo(Map scalars) {
- // no default implementation
- }
-
- void addScalar(Map scalars, Dim dimension, long value) {
- scalars.put(dimension, new Scalar(dimension, value));
+ private static PerformanceMonitor fgPerformanceMonitor;
+
+ public static PerformanceMonitor getPerformanceMonitor() {
+ if (fgPerformanceMonitor == null) {
+ String os = System.getProperty("os.name"); //$NON-NLS-1$
+ if (os.startsWith("Windows")) //$NON-NLS-1$
+ fgPerformanceMonitor = new PerformanceMonitorWindows();
+ else if (os.startsWith("Mac OS X")) //$NON-NLS-1$
+ fgPerformanceMonitor = new PerformanceMonitorMac();
+ else
+ fgPerformanceMonitor = new PerformanceMonitorLinux();
}
+ return fgPerformanceMonitor;
+ }
+
+ protected void collectOperatingSystemCounters(Map scalars) {
+ Runtime runtime = Runtime.getRuntime();
+ // runtime.gc();
+ addScalar(scalars, InternalDimensions.USED_JAVA_HEAP, runtime.totalMemory() - runtime.freeMemory());
+ }
+
+ protected void collectGlobalPerformanceInfo(Map scalars) {
+ // no default implementation
+ }
+
+ void addScalar(Map scalars, Dim dimension, long value) {
+ scalars.put(dimension, new Scalar(dimension, value));
+ }
}
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
index ae8ee69a..ddea2065 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorLinux.java
@@ -17,169 +17,164 @@ import java.util.StringTokenizer;
class PerformanceMonitorLinux extends PerformanceMonitor {
- private static long PAGESIZE = 4096;
- private static long JIFFIES = 10L;
- private static boolean fgHasElapsedTime = true;
- private static long fgStartupTime;
-
- /**
- * Write out operating system counters for Linux.
- *
- * @param scalars
- */
- protected void collectOperatingSystemCounters(Map scalars) {
- synchronized (this) {
- /**
- * The status values for a Linux process, that is the values that come from /proc/self/stat. The names of the variables
- * match the man proc page.
- */
- StringTokenizer st = readTokens("/proc/self/stat", false); //$NON-NLS-1$
- if (st != null) {
- st.nextToken(); // int pid; // Process id.
- st.nextToken(); // String comm; // The command name.
- st.nextToken(); // String state;
- st.nextToken(); // int ppid; // Parent process id. */
- st.nextToken(); // int pgrp; // Process group. */
- st.nextToken(); // int session;
- st.nextToken(); // int ttry_nr;
- st.nextToken(); // int tpgid;
- st.nextToken(); // long flags;
- long minflt = Long.parseLong(st.nextToken()); // Minor page faults (didn't need to load a page from disk). */
- st.nextToken(); // long cminflt; // Minor page faults for the process and it's children. */
- long majflt = Long.parseLong(st.nextToken()); // Major page faults. */
- st.nextToken(); // long cmajflt; // Major page faults for the process and it's children. */
- long utime = Long.parseLong(st.nextToken()); // User time in jiffies. */
- long stime = Long.parseLong(st.nextToken()); // System time in jiffies. */
- st.nextToken(); // long cutime; // User time for the process and it's children. */
- st.nextToken(); // long cstime; // System time for the process and it's children. */
-
- // addScalar(scalars, InternalDimensions.USER_TIME, utime*JIFFIES);
- addScalar(scalars, InternalDimensions.KERNEL_TIME, stime * JIFFIES);
- addScalar(scalars, InternalDimensions.CPU_TIME, (utime + stime) * JIFFIES);
- addScalar(scalars, InternalDimensions.SOFT_PAGE_FAULTS, minflt);
- addScalar(scalars, InternalDimensions.HARD_PAGE_FAULTS, majflt);
- }
+ private static long PAGESIZE = 4096;
+ private static long JIFFIES = 10L;
+ private static boolean fgHasElapsedTime = true;
+ private static long fgStartupTime;
- /**
- * The status memory values values for a Linux process, that is the values that come from /proc/self/statm. The names of
- * the variables match the man proc page.
- */
- st = readTokens("/proc/self/statm", false); //$NON-NLS-1$
- if (st != null) {
- st.nextToken(); // int size; // Size of the process in pages
- int resident = Integer.parseInt(st.nextToken()); // Resident size in pages.
- st.nextToken(); // int shared; // Shared size in pages.
- int trs = Integer.parseInt(st.nextToken()); // Text (code) size in pages.
- int drs = Integer.parseInt(st.nextToken()); // Data/Stack size in pages.
- int lrs = Integer.parseInt(st.nextToken()); // Library size in pages.
- // st.nextToken(); // int dt; // Dirty pages.
-
- addScalar(scalars, InternalDimensions.WORKING_SET, resident * PAGESIZE);
- addScalar(scalars, InternalDimensions.TRS, trs * PAGESIZE);
- addScalar(scalars, InternalDimensions.DRS, drs * PAGESIZE);
- addScalar(scalars, InternalDimensions.LRS, lrs * PAGESIZE);
- }
+ /**
+ * Write out operating system counters for Linux.
+ *
+ * @param scalars
+ */
+ protected void collectOperatingSystemCounters(Map scalars) {
+ synchronized (this) {
+ /**
+ * The status values for a Linux process, that is the values that come from /proc/self/stat. The names of the variables match
+ * the man proc page.
+ */
+ StringTokenizer st = readTokens("/proc/self/stat", false); //$NON-NLS-1$
+ if (st != null) {
+ st.nextToken(); // int pid; // Process id.
+ st.nextToken(); // String comm; // The command name.
+ st.nextToken(); // String state;
+ st.nextToken(); // int ppid; // Parent process id. */
+ st.nextToken(); // int pgrp; // Process group. */
+ st.nextToken(); // int session;
+ st.nextToken(); // int ttry_nr;
+ st.nextToken(); // int tpgid;
+ st.nextToken(); // long flags;
+ long minflt = Long.parseLong(st.nextToken()); // Minor page faults (didn't need to load a page from disk). */
+ st.nextToken(); // long cminflt; // Minor page faults for the process and it's children. */
+ long majflt = Long.parseLong(st.nextToken()); // Major page faults. */
+ st.nextToken(); // long cmajflt; // Major page faults for the process and it's children. */
+ long utime = Long.parseLong(st.nextToken()); // User time in jiffies. */
+ long stime = Long.parseLong(st.nextToken()); // System time in jiffies. */
+ st.nextToken(); // long cutime; // User time for the process and it's children. */
+ st.nextToken(); // long cstime; // System time for the process and it's children. */
- long currentTime = System.currentTimeMillis();
- if (!PerformanceTestPlugin.isOldDB())
- addScalar(scalars, InternalDimensions.SYSTEM_TIME, currentTime);
-
- if (fgHasElapsedTime) {
- if (fgStartupTime == 0) {
- String t = System.getProperty("eclipse.startTime"); //$NON-NLS-1$
- if (t != null) {
- try {
- fgStartupTime = Long.parseLong(t);
- }
- catch (NumberFormatException e) {
- fgHasElapsedTime = false;
- }
- } else
- fgHasElapsedTime = false;
- }
- if (fgHasElapsedTime)
- addScalar(scalars, InternalDimensions.ELAPSED_PROCESS, currentTime - fgStartupTime);
- }
+ // addScalar(scalars, InternalDimensions.USER_TIME, utime*JIFFIES);
+ addScalar(scalars, InternalDimensions.KERNEL_TIME, stime * JIFFIES);
+ addScalar(scalars, InternalDimensions.CPU_TIME, (utime + stime) * JIFFIES);
+ addScalar(scalars, InternalDimensions.SOFT_PAGE_FAULTS, minflt);
+ addScalar(scalars, InternalDimensions.HARD_PAGE_FAULTS, majflt);
+ }
- super.collectOperatingSystemCounters(scalars);
- }
- }
+ /**
+ * The status memory values values for a Linux process, that is the values that come from /proc/self/statm. The names of the
+ * variables match the man proc page.
+ */
+ st = readTokens("/proc/self/statm", false); //$NON-NLS-1$
+ if (st != null) {
+ st.nextToken(); // int size; // Size of the process in pages
+ int resident = Integer.parseInt(st.nextToken()); // Resident size in pages.
+ st.nextToken(); // int shared; // Shared size in pages.
+ int trs = Integer.parseInt(st.nextToken()); // Text (code) size in pages.
+ int drs = Integer.parseInt(st.nextToken()); // Data/Stack size in pages.
+ int lrs = Integer.parseInt(st.nextToken()); // Library size in pages.
+ // st.nextToken(); // int dt; // Dirty pages.
- /**
- * Write out the global machine counters for Linux.
- *
- * @param scalars
- */
- protected void collectGlobalPerformanceInfo(Map scalars) {
- synchronized (this) {
- /**
- * The meminfo values for a Linux machine, that is the values that come from /proc/meminfo.
- */
- // /proc/meminfo is formatted on linux - use byte-counted output from free
- StringTokenizer st = readOutput("free -b", true); //$NON-NLS-1$
- if (st != null) {
- st.nextToken(); // throw away label
- long total = Long.parseLong(st.nextToken());
- long used = Long.parseLong(st.nextToken());
- long free = Long.parseLong(st.nextToken());
- st.nextToken(); // long shared;
- long buffers = Long.parseLong(st.nextToken());
- long cache = Long.parseLong(st.nextToken());
-
- addScalar(scalars, InternalDimensions.PHYSICAL_TOTAL, total);
- addScalar(scalars, InternalDimensions.USED_LINUX_MEM, used);
- addScalar(scalars, InternalDimensions.FREE_LINUX_MEM, free);
- addScalar(scalars, InternalDimensions.BUFFERS_LINUX, buffers);
- addScalar(scalars, InternalDimensions.SYSTEM_CACHE, cache);
- }
- super.collectGlobalPerformanceInfo(scalars);
- }
- }
+ addScalar(scalars, InternalDimensions.WORKING_SET, resident * PAGESIZE);
+ addScalar(scalars, InternalDimensions.TRS, trs * PAGESIZE);
+ addScalar(scalars, InternalDimensions.DRS, drs * PAGESIZE);
+ addScalar(scalars, InternalDimensions.LRS, lrs * PAGESIZE);
+ }
- private StringTokenizer readTokens(String procPath, boolean skipFirst) {
- BufferedReader rdr = null;
- try {
- rdr = new BufferedReader(new FileReader(procPath));
- if (skipFirst)
- rdr.readLine(); // throw away the heading line
- return new StringTokenizer(rdr.readLine());
- }
- catch (IOException e) {
- PerformanceTestPlugin.log(e);
- }
- finally {
+ long currentTime = System.currentTimeMillis();
+
+ addScalar(scalars, InternalDimensions.SYSTEM_TIME, currentTime);
+
+ if (fgHasElapsedTime) {
+ if (fgStartupTime == 0) {
+ String t = System.getProperty("eclipse.startTime"); //$NON-NLS-1$
+ if (t != null) {
try {
- if (rdr != null)
- rdr.close();
- }
- catch (IOException e) {
- // silently ignored
+ fgStartupTime = Long.parseLong(t);
+ } catch (NumberFormatException e) {
+ fgHasElapsedTime = false;
}
+ } else
+ fgHasElapsedTime = false;
}
- return null;
+ if (fgHasElapsedTime)
+ addScalar(scalars, InternalDimensions.ELAPSED_PROCESS, currentTime - fgStartupTime);
+ }
+
+ super.collectOperatingSystemCounters(scalars);
}
+ }
- private StringTokenizer readOutput(String cmd, boolean skipFirst) {
- BufferedReader rdr = null;
- try {
- Process process = Runtime.getRuntime().exec(cmd);
- rdr = new BufferedReader(new InputStreamReader(process.getInputStream()));
- if (skipFirst)
- rdr.readLine(); // throw away the heading line
- return new StringTokenizer(rdr.readLine());
- }
- catch (IOException e) {
- PerformanceTestPlugin.log(e);
- }
- finally {
- try {
- if (rdr != null)
- rdr.close();
- }
- catch (IOException e) {
- // silently ignored
- }
- }
- return null;
+ /**
+ * Write out the global machine counters for Linux.
+ *
+ * @param scalars
+ */
+ protected void collectGlobalPerformanceInfo(Map scalars) {
+ synchronized (this) {
+ /**
+ * The meminfo values for a Linux machine, that is the values that come from /proc/meminfo.
+ */
+ // /proc/meminfo is formatted on linux - use byte-counted output from free
+ StringTokenizer st = readOutput("free -b", true); //$NON-NLS-1$
+ if (st != null) {
+ st.nextToken(); // throw away label
+ long total = Long.parseLong(st.nextToken());
+ long used = Long.parseLong(st.nextToken());
+ long free = Long.parseLong(st.nextToken());
+ st.nextToken(); // long shared;
+ long buffers = Long.parseLong(st.nextToken());
+ long cache = Long.parseLong(st.nextToken());
+
+ addScalar(scalars, InternalDimensions.PHYSICAL_TOTAL, total);
+ addScalar(scalars, InternalDimensions.USED_LINUX_MEM, used);
+ addScalar(scalars, InternalDimensions.FREE_LINUX_MEM, free);
+ addScalar(scalars, InternalDimensions.BUFFERS_LINUX, buffers);
+ addScalar(scalars, InternalDimensions.SYSTEM_CACHE, cache);
+ }
+ super.collectGlobalPerformanceInfo(scalars);
+ }
+ }
+
+ private StringTokenizer readTokens(String procPath, boolean skipFirst) {
+ BufferedReader rdr = null;
+ try {
+ rdr = new BufferedReader(new FileReader(procPath));
+ if (skipFirst)
+ rdr.readLine(); // throw away the heading line
+ return new StringTokenizer(rdr.readLine());
+ } catch (IOException e) {
+ PerformanceTestPlugin.log(e);
+ }
+ finally {
+ try {
+ if (rdr != null)
+ rdr.close();
+ } catch (IOException e) {
+ // silently ignored
+ }
+ }
+ return null;
+ }
+
+ private StringTokenizer readOutput(String cmd, boolean skipFirst) {
+ BufferedReader rdr = null;
+ try {
+ Process process = Runtime.getRuntime().exec(cmd);
+ rdr = new BufferedReader(new InputStreamReader(process.getInputStream()));
+ if (skipFirst)
+ rdr.readLine(); // throw away the heading line
+ return new StringTokenizer(rdr.readLine());
+ } catch (IOException e) {
+ PerformanceTestPlugin.log(e);
+ }
+ finally {
+ try {
+ if (rdr != null)
+ rdr.close();
+ } catch (IOException e) {
+ // silently ignored
+ }
}
+ return null;
+ }
}
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorMac.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorMac.java
index d515ff1e..930f631c 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorMac.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceMonitorMac.java
@@ -15,102 +15,100 @@ import java.util.Map;
*/
class PerformanceMonitorMac extends PerformanceMonitor {
- private static boolean fgHasElapsedTime = true;
- private static long fgStartupTime;
+ private static boolean fgHasElapsedTime = true;
+ private static long fgStartupTime;
- /**
- * name of the library that implements the native methods.
- */
- private static final String NATIVE_LIBRARY_NAME = "perf_3_1_0"; //$NON-NLS-1$
+ /**
+ * name of the library that implements the native methods.
+ */
+ private static final String NATIVE_LIBRARY_NAME = "perf_3_1_0"; //$NON-NLS-1$
- /**
- * Is the native library loaded? 0-don't know, 1-no, 2-yes
- */
- private static int fgIsLoaded = 0;
+ /**
+ * Is the native library loaded? 0-don't know, 1-no, 2-yes
+ */
+ private static int fgIsLoaded = 0;
- /**
- * Answer true if the native library for this class has been successfully loaded. If the load has not been attempted yet, try to
- * load it.
- *
- * @return returns true if native library has been successfullz loaded
- */
- public static boolean isLoaded() {
- if (fgIsLoaded == 0) {
- try {
- System.loadLibrary(NATIVE_LIBRARY_NAME);
- fgIsLoaded = 2;
- }
- catch (Throwable e) {
- // e.printStackTrace();
- // PerformanceTestPlugin.log(e);
- fgIsLoaded = 1;
- }
- }
- return fgIsLoaded == 2;
+ /**
+ * Answer true if the native library for this class has been successfully loaded. If the load has not been attempted yet, try to
+ * load it.
+ *
+ * @return returns true if native library has been successfullz loaded
+ */
+ public static boolean isLoaded() {
+ if (fgIsLoaded == 0) {
+ try {
+ System.loadLibrary(NATIVE_LIBRARY_NAME);
+ fgIsLoaded = 2;
+ } catch (Throwable e) {
+ // e.printStackTrace();
+ // PerformanceTestPlugin.log(e);
+ fgIsLoaded = 1;
+ }
}
+ return fgIsLoaded == 2;
+ }
- /**
- * Write out operating system counters for Mac OS X.
- *
- * @param scalars
- * where to collect the data
- */
- protected void collectOperatingSystemCounters(Map scalars) {
- synchronized (this) {
- if (isLoaded()) {
- int[] counters = new int[18];
- if (getrusage(0, counters) == 0) {
+ /**
+ * Write out operating system counters for Mac OS X.
+ *
+ * @param scalars
+ * where to collect the data
+ */
+ protected void collectOperatingSystemCounters(Map scalars) {
+ synchronized (this) {
+ if (isLoaded()) {
+ int[] counters = new int[18];
+ if (getrusage(0, counters) == 0) {
- int user_time = counters[0] * 1000 + counters[1] / 1000;
- int kernel_time = counters[2] * 1000 + counters[3] / 1000;
+ int user_time = counters[0] * 1000 + counters[1] / 1000;
+ int kernel_time = counters[2] * 1000 + counters[3] / 1000;
- addScalar(scalars, InternalDimensions.KERNEL_TIME, kernel_time);
- addScalar(scalars, InternalDimensions.CPU_TIME, user_time + kernel_time);
- }
- }
+ addScalar(scalars, InternalDimensions.KERNEL_TIME, kernel_time);
+ addScalar(scalars, InternalDimensions.CPU_TIME, user_time + kernel_time);
+ }
+ }
- long currentTime = System.currentTimeMillis();
- if (!PerformanceTestPlugin.isOldDB())
- addScalar(scalars, InternalDimensions.SYSTEM_TIME, currentTime);
+ long currentTime = System.currentTimeMillis();
- if (fgHasElapsedTime) {
- if (fgStartupTime == 0) {
- String t = System.getProperty("eclipse.startTime"); //$NON-NLS-1$
- if (t != null) {
- try {
- fgStartupTime = Long.parseLong(t);
- }
- catch (NumberFormatException e) {
- fgHasElapsedTime = false;
- }
- } else
- fgHasElapsedTime = false;
- }
- if (fgHasElapsedTime)
- addScalar(scalars, InternalDimensions.ELAPSED_PROCESS, currentTime - fgStartupTime);
- }
+ addScalar(scalars, InternalDimensions.SYSTEM_TIME, currentTime);
- super.collectOperatingSystemCounters(scalars);
+ if (fgHasElapsedTime) {
+ if (fgStartupTime == 0) {
+ String t = System.getProperty("eclipse.startTime"); //$NON-NLS-1$
+ if (t != null) {
+ try {
+ fgStartupTime = Long.parseLong(t);
+ } catch (NumberFormatException e) {
+ fgHasElapsedTime = false;
+ }
+ } else
+ fgHasElapsedTime = false;
}
+ if (fgHasElapsedTime)
+ addScalar(scalars, InternalDimensions.ELAPSED_PROCESS, currentTime - fgStartupTime);
+ }
+
+ super.collectOperatingSystemCounters(scalars);
}
+ }
- // struct rusage {
- // 0,1 struct timeval ru_utime; /* user time used */
- // 2,3 struct timeval ru_stime; /* system time used */
- // 4 long ru_maxrss; /* integral max resident set size */
- // 5 long ru_ixrss; /* integral shared text memory size */
- // 6 long ru_idrss; /* integral unshared data size */
- // 7 long ru_isrss; /* integral unshared stack size */
- // 8 long ru_minflt; /* page reclaims */
- // 9 long ru_majflt; /* page faults */
- // 10 long ru_nswap; /* swaps */
- // 11 long ru_inblock; /* block input operations */
- // 12 long ru_oublock; /* block output operations */
- // 13 long ru_msgsnd; /* messages sent */
- // 14 long ru_msgrcv; /* messages received */
- // 15 long ru_nsignals; /* signals received */
- // 16 long ru_nvcsw; /* voluntary context switches */
- // 17 long ru_nivcsw; /* involuntary context switches */
- // };
- private static native int getrusage(int who, int[] counters);
+ // struct rusage {
+ // 0,1 struct timeval ru_utime; /* user time used */
+ // 2,3 struct timeval ru_stime; /* system time used */
+ // 4 long ru_maxrss; /* integral max resident set size */
+ // 5 long ru_ixrss; /* integral shared text memory size */
+ // 6 long ru_idrss; /* integral unshared data size */
+ // 7 long ru_isrss; /* integral unshared stack size */
+ // 8 long ru_minflt; /* page reclaims */
+ // 9 long ru_majflt; /* page faults */
+ // 10 long ru_nswap; /* swaps */
+ // 11 long ru_inblock; /* block input operations */
+ // 12 long ru_oublock; /* block output operations */
+ // 13 long ru_msgsnd; /* messages sent */
+ // 14 long ru_msgrcv; /* messages received */
+ // 15 long ru_nsignals; /* signals received */
+ // 16 long ru_nvcsw; /* voluntary context switches */
+ // 17 long ru_nivcsw; /* involuntary context switches */
+ // };
+ private static native int getrusage(int who, int[] counters);
}
diff --git a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java
index e60b7dfa..4af8a1f4 100644
--- a/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java
+++ b/bundles/org.eclipse.test.performance/src/org/eclipse/test/internal/performance/PerformanceTestPlugin.java
@@ -27,363 +27,329 @@ import org.osgi.framework.BundleContext;
*/
public class PerformanceTestPlugin extends Plugin {
- public static final String CONFIG = "config"; //$NON-NLS-1$
- public static final String BUILD = "build"; //$NON-NLS-1$
-
- private static final String DEFAULT_DB_NAME = "perfDB"; //$NON-NLS-1$
- private static final String DEFAULT_DB_USER = "guest"; //$NON-NLS-1$
- private static final String DEFAULT_DB_PASSWORD = "guest"; //$NON-NLS-1$
-
- private static final String DB_NAME = "dbname"; //$NON-NLS-1$
- private static final String DB_USER = "dbuser"; //$NON-NLS-1$
- private static final String DB_PASSWD = "dbpasswd"; //$NON-NLS-1$
-
- /*
- * New properties
- */
- private static final String ECLIPSE_PERF_DBLOC = "eclipse.perf.dbloc"; //$NON-NLS-1$
- private static final String ECLIPSE_PERF_ASSERTAGAINST = "eclipse.perf.assertAgainst"; //$NON-NLS-1$
- private static final String ECLIPSE_PERF_CONFIG = "eclipse.perf.config"; //$NON-NLS-1$
- private static final String ECLIPSE_PERF_DEFAULT_DIM = "eclipse.perf.default.dim"; //$NON-NLS-1$
- private static final String ECLIPSE_PERF_RESULTS_DIMENSIONS = "eclipse.perf.results.dimensions"; //$NON-NLS-1$
- private static final String ECLIPSE_PERF_CONFIGS_DESCRIPTOR = "eclipse.perf.configs.descriptor"; //$NON-NLS-1$
-
- /**
- * Supported dimensions.
- * <p>
- * Currently all the dimensions accessible through this interface:
- * <ul>
- * <li>{@link Dimension#KERNEL_TIME}</li>
- * <li>{@link Dimension#CPU_TIME}</li>
- * <li>{@link Dimension#WORKING_SET}</li>
- * <li>{@link Dimension#ELAPSED_PROCESS}</li>
- * <li>{@link Dimension#USED_JAVA_HEAP}</li>
- * <li>{@link Dimension#WORKING_SET_PEAK}</li>
- * <li>{@link Dimension#KERNEL_TIME}</li>
- * </ul>
- * </p>
- */
- private static final Dim[] SUPPORTED_DIMENSIONS = { InternalDimensions.KERNEL_TIME,
- InternalDimensions.CPU_TIME, InternalDimensions.WORKING_SET, InternalDimensions.ELAPSED_PROCESS,
- InternalDimensions.USED_JAVA_HEAP, InternalDimensions.WORKING_SET_PEAK, InternalDimensions.COMITTED, };
-
- /**
- * Identifiers of the supported dimensions.
- */
- private static final int[] SUPPORTED_DIMENSIONS_ID = new int[SUPPORTED_DIMENSIONS.length];
- static {
- int length = SUPPORTED_DIMENSIONS.length;
- for (int i = 0; i < length; i++) {
- SUPPORTED_DIMENSIONS_ID[i] = SUPPORTED_DIMENSIONS[i].getId();
- }
+ public static final String CONFIG = "config"; //$NON-NLS-1$
+ public static final String BUILD = "build"; //$NON-NLS-1$
+
+ private static final String DEFAULT_DB_NAME = "perfDB"; //$NON-NLS-1$
+ private static final String DEFAULT_DB_USER = "guest"; //$NON-NLS-1$
+ private static final String DEFAULT_DB_PASSWORD = "guest"; //$NON-NLS-1$
+
+ private static final String DB_NAME = "dbname"; //$NON-NLS-1$
+ private static final String DB_USER = "dbuser"; //$NON-NLS-1$
+ private static final String DB_PASSWD = "dbpasswd"; //$NON-NLS-1$
+
+ /*
+ * New properties
+ */
+ private static final String ECLIPSE_PERF_DBLOC = "eclipse.perf.dbloc"; //$NON-NLS-1$
+ private static final String ECLIPSE_PERF_ASSERTAGAINST = "eclipse.perf.assertAgainst"; //$NON-NLS-1$
+ private static final String ECLIPSE_PERF_CONFIG = "eclipse.perf.config"; //$NON-NLS-1$
+ private static final String ECLIPSE_PERF_DEFAULT_DIM = "eclipse.perf.default.dim"; //$NON-NLS-1$
+ private static final String ECLIPSE_PERF_RESULTS_DIMENSIONS = "eclipse.perf.results.dimensions"; //$NON-NLS-1$
+ private static final String ECLIPSE_PERF_CONFIGS_DESCRIPTOR = "eclipse.perf.configs.descriptor"; //$NON-NLS-1$
+
+ /**
+ * Supported dimensions.
+ * <p>
+ * Currently all the dimensions accessible through this interface:
+ * <ul>
+ * <li>{@link Dimension#KERNEL_TIME}</li>
+ * <li>{@link Dimension#CPU_TIME}</li>
+ * <li>{@link Dimension#WORKING_SET}</li>
+ * <li>{@link Dimension#ELAPSED_PROCESS}</li>
+ * <li>{@link Dimension#USED_JAVA_HEAP}</li>
+ * <li>{@link Dimension#WORKING_SET_PEAK}</li>
+ * <li>{@link Dimension#KERNEL_TIME}</li>
+ * </ul>
+ * </p>
+ */
+ private static final Dim[] SUPPORTED_DIMENSIONS = { InternalDimensions.KERNEL_TIME, InternalDimensions.CPU_TIME, InternalDimensions.WORKING_SET, InternalDimensions.ELAPSED_PROCESS, InternalDimensions.USED_JAVA_HEAP,
+ InternalDimensions.WORKING_SET_PEAK, InternalDimensions.COMITTED, };
+
+ /**
+ * Identifiers of the supported dimensions.
+ */
+ private static final int[] SUPPORTED_DIMENSIONS_ID = new int[SUPPORTED_DIMENSIONS.length];
+ static {
+ int length = SUPPORTED_DIMENSIONS.length;
+ for (int i = 0; i < length; i++) {
+ SUPPORTED_DIMENSIONS_ID[i] = SUPPORTED_DIMENSIONS[i].getId();
}
-
- /**
- * Default machines names.
- */
- private static final String DEFAULT_CONFIG_DESCRIPTORS = "eplnx1,SLED 10 Sun 1.6.0_17 (2 x 3.00GHz - 3GB RAM); " + //$NON-NLS-1$
- "eplnx2,RHEL 5.0 Sun 6.0_04 (2 x 3.00GHz - 3GB RAM); "
- + //$NON-NLS-1$
- "epwin2,Win XP Sun 1.6.0_17 (2 x 3.00GHz - 3GB RAM); "
- + //$NON-NLS-1$
- "epwin3,Win XP Sun 6.0_17 (2 x 3.00GHz - 3GB RAM);"; //$NON-NLS-1$
-
- /**
- * Default dimension use for performance results.
- */
- private static final Dim DEFAULT_DIMENSION = InternalDimensions.ELAPSED_PROCESS;
-
- /**
- * The dimensions which are put in the generated performance results pages.
- */
- private static final Dim[] DEFAULT_RESULTS_DIMENSIONS = { InternalDimensions.ELAPSED_PROCESS,
- InternalDimensions.CPU_TIME, };
-
- /**
- * The plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.test.performance"; //$NON-NLS-1$
-
- /** Status code describing an internal error */
- public static final int INTERNAL_ERROR = 1;
-
- /**
- * The shared instance.
- */
- private static PerformanceTestPlugin fgPlugin;
-
- /* temporary code */
- private static boolean fgOldDBInitialized;
- private static boolean fgOldDB; // true
- // if
- // we
- // are
- // talking
- // to
- // the
- // old
- // perfDB
- // in
- // Ottawa
-
- /**
- * The constructor.
- */
- public PerformanceTestPlugin() {
- super();
- fgPlugin = this;
+ }
+
+ /**
+ * Default machines names.
+ */
+ private static final String DEFAULT_CONFIG_DESCRIPTORS = ""; //$NON-NLS-1$
+
+ /**
+ * Default dimension use for performance results.
+ */
+ private static final Dim DEFAULT_DIMENSION = InternalDimensions.ELAPSED_PROCESS;
+
+ /**
+ * The dimensions which are put in the generated performance results pages.
+ */
+ private static final Dim[] DEFAULT_RESULTS_DIMENSIONS = { InternalDimensions.ELAPSED_PROCESS, InternalDimensions.CPU_TIME, };
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.test.performance"; //$NON-NLS-1$
+
+ /** Status code describing an internal error */
+ public static final int INTERNAL_ERROR = 1;
+
+ /**
+ * The shared instance.
+ */
+ private static PerformanceTestPlugin fgPlugin;
+
+ /**
+ * The constructor.
+ */
+ public PerformanceTestPlugin() {
+ super();
+ fgPlugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ DB.shutdown();
+ super.stop(context);
+ }
+
+ /*
+ * Returns the shared instance.
+ */
+ public static PerformanceTestPlugin getDefault() {
+ return fgPlugin;
+ }
+
+ /*
+ * -Declipse.perf.dbloc=net://localhost
+ */
+ public static String getDBLocation() {
+ String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
+ if (dbloc != null) {
+ Variations keys = new Variations();
+ keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
+ return keys.getProperty(ECLIPSE_PERF_DBLOC);
}
-
- static boolean isOldDB() {
- if (!fgOldDBInitialized) {
- String loc = getDBLocation();
- if (loc != null && loc.indexOf("relengbuildserv") >= 0) //$NON-NLS-1$
- fgOldDB = true;
- fgOldDBInitialized = true;
- }
- return fgOldDB;
+ return null;
+ }
+
+ public static String getDBName() {
+ String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
+ if (dbloc != null) {
+ Variations keys = new Variations();
+ keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
+ return keys.getProperty(DB_NAME, DEFAULT_DB_NAME);
}
-
- public void stop(BundleContext context) throws Exception {
- DB.shutdown();
- super.stop(context);
+ return DEFAULT_DB_NAME;
+ }
+
+ public static String getDBUser() {
+ String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
+ if (dbloc != null) {
+ Variations keys = new Variations();
+ keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
+ return keys.getProperty(DB_USER, DEFAULT_DB_USER);
}
-
- /*
- * Returns the shared instance.
- */
- public static PerformanceTestPlugin getDefault() {
- return fgPlugin;
- }
-
- /*
- * -Declipse.perf.dbloc=net://localhost
- */
- public static String getDBLocation() {
- String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
- if (dbloc != null) {
- Variations keys = new Variations();
- keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
- return keys.getProperty(ECLIPSE_PERF_DBLOC);
+ return DEFAULT_DB_USER;
+ }
+
+ /**
+ * Returns the default dimension used for performance results.
+ *
+ * @return The default {@link Dimension} or <code>null</code> if the specified default dimension does not match any known
+ * dimensions name.
+ */
+ public static Dimension getDefaultDimension() {
+ String defaultDim = System.getProperty(ECLIPSE_PERF_DEFAULT_DIM);
+ if (defaultDim == null)
+ return DEFAULT_DIMENSION;
+ Dimension dimension = getDimension(defaultDim);
+ Assert.isNotNull(dimension, "Invalid default dimension found in system property '" + ECLIPSE_PERF_DEFAULT_DIM + "': " + defaultDim); //$NON-NLS-1$ //$NON-NLS-2$
+ return dimension;
+ }
+
+ /**
+ * Returns the dimensions displayed in the performance results.
+ *
+ * @return The list of {@link Dimension} which will be displayed in the generated results data pages.
+ */
+ public static Dimension[] getResultsDimensions() {
+ String resultsDimension = System.getProperty(ECLIPSE_PERF_RESULTS_DIMENSIONS);
+ if (resultsDimension == null)
+ return DEFAULT_RESULTS_DIMENSIONS;
+ StringTokenizer tokenizer = new StringTokenizer(resultsDimension, ","); //$NON-NLS-1$
+ List list = new ArrayList();
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken().trim();
+ Dimension dimension = getDimension(token);
+ if (dimension == null) {
+ try {
+ dimension = getDimension(Integer.parseInt(token));
+ } catch (NumberFormatException e) {
+ // skip
}
- return null;
- }
-
- public static String getDBName() {
- String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
- if (dbloc != null) {
- Variations keys = new Variations();
- keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
- return keys.getProperty(DB_NAME, DEFAULT_DB_NAME);
+ if (dimension == null) {
+ System.err.println("Skip invalid results dimension found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "': " + resultsDimension); //$NON-NLS-1$ //$NON-NLS-2$
+ continue;
}
- return DEFAULT_DB_NAME;
+ }
+ list.add(dimension);
}
-
- public static String getDBUser() {
- String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
- if (dbloc != null) {
- Variations keys = new Variations();
- keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
- return keys.getProperty(DB_USER, DEFAULT_DB_USER);
- }
- return DEFAULT_DB_USER;
+ int size = list.size();
+ if (size == 0) {
+ System.err.println("No valid dimension was found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "'!"); //$NON-NLS-1$ //$NON-NLS-2$
+ System.err.println("=> default results dimensions will be used instead!"); //$NON-NLS-1$
+ return DEFAULT_RESULTS_DIMENSIONS;
}
-
- /**
- * Returns the default dimension used for performance results.
- *
- * @return The default {@link Dimension} or <code>null</code> if the specified default dimension does not match any known
- * dimensions name.
- */
- public static Dimension getDefaultDimension() {
- String defaultDim = System.getProperty(ECLIPSE_PERF_DEFAULT_DIM);
- if (defaultDim == null)
- return DEFAULT_DIMENSION;
- Dimension dimension = getDimension(defaultDim);
- Assert.isNotNull(dimension,
- "Invalid default dimension found in system property '" + ECLIPSE_PERF_DEFAULT_DIM + "': " + defaultDim); //$NON-NLS-1$ //$NON-NLS-2$
- return dimension;
+ Dimension[] dimensions = new Dimension[size];
+ list.toArray(dimensions);
+ return dimensions;
+ }
+
+ /**
+ * Returns the names of the dimensions which may be used in the performance results.
+ *
+ * @return The list of the dimension names
+ */
+ public static List getDimensions() {
+ List dimensions = new ArrayList();
+ for (int i = 0; i < SUPPORTED_DIMENSIONS.length; i++) {
+ dimensions.add(SUPPORTED_DIMENSIONS[i].getName());
}
-
- /**
- * Returns the dimensions displayed in the performance results.
- *
- * @return The list of {@link Dimension} which will be displayed in the generated results data pages.
- */
- public static Dimension[] getResultsDimensions() {
- String resultsDimension = System.getProperty(ECLIPSE_PERF_RESULTS_DIMENSIONS);
- if (resultsDimension == null)
- return DEFAULT_RESULTS_DIMENSIONS;
- StringTokenizer tokenizer = new StringTokenizer(resultsDimension, ","); //$NON-NLS-1$
- List list = new ArrayList();
- while (tokenizer.hasMoreTokens()) {
- String token = tokenizer.nextToken().trim();
- Dimension dimension = getDimension(token);
- if (dimension == null) {
- try {
- dimension = getDimension(Integer.parseInt(token));
- }
- catch (NumberFormatException e) {
- // skip
- }
- if (dimension == null) {
- System.err
- .println("Skip invalid results dimension found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "': " + resultsDimension); //$NON-NLS-1$ //$NON-NLS-2$
- continue;
- }
- }
- list.add(dimension);
- }
- int size = list.size();
- if (size == 0) {
- System.err.println("No valid dimension was found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "'!"); //$NON-NLS-1$ //$NON-NLS-2$
- System.err.println("=> default results dimensions will be used instead!"); //$NON-NLS-1$
- return DEFAULT_RESULTS_DIMENSIONS;
- }
- Dimension[] dimensions = new Dimension[size];
- list.toArray(dimensions);
- return dimensions;
+ return dimensions;
+ }
+
+ /**
+ * Return the dimension corresponding to the given id.
+ *
+ * @param id
+ * The id of the searched dimension.
+ * @return The {@link Dimension} or <code>null</code> if none is found.
+ */
+ public static Dimension getDimension(int id) {
+ int length = SUPPORTED_DIMENSIONS.length;
+ for (int i = 0; i < length; i++) {
+ if (SUPPORTED_DIMENSIONS[i].getId() == id) {
+ return SUPPORTED_DIMENSIONS[i];
+ }
}
-
- /**
- * Returns the names of the dimensions which may be used in the performance results.
- *
- * @return The list of the dimension names
- */
- public static List getDimensions() {
- List dimensions = new ArrayList();
- for (int i = 0; i < SUPPORTED_DIMENSIONS.length; i++) {
- dimensions.add(SUPPORTED_DIMENSIONS[i].getName());
- }
- return dimensions;
+ return null;
+ }
+
+ /**
+ * Return the dimension corresponding to the given id.
+ *
+ * @param name
+ * The name of the searched dimension.
+ * @return The {@link Dimension} or <code>null</code> if none is found.
+ */
+ public static Dimension getDimension(String name) {
+ int length = SUPPORTED_DIMENSIONS.length;
+ for (int i = 0; i < length; i++) {
+ if (SUPPORTED_DIMENSIONS[i].getName().equals(name)) {
+ return SUPPORTED_DIMENSIONS[i];
+ }
}
-
- /**
- * Return the dimension corresponding to the given id.
- *
- * @param id
- * The id of the searched dimension.
- * @return The {@link Dimension} or <code>null</code> if none is found.
- */
- public static Dimension getDimension(int id) {
- int length = SUPPORTED_DIMENSIONS.length;
- for (int i = 0; i < length; i++) {
- if (SUPPORTED_DIMENSIONS[i].getId() == id) {
- return SUPPORTED_DIMENSIONS[i];
- }
- }
- return null;
+ return null;
+ }
+
+ /**
+ * Return the descriptors of the configurations used for the performances.
+ *
+ * @return An array of 2 strings, the former is the name of the configuration and the latter its description.
+ */
+ public static String[][] getConfigDescriptors() {
+ String descriptors = System.getProperty(ECLIPSE_PERF_CONFIGS_DESCRIPTOR, DEFAULT_CONFIG_DESCRIPTORS);
+ StringTokenizer tokenizer = new StringTokenizer(descriptors, ",;"); //$NON-NLS-1$
+ List list = new ArrayList();
+ while (tokenizer.hasMoreTokens()) {
+ String[] config = new String[2];
+ config[0] = tokenizer.nextToken().trim(); // config name
+ config[1] = tokenizer.nextToken().trim(); // config description
+ list.add(config);
}
-
- /**
- * Return the dimension corresponding to the given id.
- *
- * @param name
- * The name of the searched dimension.
- * @return The {@link Dimension} or <code>null</code> if none is found.
- */
- public static Dimension getDimension(String name) {
- int length = SUPPORTED_DIMENSIONS.length;
- for (int i = 0; i < length; i++) {
- if (SUPPORTED_DIMENSIONS[i].getName().equals(name)) {
- return SUPPORTED_DIMENSIONS[i];
- }
- }
- return null;
- }
-
- /**
- * Return the descriptors of the configurations used for the performances.
- *
- * @return An array of 2 strings, the former is the name of the configuration and the latter its description.
- */
- public static String[][] getConfigDescriptors() {
- String descriptors = System.getProperty(ECLIPSE_PERF_CONFIGS_DESCRIPTOR, DEFAULT_CONFIG_DESCRIPTORS);
- StringTokenizer tokenizer = new StringTokenizer(descriptors, ",;"); //$NON-NLS-1$
- List list = new ArrayList();
- while (tokenizer.hasMoreTokens()) {
- String[] config = new String[2];
- config[0] = tokenizer.nextToken().trim(); // config name
- config[1] = tokenizer.nextToken().trim(); // config description
- list.add(config);
- }
- String[][] configDescriptors = new String[list.size()][];
- list.toArray(configDescriptors);
- return configDescriptors;
- }
-
- public static String getDBPassword() {
- String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
- if (dbloc != null) {
- Variations keys = new Variations();
- keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
- return keys.getProperty(DB_PASSWD, DEFAULT_DB_PASSWORD);
- }
- return DEFAULT_DB_PASSWORD;
- }
-
- /*
- * -Declipse.perf.config=<varname1>=<varval1>;<varname2>=<varval2>;...;<varnameN>=<varvalN>
- */
- public static Variations getVariations() {
- Variations keys = new Variations();
- String configKey = System.getProperty(ECLIPSE_PERF_CONFIG);
- if (configKey != null)
- keys.parsePairs(configKey);
- return keys;
- }
-
- /*
- * -Declipse.perf.assertAgainst=<varname1>=<varval1>;<varname2>=<varval2>;...;<varnameN>=<varvalN> Returns null if assertAgainst
- * property isn't defined.
- */
- public static Variations getAssertAgainst() {
- String assertKey = System.getProperty(ECLIPSE_PERF_ASSERTAGAINST);
- if (assertKey != null) {
- Variations keys = getVariations();
- if (keys == null)
- keys = new Variations();
- keys.parsePairs(assertKey);
- return keys;
- }
- return null;
- }
-
- // logging
-
- public static void logError(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, message, null));
+ String[][] configDescriptors = new String[list.size()][];
+ list.toArray(configDescriptors);
+ return configDescriptors;
+ }
+
+ public static String getDBPassword() {
+ String dbloc = System.getProperty(ECLIPSE_PERF_DBLOC);
+ if (dbloc != null) {
+ Variations keys = new Variations();
+ keys.parsePairs(ECLIPSE_PERF_DBLOC + '=' + dbloc);
+ return keys.getProperty(DB_PASSWD, DEFAULT_DB_PASSWORD);
}
-
- public static void logWarning(String message) {
- if (message == null)
- message = ""; //$NON-NLS-1$
- log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null));
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Internal Error", e)); //$NON-NLS-1$
+ return DEFAULT_DB_PASSWORD;
+ }
+
+ /*
+ * -Declipse.perf.config=<varname1>=<varval1>;<varname2>=<varval2>;...;<varnameN>=<varvalN>
+ */
+ public static Variations getVariations() {
+ Variations keys = new Variations();
+ String configKey = System.getProperty(ECLIPSE_PERF_CONFIG);
+ if (configKey != null)
+ keys.parsePairs(configKey);
+ return keys;
+ }
+
+ /*
+ * -Declipse.perf.assertAgainst=<varname1>=<varval1>;<varname2>=<varval2>;...;<varnameN>=<varvalN> Returns null if assertAgainst
+ * property isn't defined.
+ */
+ public static Variations getAssertAgainst() {
+ String assertKey = System.getProperty(ECLIPSE_PERF_ASSERTAGAINST);
+ if (assertKey != null) {
+ Variations keys = getVariations();
+ if (keys == null)
+ keys = new Variations();
+ keys.parsePairs(assertKey);
+ return keys;
}
-
- public static void log(IStatus status) {
- if (fgPlugin != null) {
- fgPlugin.getLog().log(status);
- } else {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- System.err.println("Error: " + status.getMessage()); //$NON-NLS-1$
- break;
- case IStatus.WARNING:
- System.err.println("Warning: " + status.getMessage()); //$NON-NLS-1$
- break;
- default:
- break;
- }
- Throwable exception = status.getException();
- if (exception != null)
- exception.printStackTrace(System.err);
- }
+ return null;
+ }
+
+ // logging
+
+ public static void logError(String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, message, null));
+ }
+
+ public static void logWarning(String message) {
+ if (message == null)
+ message = ""; //$NON-NLS-1$
+ log(new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null));
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, INTERNAL_ERROR, "Internal Error", e)); //$NON-NLS-1$
+ }
+
+ public static void log(IStatus status) {
+ if (fgPlugin != null) {
+ fgPlugin.getLog().log(status);
+ } else {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ System.err.println("Error: " + status.getMessage()); //$NON-NLS-1$
+ break;
+ case IStatus.WARNING:
+ System.err.println("Warning: " + status.getMessage()); //$NON-NLS-1$
+ break;
+ default:
+ break;
+ }
+ Throwable exception = status.getException();
+ if (exception != null)
+ exception.printStackTrace(System.err);
}
+ }
}

Back to the top