From: <cr...@us...> - 2008-04-19 02:54:32
|
Revision: 3975 http://jnode.svn.sourceforge.net/jnode/?rev=3975&view=rev Author: crawley Date: 2008-04-18 19:54:26 -0700 (Fri, 18 Apr 2008) Log Message: ----------- Converted 'GcCommand' Modified Paths: -------------- trunk/shell/descriptors/org.jnode.shell.command.xml trunk/shell/src/shell/org/jnode/shell/command/GcCommand.java Modified: trunk/shell/descriptors/org.jnode.shell.command.xml =================================================================== --- trunk/shell/descriptors/org.jnode.shell.command.xml 2008-04-19 02:42:49 UTC (rev 3974) +++ trunk/shell/descriptors/org.jnode.shell.command.xml 2008-04-19 02:54:26 UTC (rev 3975) @@ -103,6 +103,7 @@ </sequence> </syntax> <syntax alias="exit" description="Exit the current shell"/> + <syntax alias="gc" description="Run the garbage collector"/> <syntax alias="set"> <sequence description="Set a system property"> <argument argLabel="key"/> Modified: trunk/shell/src/shell/org/jnode/shell/command/GcCommand.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/command/GcCommand.java 2008-04-19 02:42:49 UTC (rev 3974) +++ trunk/shell/src/shell/org/jnode/shell/command/GcCommand.java 2008-04-19 02:54:26 UTC (rev 3975) @@ -26,7 +26,6 @@ import org.jnode.shell.AbstractCommand; import org.jnode.shell.CommandLine; -import org.jnode.shell.help.Help; import org.jnode.util.NumberUtils; import org.jnode.vm.Vm; import org.jnode.vm.memmgr.GCStatistics; @@ -36,32 +35,25 @@ */ public class GcCommand extends AbstractCommand { - public static Help.Info HELP_INFO = new Help.Info( - "gc", - "Start the garbage collector" - ); + public GcCommand() { + super("Run the garbage collector"); + } - public static void main(String[] args) - throws Exception { + public static void main(String[] args) throws Exception { new GcCommand().execute(args); } /** * Execute this command */ - public void execute( - CommandLine cmdLine, - InputStream in, - PrintStream out, - PrintStream err) + public void execute(CommandLine cmdLine, InputStream in, PrintStream out, PrintStream err) throws Exception { final Runtime rt = Runtime.getRuntime(); out.println("Memory size: " + NumberUtils.toBinaryByte(rt.totalMemory())); out.println("Free memory: " + NumberUtils.toBinaryByte(rt.freeMemory())); - - out.println("Starting gc..."); + out.println("Starting gc..."); long start = System.currentTimeMillis(); rt.gc(); GCStatistics stats = Vm.getHeapManager().getStatistics(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |