[jboss-cvs] jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model ...
Takuro Okada
t2-okada at nri.co.jp
Thu Oct 26 04:58:57 EDT 2006
User: tokada
Date: 06/10/26 04:58:57
Added: java/src/expansion/org/jboss/profiler/exp/agent/collector/model
Tag: JBossProfiler_Expansion StackMetric.java
ThreadMetric.java Metric.java MetricName.java
ScaleMetric.java TimeScaleMetric.java
Log:
Revision Changes Path
No revision
No revision
1.1.2.1 +59 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/StackMetric.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StackMetric.java
===================================================================
RCS file: StackMetric.java
diff -N StackMetric.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ StackMetric.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public class StackMetric implements Metric<String[]> {
+
+ List<String[]> stacks = new ArrayList<String[]>();
+
+ public void reset() {
+ stacks = new ArrayList<String[]>();
+ }
+
+ public void update(String[] value, Object... args) {
+ for(String[] stack : stacks) {
+ if(Arrays.equals(stack, value)) return;
+ }
+ stacks.add(value);
+ }
+
+ public List<String[]> getStacks() {
+ return stacks;
+ }
+
+ public void setStacks(List<String[]> stacks) {
+ this.stacks = stacks;
+ }
+
+}
1.1.2.1 +102 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/ThreadMetric.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ThreadMetric.java
===================================================================
RCS file: ThreadMetric.java
diff -N ThreadMetric.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ThreadMetric.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ *
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public class ThreadMetric implements Metric<Long> {
+
+ private List<Entry> entries = new ArrayList<Entry>();
+
+ /**
+ * Updates current value.
+ * @param value - the value to update
+ * @param args - [0]:method name, [1]:timestamp, [2]:caller, [3]addition
+ */
+ public void update(Long value, Object... args) {
+ entries.add(new Entry((String)args[0], (Long)args[1], value, args[2], args[3]));
+ }
+
+ public void reset() {
+ entries = new ArrayList<Entry>();
+ }
+
+ public List<Entry> getEntries() {
+ Collections.reverse(entries);
+ Collections.sort(entries);
+ return entries;
+ }
+
+ public class Entry implements Serializable, Comparable<Entry> {
+ private String methodName = null;
+ private long timestamp = 0L;
+ private long value = 0L;
+ private Object caller = null;
+ private Object addition = null;
+
+ public Entry(String methodName, long timestamp, long value, Object caller, Object addition) {
+ this.methodName = methodName;
+ this.timestamp = timestamp;
+ this.value = value;
+ this.addition = addition;
+ this.caller = caller;
+ }
+
+ public int compareTo(Entry entry) {
+ if(this.timestamp>entry.timestamp) return 1;
+ else if(this.timestamp<entry.timestamp) return -1;
+ return 0;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public long getValue() {
+ return value;
+ }
+
+ public Object getCaller() {
+ return caller;
+ }
+
+ public Object getAddition() {
+ return addition;
+ }
+ }
+
+}
1.1.2.1 +49 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/Metric.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Metric.java
===================================================================
RCS file: Metric.java
diff -N Metric.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Metric.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+import java.io.Serializable;
+
+/**
+ * The entity object for metric value.
+ *
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public interface Metric<T> extends Cloneable, Serializable {
+
+ /**
+ * Updates current value.
+ * @param value - the value to update
+ * @param args - optional value
+ */
+ void update(T value, Object... args);
+
+ /**
+ * Resets current value.
+ */
+ void reset();
+
+}
\ No newline at end of file
1.1.2.1 +67 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/MetricName.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MetricName.java
===================================================================
RCS file: MetricName.java
diff -N MetricName.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ MetricName.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+/**
+ * Name given to Metric.
+ *
+ * @see org.jboss.profiler.production.metrics.MetricName
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public enum MetricName {
+
+ CPU_TIME("Elapsed CPU Time"),
+ USER_CPU_TIME("Elapsed CPU Time (User)"),
+
+ WAIT_COUNT("Wait Count"),
+ WAIT_TIME("Wait Time"),
+ BLOCK_COUNT("Block Count"),
+ BLOCK_TIME("BlockTime"),
+
+ MEMORY_USED("Memory Usage"),
+
+ STACK_TRACE("Stack Trace"),
+
+ CPU_TIME_PASSAGE("Elapsed CPU Time"),
+ USER_CPU_TIME_PASSAGE("Elapsed CPU Time (User)"),
+
+ CPU_TIME_PASSAGE_DETAIL("Elapsed CPU Time"),
+ USER_CPU_TIME_PASSAGE_DETAIL("Elapsed CPU Time (User)"),
+ REAL_TIME_PASSAGE_DETAIL("Elapsed Time");
+
+ private String name = null;
+
+ private MetricName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns a string representation.
+ */
+ public String toString() {
+ return this.name;
+ }
+}
\ No newline at end of file
1.1.2.1 +98 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/ScaleMetric.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ScaleMetric.java
===================================================================
RCS file: ScaleMetric.java
diff -N ScaleMetric.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ScaleMetric.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+/**
+ *
+ * @see org.jboss.profiler.production.service.OperationMetric
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public class ScaleMetric implements Metric<Long> {
+
+ private long high = 0L;
+ private long low = 0L;
+ private long average = 0L;
+
+ private long last = 0L;
+
+ private long total = 0L;
+ private long count = 0L;
+
+ public void update(Long elapsed, Object... args) {
+ count++;
+ last = elapsed;
+ if(elapsed > high) {
+ high = elapsed;
+ }
+ if(elapsed < low || count==1) {
+ low = elapsed;
+ }
+ total = total + elapsed;
+ average = total / count;
+ }
+
+ public void reset() {
+ high = 0L;
+ low = 0L;
+ average = 0L;
+ last = 0L;
+ total = 0L;
+ count = 0L;
+ }
+
+ @Override
+ public Metric clone() {
+ ScaleMetric clone = new ScaleMetric();
+ clone.high = this.high;
+ clone.low = this.low;
+ clone.average = this.average;
+ clone.last = this.last;
+ clone.total = this.total;
+ clone.count = this.count;
+ return clone;
+ }
+
+ public long getAverage() {
+ return average;
+ }
+
+ public long getHigh() {
+ return high;
+ }
+
+ public long getLow() {
+ return low;
+ }
+
+ public long getLast() {
+ return last;
+ }
+
+ public long getCount() {
+ return count;
+ }
+
+}
1.1.2.1 +82 -0 jboss-profiler/java/src/expansion/org/jboss/profiler/exp/agent/collector/model/Attic/TimeScaleMetric.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TimeScaleMetric.java
===================================================================
RCS file: TimeScaleMetric.java
diff -N TimeScaleMetric.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ TimeScaleMetric.java 26 Oct 2006 08:58:56 -0000 1.1.2.1
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.profiler.exp.agent.collector.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author Takuro Okada (Nomura Research Institute, Ltd.)
+ * Copyright 2006 Nomura Research Institute, Ltd. All Rights Reserved.
+ * Copyright(c) Information-technology Promotion Agency, Japan. All rights reserved 2006.
+ * Result of Open Source Software Development Activities of Information-technology Promotion Agency, Japan.
+ */
+public class TimeScaleMetric implements Metric<Long> {
+
+ private List<Entry> entries = new ArrayList<Entry>();
+
+ /**
+ * Updates current value.
+ * @param value - the value to update
+ * @param args - [0]:timestamp
+ */
+ public void update(Long value, Object... args) {
+ entries.add(new Entry((Long)args[0], value));
+ }
+
+ public void reset() {
+ entries = new ArrayList<Entry>();
+ }
+
+ public List<Entry> getEntries() {
+// Collections.sort(entries);
+ return entries;
+ }
+
+ public class Entry implements Serializable, Comparable<Entry> {
+ private long timestamp = 0L;
+ private long value = 0L;
+
+ public Entry(long timestamp, long value) {
+ this.timestamp = timestamp;
+ this.value = value;
+ }
+
+ public int compareTo(Entry entry) {
+ if(this.timestamp>entry.timestamp) return 1;
+ else if(this.timestamp<entry.timestamp) return -1;
+ return 0;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public long getValue() {
+ return value;
+ }
+ }
+
+}
More information about the jboss-cvs-commits
mailing list