|
From: <fd...@us...> - 2011-08-24 18:28:11
|
Revision: 5862
http://jnode.svn.sourceforge.net/jnode/?rev=5862&view=rev
Author: fduminy
Date: 2011-08-24 18:28:04 +0000 (Wed, 24 Aug 2011)
Log Message:
-----------
applied coding rules
Signed-off-by: Fabien DUMINY <fd...@jn...>
Modified Paths:
--------------
trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
Modified: trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java
===================================================================
--- trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:27:24 UTC (rev 5861)
+++ trunk/cli/src/commands/org/jnode/command/system/OnHeapCommand.java 2011-08-24 18:28:04 UTC (rev 5862)
@@ -38,20 +38,20 @@
*/
public class OnHeapCommand extends AbstractCommand {
- private static final String help_inst = "the minimum instance count to show";
- private static final String help_size = "the minimum total size to show";
+ private static final String HELP_INST = "the minimum instance count to show";
+ private static final String HELP_SIZE = "the minimum total size to show";
private static final String HELP_CLASSNAME = "the classname filter";
- private static final String help_super = "Show the number of instances on the heap with memory usage";
- private static final String str_on_heap = "On Heap:";
+ private static final String HELP_SUPER = "Show the number of instances on the heap with memory usage";
+ private static final String STR_ON_HEAP = "On Heap:";
private final IntegerArgument argMinInstanceCount;
private final LongArgument argMinTotalSize;
private final StringArgument className;
public OnHeapCommand() {
- super(help_super);
- argMinInstanceCount = new IntegerArgument("minCount", Argument.OPTIONAL, 1, Integer.MAX_VALUE, help_inst);
- argMinTotalSize = new LongArgument("minTotalSize", Argument.OPTIONAL, 1L, Long.MAX_VALUE, help_size);
+ super(HELP_SUPER);
+ argMinInstanceCount = new IntegerArgument("minCount", Argument.OPTIONAL, 1, Integer.MAX_VALUE, HELP_INST);
+ argMinTotalSize = new LongArgument("minTotalSize", Argument.OPTIONAL, 1L, Long.MAX_VALUE, HELP_SIZE);
className = new StringArgument("className", Argument.OPTIONAL | Argument.MULTIPLE, HELP_CLASSNAME);
registerArguments(argMinInstanceCount, argMinTotalSize, className);
}
@@ -66,7 +66,7 @@
@Override
public void execute() throws Exception {
PrintWriter out = getOutput().getPrintWriter();
- out.println(str_on_heap);
+ out.println(STR_ON_HEAP);
ObjectFilter filter = null;
if (className.isSet()) {
Modified: trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:27:24 UTC (rev 5861)
+++ trunk/core/src/core/org/jnode/vm/memmgr/def/DefHeapStatistics.java 2011-08-24 18:28:04 UTC (rev 5862)
@@ -40,8 +40,10 @@
private ObjectFilter objectFilter = NoObjectFilter.INSTANCE;
private final TreeMap<String, HeapCounter> countData = new TreeMap<String, HeapCounter>();
- private static final char newline = '\n';
-
+ private static final char NEWLINE = '\n';
+ private static final String USAGE = " memory usage=";
+ private static final String NO_MATCHING_OBJECT = "No object is matching criteria";
+
public boolean contains(String classname) {
// If we don't accept this class, we pretend to have it already to (maybe) avoid unnecessary work
// and memory allocation (we also hope to avoid a call to add(String, int)).
@@ -97,20 +99,20 @@
boolean first = true;
if (countData.isEmpty()) {
- a.append("No object is matching criteria");
+ a.append(NO_MATCHING_OBJECT);
} else {
for (HeapCounter c : countData.values()) {
if ((c.getInstanceCount() >= minInstanceCount) && (c.getTotalSize() >= minTotalSize)) {
if (first) {
first = false;
} else {
- a.append(newline);
+ a.append(NEWLINE);
}
c.append(a);
}
}
}
- a.append(newline);
+ a.append(NEWLINE);
}
/**
@@ -133,8 +135,6 @@
private int instanceCount;
private int objectSize = 0;
- private static final String usage = " memory usage=";
-
public HeapCounter(String objectName, int objectSize) {
this.name = objectName;
this.objectSize = objectSize;
@@ -163,7 +163,7 @@
a.append(Integer.toString(instanceCount));
if (objectSize != 0) {
- a.append(usage);
+ a.append(USAGE);
long size = getTotalSize();
if (size >= 1024) {
a.append(NumberUtils.toBinaryByte(size)).append(" (");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|