diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-18 17:29:21 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-05-18 17:29:21 +0000 |
commit | 64089cc9f030d8ef7972adb5d117e0b23f47d62b (patch) | |
tree | 9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/vm/reference/java/lang/VMSystem.java | |
parent | 96034e28360d660d7a7708807fcbc4b519574d8e (diff) | |
download | ppe42-gcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.tar.gz ppe42-gcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.zip |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale.
* sources.am: Regenerated.
* gcj/javaprims.h: Regenerated.
* Makefile.in: Regenerated.
* gcj/Makefile.in: Regenerated.
* include/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
* gnu/java/lang/VMInstrumentationImpl.java: New override.
* gnu/java/net/local/LocalSocketImpl.java: Likewise.
* gnu/classpath/jdwp/VMMethod.java: Likewise.
* gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest
interface.
* java/lang/Thread.java: Add UncaughtExceptionHandler.
* java/lang/reflect/Method.java: Implements GenericDeclaration and
isSynthetic(),
* java/lang/reflect/Field.java: Likewise.
* java/lang/reflect/Constructor.java
* java/lang/Class.java: Implements Type, GenericDeclaration,
getSimpleName() and getEnclosing*() methods.
* java/lang/Class.h: Add new public methods.
* java/lang/Math.java: Add signum(), ulp() and log10().
* java/lang/natMath.cc (log10): New function.
* java/security/VMSecureRandom.java: New override.
* java/util/logging/Logger.java: Updated to latest classpath
version.
* java/util/logging/LogManager.java: New override.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113887 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/vm/reference/java/lang/VMSystem.java')
-rw-r--r-- | libjava/classpath/vm/reference/java/lang/VMSystem.java | 71 |
1 files changed, 55 insertions, 16 deletions
diff --git a/libjava/classpath/vm/reference/java/lang/VMSystem.java b/libjava/classpath/vm/reference/java/lang/VMSystem.java index 8a83cad92ff..f96986df373 100644 --- a/libjava/classpath/vm/reference/java/lang/VMSystem.java +++ b/libjava/classpath/vm/reference/java/lang/VMSystem.java @@ -37,6 +37,8 @@ exception statement from your version. */ package java.lang; +import java.util.List; + import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileDescriptor; @@ -50,6 +52,7 @@ import java.io.PrintStream; * VM must implement. * * @author John Keiser + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ final class VMSystem { @@ -135,40 +138,76 @@ final class VMSystem public static native long currentTimeMillis(); /** + * <p> + * Returns the current value of a nanosecond-precise system timer. + * The value of the timer is an offset relative to some arbitrary fixed + * time, which may be in the future (making the value negative). This + * method is useful for timing events where nanosecond precision is + * required. This is achieved by calling this method before and after the + * event, and taking the difference betweent the two times: + * </p> + * <p> + * <code>long startTime = System.nanoTime();</code><br /> + * <code>... <emph>event code</emph> ...</code><br /> + * <code>long endTime = System.nanoTime();</code><br /> + * <code>long duration = endTime - startTime;</code><br /> + * </p> + * <p> + * Note that the value is only nanosecond-precise, and not accurate; there + * is no guarantee that the difference between two values is really a + * nanosecond. Also, the value is prone to overflow if the offset + * exceeds 2^63. + * </p> + * + * @return the time of a system timer in nanoseconds. + * @since 1.5 + */ + public static long nanoTime() + { + return currentTimeMillis() * 1000; + } + + /** + * Returns a list of 'name=value' pairs representing the current environment + * variables. + * + * @return a list of 'name=value' pairs. + */ + static native List environ(); + + /** * Helper method which creates the standard input stream. * VM implementors may choose to construct these streams differently. * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ - - static InputStream makeStandardInputStream() - { - return new BufferedInputStream(new FileInputStream(FileDescriptor.in)); - } - + static InputStream makeStandardInputStream() + { + return new BufferedInputStream(new FileInputStream(FileDescriptor.in)); + } + /** * Helper method which creates the standard output stream. * VM implementors may choose to construct these streams differently. * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ + static PrintStream makeStandardOutputStream() + { + return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); + } - static PrintStream makeStandardOutputStream() - { - return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); - } /** * Helper method which creates the standard error stream. * VM implementors may choose to construct these streams differently. * This method can also return null if the stream is created somewhere * else in the VM startup sequence. */ - - static PrintStream makeStandardErrorStream() - { - return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true); - } - + static PrintStream makeStandardErrorStream() + { + return new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true); + } + /** * Gets the value of an environment variable. * Always returning null is a valid (but not very useful) implementation. |