Giter Site home page Giter Site logo

karouani / javasimon Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.43 MB

Automatically exported from code.google.com/p/javasimon

License: BSD 3-Clause "New" or "Revised" License

Batchfile 0.02% Shell 0.01% Java 91.60% CSS 0.72% HTML 2.90% JavaScript 4.75%

javasimon's Introduction

#summary readme.txt included in the download

= Java Simon - Simple Monitors for Java =

Version: 4.0.0

This software is distributed under the terms of the The BSD 3-Clause License:
  * check "license.txt" in the root directory of the project
  * or check it online http://opensource.org/licenses/BSD-3-Clause

Check this readme online for updates: http://code.google.com/p/javasimon/wiki/Readme

For development and building see: http://code.google.com/p/javasimon/wiki/Development

== Getting started ==

Easiest way to start with Java Simon is adding Maven depndencies into your Maven project. See http://code.google.com/p/javasimon/wiki/MavenSupport for more.

A monitors in Java Simon is called "Simon". There are two types of Simons available: `Counter` and `Stopwatch`. Counter tracks single long value, its maximum and minimum. Stopwatch measures time and tracks number of measurements (splits), total time, split minimum and maximum, etc.

=== Simon Manager ===

You obtain Simons from the `SimonManager`:
{{{
Stopwatch stopwatch = SimonManager.getStopwatch("org.javasimon.examples.HelloWorld-stopwatch");
}}}

Here we obtained stopwatch Simon. If the Simon is accessed first time it is created. If you access existing Simon, type of the Simon must match - you can't create counter with the same name (unless you destroy the Simon first).

=== Stopwatch ===

Using stopwatch is simple:
{{{
Split split = stopwatch.start(); // returns split object
// here goes the measured code
long time = split.stop(); // returns the split time in ns
}}}

After few runs of your measured code you can get additional information from stopwatch:
{{{
long totalNanos = stopwatch.getTotal();
long maxSplit = stopwatch.getMax();
long minSplit = stopwatch.getMin();
}}}

You can use convenient utility to print the results (note ns/us/ms/s unit after the number):
{{{
System.out.println("Total time: " + SimonUtils.presentNanoTime(totalNanos));
}}}

Or simply print the Simon itself, it has nice `toString` output.

For more check other Resources (lower), you may head to GettingStarted wiki page: http://code.google.com/p/javasimon/wiki/GettingStarted

== Resources ==

Project is hosted on Google Code as "javasimon":
  * Homepage: http://www.javasimon.org (Google+ http://gplus.to/javasimon, https://plus.google.com/b/115141838919870730025/115141838919870730025)
  * Project page: http://code.google.com/p/javasimon/
  * Download: http://code.google.com/p/javasimon/downloads/list
  * Javadoc API: http://javasimon.googlecode.com/svn/javadoc/api-3.5/index.html
  * Source browser: http://code.google.com/p/javasimon/source/browse/
  * Issue tracker: http://code.google.com/p/javasimon/issues/list
  * Ohloh page: http://www.ohloh.net/p/javasimon

== Java Simon name ==

*Java Simon* is the official name of the project with _Simple Monitoring API_ as a subtitle. Codename of the project is *javasimon*. We use word Simon as a synonym for a "monitor" in javadoc or on our wiki - of course we use it only for monitors based on the API. We write Simon mostly with capital S, Java Simon with space and javasimon as a one word with all lowercase. Word javasimon is probably best to use in search engines.

javasimon's People

Contributors

virgo47 avatar gquintana avatar mushketyk avatar radovansninsky avatar karouani avatar dependabot[bot] avatar hudec avatar

Watchers

James Cloos avatar

javasimon's Issues

Maven artifact

Releasing maven2 artifacts (jar, docs, source) would ease the adoption by
maven users.

Original issue reported on code.google.com by [email protected] on 20 Dec 2008 at 10:28

JmxRegisterCallback should not be final

JmxRegisterCallback should not be final so that the register method may be
overridden. This so that custom domain and names for the registration of
the JMX beans can be used.

Original issue reported on code.google.com by [email protected] on 15 Jan 2010 at 10:07

Add aggregation utility method(s)

Add method that sums up stopwatches (and counters?) for a specific Simon 
(parent):
- one level/recursive?
- possible filtering? (based on... values? names? using eval like in callback 
config?)

Original issue reported on code.google.com by virgo47 on 13 Jan 2011 at 1:32

Add FirstAccess and Last Access Datestamps To Sample

I didn't see this anywhere so please correct me if I just missed it but...

One thing JAMon does is that it also tracks the first time and the last time 
the monitor or Simon is accessed.  I find this really useful because it also 
lets the monitoring team know when the last time this monitor was actually used 
in running code etc.  We found this very useful for figuring out which method 
calls were actually being used by end users and how frequently because if the 
LastAccess time had not changed in days it meant the users probably were not 
using that method very much.

JAMon Label=XXX, Units=ms.: (LastValue=1015.0, Hits=2.0, Avg=1102.5, 
Total=2205.0, Min=1015.0, Max=1190.0, Active=0.0, Avg Active=1.0, Max 
Active=1.0, First Access=Wed Mar 16 14:22:48 EDT 2011, Last Access=Wed Mar 16 
14:23:14 EDT 2011)

Original issue reported on code.google.com by mellowaredev on 17 Mar 2011 at 12:55

Attach metadata to Simons

Our customers love the fact that we can provide great timing reports based 
on JavaSimon, and in particular the Stopwatch. However, they frequently ask 
that we output more information about the object being measured, perhaps 
even with a drill-down facility.

Our simons use syntethic names based on guids, such as 
"contentViewer.AABBCCDDAABBCCDD". The guids are in fact tracable back to 
user level application objects, but it's a bit cumbersome...

Our first desire is to use custom Stopwatch classes, which I'm sure we can. 
Then we can code like this:

   CustomStopwatch stopwatch = manager.getStopwatch("contentViewer.GUID");
   if (! stopwatch.isInitialized()) {
      stopwatch.setReadableName (this.getTitle());
      stopwatch.setObject (this);
   }

However, we really want different Stopwatch classes for different 
Stopwatches. Our "contentViewer.GUID"-stopwatches are backed by a 
ContentViewer-object, with some needs. "ldapConnection.GUID" are backed by 
an LDAPConnection-object, with others. So we want these two to return 
different types:

   Object sw1 = manager.getStopwatch ("contentViewer.GUID")
   Object sw2 = manager.getStopwatch ("ldapConnection.GUID")

... and that just isn't reasonable. Except, perhaps, with interfaces like 
this:

   interface StopwatchFactory {
      Stopwatch createStopwatch(String name);
   }

   interface Manager {
      ...
      Stopwatch getStopwatch (String name, SimonFactory factory);
   }

and then our code like this:

   // The factories may be inner classes, who can reference
   // the required information to create a "full" stopwatch
   manager.getStopwatch ("viewer.GUID", viewerStopwatchFactory);
   manager.getStopwatch ("ldap.GUID", ldapStopwatchFactory);

So, in the end, a couple of questions:

1) Do the requirements make sense?
2) Does the proposed solutions make sense?
3) If not, is there an alternative, or how do we improve it?

If you want to, I can implement some sample code to test this out.

Original issue reported on code.google.com by [email protected] on 19 Feb 2010 at 7:22

Enhance Split with attributes and note

This is just a proposal for an enhancement. I'm using Javasimon in my project - 
what I'm missing is the set of attributes and note, the same as are present in 
Stopwatch. I'm using these extra attributes in a cumulative callback to collect 
Split specific values.

Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 6:19

SimonPreparedStatement.executeQuery returning original sql.ResultSet

What steps will reproduce the problem?
1.call executeQuery() from SimonPreparedStatement

What is the expected output? What do you see instead?
Expected get a SimonResultSet. Instead a java.sql.ResultSet.

may be patch
-- return stmt.executeQuery();
++ return new SimonResultSet(stmt.executeQuery(sql), this, prefix,
s.getStopwatch().getName());
?

What version of the product are you using? On what operating system?
Simon 2.3 (from SVN-repo). 
Linux 2.6.31-17-generic Ubuntu SMP x86_64 GNU/Linux


greetings, 
Andrey Kalinichenko

Original issue reported on code.google.com by [email protected] on 5 Feb 2010 at 3:04

Wrong maven jdk parameter in jdbc3 project

What steps will reproduce the problem?
1.Set -Djdk5.home parameter to a JDK 5 directory
2.Compile will fail with errors on @override
3.

What is the expected output? What do you see instead?
Compile completes ok

What version of the product are you using? On what operating system?


Please provide any additional information below.
Pom should refer to jdk6.home instead - Prefereably the copiler plugin
should not be configured with executable at all. Use source and target
parameter of compiler plugin instead

Original issue reported on code.google.com by [email protected] on 15 Jan 2010 at 7:39

Spring AOP Patch

Attached is a patch for Spring AOP.  The DefaultAdvisorAutoProxyCreator tries 
to load any pointcut it finds in the classpath and causes havoc.

<bean 
class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreato
r"/>

You have to narrow it down to only loading the monitored Pointcuts.


Original issue reported on code.google.com by mellowaredev on 26 Aug 2011 at 8:50

Attachments:

Wrapping DataSource

I wanted to try the Simon JDBC monitoring, but the existing configuration
doesn't suit me.  I want to be able to wrap my existing datasource, and not
just give a driver classname and url.

To do this I had to create WrappingSimonDataSource, you can use it in
spring as follows:


{{{
<bean id="dataSource" class="org.javasimon.jdbcx.WrappingSimonDataSource">
    <property name="dataSource" ref="pooledDataSource"/>
    <property name="prefix" value="sky.batchpricer.skydb"/>
</bean>

<bean id="pooledDataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
    <property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="${dbase.SKY}"/>
    <property name="initialSize" value="0"/>
    <property name="maxActive" value="5"/>
    <property name="maxIdle" value="2"/>
    <property name="validationQuery" value="SELECT 1"/>
</bean>
}}}

Please include this, or similar functionality in future versions.


Original issue reported on code.google.com by [email protected] on 23 Nov 2009 at 3:09

Attachments:

Lots of thread contention

Using javasimon 2.3 in a web application based on Jetty. I am load testing it 
on a Fedora 8, Amazon EC2 instance (Xen VM).

# uname -a
Linux domU-12-31-38-06-64-81 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 
17:48:28 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

With javasimon enabled, in any particular thread dump of about 100 jetty thread 
pool threads, I see many of them (over 10) blocked using Simon.

Here is an example:

"qtp6771926-446" prio=10 tid=0x08e9ec00 nid=0x12ed waiting for monitor entry 
[0x1ca0a000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.javasimon.StopwatchImpl.stop(StopwatchImpl.java:86)
        - waiting to lock <0x3468fbc8> (a org.javasimon.StopwatchImpl)
        at org.javasimon.Split.stop(Split.java:46)
        at org.cometd.server.JSONTransport.send_aroundBody1$advice(JSONTransport.java:29)
        [...]

(... about 15 more like the one above...)

and here is the thread holding the lock:

"qtp6771926-338" prio=10 tid=0x2633c800 nid=0x1282 waiting for monitor entry 
[0x1e081000]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.javasimon.StopwatchImpl.stop(StopwatchImpl.java:86)
        - locked <0x3468fbc8> (a org.javasimon.StopwatchImpl)
        at org.javasimon.Split.stop(Split.java:46)
        [...]

My usage is very simple:

Split split = SimonManager.getStopwatch("name").start();
try {
    // some code here
} finally {
    split.stop();
}

Disabling Simon via SimonManager.disable() drastically improves application 
performance.

Original issue reported on code.google.com by [email protected] on 26 Jun 2010 at 5:31

Start a stopwatch, decide later which stopwatch this is

I have scenario which I wonder if is easily solvable today, or could be more 
easily solvable tomorrow :-)

We want to use a stopwatch to time an operation, but we don't in fact know 
which operation this is until the end over the operation. For example, if I 
want to monitor an operation "runPortlet", that is easy:

- swName = "runPortlet";
- sw = SimonManager.getStopwatch(name).start();
- ...
- sw.end()

However, if I want to monitor the operation as either "runPortletCacheHit" or 
"runPortletCacheMiss", where I don't know which one it is until I'm nearly 
done, I need something else:

- sw = SimonManager.anonymousStopwatch().start();
- ...
- sw.end()
- swName cacheHit ? "runPortletCacheHit" : "runPortletCacheMiss"
- SimonManager.getStopwatch(name).apply(sw)

Two questions:
1) Can this be done today?
2) Can it be done tomorrow?

Original issue reported on code.google.com by [email protected] on 15 Nov 2010 at 10:57

CompositeFilterCallback calls the wrong methods

What steps will reproduce the problem?
1. Register callbacks with the CompositeFilterCallback
2. Call set or increase on a counter
3. Notice that only decrease will be called on the callbacks

What is the expected output? What do you see instead?
Set and increase should be called

What version of the product are you using? On what operating system?
2.5.0, Linux, Java 1.6

Please provide any additional information below.
In CompositeFilterCallback.java:130 in counterIncrease() it should call 
counterIncrease()
In CompositeFilterCallback.java:139 in counterSet() it should call counterSet()

Original issue reported on code.google.com by [email protected] on 11 Oct 2011 at 10:25

Add BenchmarkUtils

Benchmark utils should allow you to specify how many times to measure something 
+ how many warmup runs to perform before.

Measured task has to extend `org.javasimon.utils.BenchmarkUtils.Task`.

Original issue reported on code.google.com by virgo47 on 27 Nov 2011 at 5:41

Wiki for Spring based example

Since I have been digging around in the source code to try and figure out the 
best way to use JavaSimon in Spring I thought I would create this issue.

I think it would be really helpful to have a Wiki page showing how to use 
JavaSimon in Spring, an example Spring config and then using the @Monitored 
annotation etc.  

Thanks!

Original issue reported on code.google.com by mellowaredev on 22 Jun 2011 at 2:54

Simon names pattern should include underscore

Currently Simon name must match following pattern: '[-A-Za-z0-9.,@$%()<>]+'.
Why can't we use underscore "_" in the names?

Original issue reported on code.google.com by a.kosenkov on 6 Jul 2009 at 1:02

print mean value in StopwatchImpl.toString()

We use SimonUtils.simonTreeString(SimonManager.getRootSimon() to dump all the 
Simons periodically. 
However the printout is missing the critical 'mean' value.
Please add the mean value to the printout.

Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 6:45

NullPointerException is thrown if properties file not found as resource

What steps will reproduce the problem?
1.create properties file 
2. this file inaccessible for simon


What is the expected output? What do you see instead?
Expected FileNotFoundException. Instead a NullPointerException is thrown.
May be patch the SimonManager.java
-               manager.configuration().readConfig(new
InputStreamReader(SimonManager.class.getClassLoader().getResourceAsStream(resour
ceName)));
+                   InputStream is =
SimonManager.class.getClassLoader().getResourceAsStream(resourceName);
+                   if (is == null) {
+                       throw new FileNotFoundException(resourceName);
+                   }
+               manager.configuration().readConfig(new InputStreamReader(is));


What version of the product are you using? On what operating system?
Simon 2.3 (from SVN-repo). 
Linux 2.6.31-17-generic Ubuntu SMP x86_64 GNU/Linux


Please provide any additional information below.
greetings, 
Andrey Kalinichenko

Original issue reported on code.google.com by [email protected] on 8 Feb 2010 at 8:45

Use covariant return types

Stopwatch and Counter could redefine Simon.sample() to return StopwatchSample 
and CounterSample respectively instead of just Sample. This makes it easier to 
get more information from samples.

Original issue reported on code.google.com by [email protected] on 27 Sep 2011 at 2:24

Spring AOP is not working if @Monitored is set on Interface or SuperClass level

The @Monitored Annotation can be set on a Method or Class.  It works if it is 
set on a method, or if it is set on a class.  However if you set it on an 
Interface a class uses or a SuperClass a Class extends the @Monitored is not 
found.

Attached is the fix to use Spring Utilities which traverse the Interfaces and 
Superclasses looking for Annotations.



Original issue reported on code.google.com by mellowaredev on 29 Aug 2011 at 1:15

javasimon jdbc profiler skip '=' in jdbc url

I am trying to connect using following jdbc url:
'jdbc:simon:sqlserver://test;databaseName=testdb'

It's illegally converted to 'jdbc:sqlserver://test;databaseNametestdb' real
url instead of 'jdbc:sqlserver://test;databaseName=testdb'.
Database connection fail.

Javasimon skip '=' in jdbc url.

Error occurs on javasimon 2.0

Patch attached.

Original issue reported on code.google.com by [email protected] on 25 Aug 2009 at 9:32

Attachments:

Use SimonUtils.presentNanoTime in jmx StopwatchMXBean

It's not easy to analysis of 'min', 'max', 'total' fields of result ojbect 
StopwatchSample of StopwatchMXBean.sample() or StopwatchMXBean.sampleAndReset() 
methods in jConsole. Because of it's all has nanoseconds format, i suggest to 
make StopwatchSampleJmx extends StopwatchSample and use 
SimonUtils.presentNanoTime(...) in that fields for more convient displaying.

Original issue reported on code.google.com by [email protected] on 14 Jun 2010 at 6:42

Monitored.suffix parameter + rework Monitored name resolution

@Monitored name worked differently on class and method - they were 
concatenated. New resolution is described in current Javadoc for @Monitored.
Name is the name of the stopwatch used, by default it's FQN of the Class + 
method and this can be overriden by name parameter. Name on method level 
annotation overrides it completely. Suffix on the method level annotation adds 
to the name set by class level annotation (or to the default class name). 
Suffix on class level is ignored.

AspectJ aspect should be finished too - name resolution will be the same of 
course.

Original issue reported on code.google.com by virgo47 on 27 Nov 2011 at 5:22

Basic Simon configuration

Rework current configuration to work more like a configuration and less 
like the initialization. Configuration should persist Manager.reset() and 
may (but need not) to create Simons right from the start.

Original issue reported on code.google.com by virgo47 on 8 Sep 2008 at 9:35

NullPointerException in Split.toString()

What steps will reproduce the problem?
1. disable all stopwatches using javasimon-config.xml
2. Split split = SimonManager.getStopwatch("test").start();
3. invoke split.toString();

What is the expected output? What do you see instead?

> Expected output is a human readable representation of the Split value, 
possibly indicating that the stopwatch has been disabled. Instead a 
NullPointerException is thrown (line 95 of Split.java). Most methods in 
Split.java perform a null-check on the outcome of getStopWatch(), but the 
toString() method does not.

What version of the product are you using? On what operating system?

> Simon 2.1 on Windows XP

Please provide any additional information below.

> greetings, 
Rene Kok

Original issue reported on code.google.com by [email protected] on 11 Sep 2009 at 10:36

JmxRegisterCallback#simonDestroyed(Simon) does not properly unregister the simon mbean

What steps will reproduce the problem?
1. register jmx callback
2. create stopwatch
3. destroy stopwatch

What is the expected output? What do you see instead?
Expect to see the stopwatch mbean unregistered

What version of the product are you using? On what operating system?
2.4

Please provide any additional information below.
I've attached a patch that includes a unit test and a fix

Original issue reported on code.google.com by [email protected] on 1 Feb 2011 at 9:31

Attachments:

Upgrade to Spring 3.x

This is just a proposal for an enhancement. At least some branch for Spring 3.x 
dependency.

Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 6:28

Mean, Median, StandardDeviatio are private members?

In 2.5.0 I am seeing on the StopWatch class the getMean, getMedian, and 
getStandardDeviation methods are all private and not accessible.

I need to get to that information.  Shouldn't these be made public?

Original issue reported on code.google.com by mellowaredev on 26 Aug 2011 at 7:40

Enable continue with Split measurement in another thread

This is just a proposal for an enhancement. I'm using Javasimon in my project - 
what I'm missing is to split measurement into several consecutive threads. The 
problem is that in every Stopwatch.addTime incements counter. Might be a naive 
enhancement can be

    public synchronized Stopwatch addTime(long ns) {
        if (enabled) {
            updateUsages();
            addSplit(ns, true);
            manager.callback().stopwatchAdd(this, ns);
        }
        return this;
    }
    public synchronized Stopwatch addOnlyTime(long ns) {
        if (enabled) {
            updateUsages();
            addSplit(ns, false);
            manager.callback().stopwatchAdd(this, ns);
        }
        return this;
    }
    private long addSplit(long split, boolean incrementCounter) {
        last = split;
        total += split;
        if (incrementCounter)
            counter++;
...

The same for the Split creation:
    public synchronized Split startOnlyTime() {
        if (enabled) {
            Split split;
            updateUsages();
            activeStart();
            split = new Split(this, currentNanos, true);
            manager.callback().stopwatchStart(split);
            return split;
        }
        return new Split(this, 0);
    }
    synchronized long stop(Split split, long start) {
        try {
            active--;
            updateUsages();
            return addSplit(currentNanos - start, !split.isOnlyTime());
        } finally {
            manager.callback().stopwatchStop(split);
        }
    }
and in Split itself
    private boolean onlyTime;
    Split(Stopwatch stopwatch, long start, boolean onlyTime) {
        this.stopwatch = stopwatch;
        enabled = stopwatch.isEnabled();
        this.start = start;
        this.onlyTime = onlyTime;
    }

Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 6:27

attach source to maven repo

please attach javasimon source to maven repo along with the binary.

for your convenience below is the maven tag I use

            <!--attach source-->
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


Original issue reported on code.google.com by [email protected] on 20 Dec 2010 at 4:40

Move to using SLF4J in org.javasimon.utils.LoggingCallback

The current implementation of org.javasimon.utils.LoggingCallback uses 
java.util.logging, would it be possible to move to using Simple Logging Facade 
to give users the freedom to choose between logging implementation like log4j, 
logback etc. see http://www.slf4j.org

Although it is still possible to use slf4j with the current implementation by 
using jul-to-slf4j to bridge between java.util.logging and slf4j, there is a 
significant performance hit in using the bridge see here fore details 
http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html

I have attached a sample of what the changed callback handler could look like, 
since Level can't be directly specified using slf4j api, I have used Marker 
instead. The default log level is set to debug, which is the closest equivalent 
to FINE in java.util.logging.Level see 
http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html.

Original issue reported on code.google.com by [email protected] on 28 Sep 2011 at 1:25

Attachments:

SimonManager needs a way to reset all timers

JAmon has MonitorFactory.reset(); to reset all contained timers from the root 
on down.

It looks like it Simon I would have to SimonManager.getRootSimon() and then 
recurse through its children etc.

A convenience method for resetting all statistics would be nice.

Original issue reported on code.google.com by mellowaredev on 18 Mar 2011 at 7:45

Add Split.presentNanoTime()

I find I keep having code like this:

  split.stop();
  log.info("Batch Submit time: {} for {} requests",
    SimonUtils.presentNanoTime(split.runningFor()), 
    requestCount); 

Sometimes I manage to call the wrong static method on SimonUtils. I end up
calling SimonUtils.presentTimestamp((split.runningFor()).  This goes to
show that the current API is not very OO and not type safe.

It would help me if there was a method Split.presentNanoTime() that did
what I want.  Ideally Split.toString() would be just call
SimonUtils.presentNanoTime(), as I find it too verbose, but I realise that
this might upset some people.


-------------

--- D:/Java/javasimon-2.1.1/core/src/main/java/org/javasimon/Split.java Fri
Sep 11 13:03:44 2009
+++ D:/Java/javasimon-2.1.1/core/src/main/java/org/javasimon/Split2.java
Thu Dec 31 11:44:10 2009
@@ -79,4 +79,13 @@
        }
        return "Stopped split for Stopwatch '" + stopwatch.getName() + "': " +
SimonUtils.presentNanoTime(total);
    }
+
+   /**
+    * Returns printable form of how long this split was running for.
+    *
+    * @return short information about the Split  time as a human readable string
+    */
+   public String presentNanoTime() {
+       return SimonUtils.presentNanoTime(runningFor());
+   }
 }

Original issue reported on code.google.com by [email protected] on 31 Dec 2009 at 11:48

Error in String ALLOWED_CHARS

What steps will reproduce the problem?

Since JavaSimon v2.3, class SimonUtils contains the following public static
final String ALLOWED_CHARS =
"-_[]ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstvwxyz0123456789.,@$%()<>";

The lowercase letter 'u' is missing.


Original issue reported on code.google.com by [email protected] on 27 May 2010 at 8:30

Bug for SUFFICE rule

Reported by Mathieu Couron:

The class CompositeFilterCallback contain the method "private boolean 
rulesAppliesTo(Simon simon, Event checkedEvent, Object... params)". My 
CompositeFilterCallback contain only one rule of type "SUFFICE". Wen the method 
checks a Simon that doesn't match the rule, the method return true (ending with 
true). Should not this method ending with "return false" ?

My configuration is simple :
I created one CompositeFilterCallback with one rule :
    filter.addRule(Type.SUFFICE, null, "ejb-client.access.time");
I put this callback into SimonManager.
Then I create a Simon (for another stat) :
    SimonManager.getStopwatch("web.total.time");
The rule was applied to that Simon.

I think the code bellow (added in blue) would work if the condition between 
rules are "and condition" :

    private boolean rulesAppliesTo(Simon simon, Event checkedEvent, Object... params) {
        // Initialise the default return value
        boolean apply = true;

        for (Event event : new Event[]{checkedEvent, Event.ALL}) {
            for (Rule rule : rules.get(event)) {

                boolean result = patternAndConditionCheck(simon, rule, params);

                if (!result && rule.getType().equals(Rule.Type.MUST)) { // fast fail on MUST condition
                    return false;
                }
                if (result && rule.getType().equals(Rule.Type.MUST_NOT)) { // fast fail on MUST NOT condition
                    return false;
                }
                if (result && rule.getType().equals(Rule.Type.SUFFICE)) { // fast success on SUFFICE condition
                    return true;
                } else {
                    // There is at least one rule not matched with SUFFICE condition, the default return value is set to false...
                    // ... waiting for Simon match another SUFFICE condition
                    apply = false;
                }
            }
        }
        return apply;
    }

Virgo:
Accepted, fixed, will be released in 2.5.1 and of course also in 3.0.0.

Original issue reported on code.google.com by virgo47 on 9 May 2011 at 8:07

Callback counterSet() will be called for counter decrease

What steps will reproduce the problem?
1. Register a callback
2. Get a counter and call decrease(value) on it
3. Notice both the decrease and counterSet will be called on the callback

What is the expected output? What do you see instead?
Only decrease should be called, not counterSet

What version of the product are you using? On what operating system?
2.5.0, Linux, Java 1.6

Please provide any additional information below.
I noticed that it's a bug in the code, in CounterImpl:156. In the decrease() 
method, it uses set(), rather than privateSet() (which is used by increase and 
set).

Original issue reported on code.google.com by [email protected] on 11 Oct 2011 at 10:19

Prepare for being an OSGI bundle

Please move implementation classes to different packages then the interface
classes.

With current code structure it will be hard to make a safe OSGI bundle from
the javasimon jar.

An OSGI bundle defines (in the jar's manifest) which packages contains
classes that may be used externally. As interfaces and implementations are
now all in the same package, it is currently not possible to hide the
implementation classes.

Original issue reported on code.google.com by [email protected] on 9 Jan 2009 at 12:28

InvalidObjectException creating MXBean proxy: Do not know how to make a StopwatchSample

What steps will reproduce the problem?
1. Execute atatched junit test case. 
2. test case with javasimon version 2.3.0 is succesfull
3. test case with javasimon version 2.5.0 fails

What is the expected output? What do you see instead?
Expected is unit test success.
Instead you get:
------------
    [junit] Running nl.portbase.dashboard.collector.sampler.OtherTest
    [junit] Testsuite: nl.portbase.dashboard.collector.sampler.OtherTest
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,187 sec
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0,187 sec
    [junit]
    [junit] Testcase: getStopwatchNames(nl.portbase.dashboard.collector.sampler.
OtherTest):     Caused an ERROR
    [junit] Unexpected exception, expected<java.lang.reflect.UndeclaredThrowable
Exception> but was<java.lang.IllegalArgumentException>
    [junit] java.lang.Exception: Unexpected exception, expected<java.lang.reflec
t.UndeclaredThrowableException> but was<java.lang.IllegalArgumentException>
    [junit] Caused by: java.lang.IllegalArgumentException: Cannot make MXBean pr
oxy for org.javasimon.jmx.SimonMXBean: java.io.InvalidObjectException: Do not kn
ow how to make a org.javasimon.StopwatchSample from a CompositeData: no method 
from(CompositeData); no constructor has @ConstructorProperties annotation; not 
all getters have corresponding setters (public java.lang.String 
org.javasimon.Sample.getFirstUsageAsString()); not an interface
    [junit]     at javax.management.MBeanServerInvocationHandler.findMXBeanProxy
(MBeanServerInvocationHandler.java:323)
    [junit]     at javax.management.MBeanServerInvocationHandler.invoke(MBeanSer
verInvocationHandler.java:247)
    [junit]     at $Proxy4.getSimonInfos(Unknown Source)
    [junit]     at nl.portbase.dashboard.collector.sampler.OtherTest.getStopwatc
hNames(OtherTest.java:36)
    [junit] Caused by: java.io.InvalidObjectException: Do not know how to make a
 org.javasimon.StopwatchSample from a CompositeData: no method from(CompositeData); no constructor has @ConstructorProperties annotation; not all getters have corresponding setters (public java.lang.String org.javasimon.Sample.getFirstUsageAsString()); not an interface
    [junit]     at com.sun.jmx.mbeanserver.OpenConverter.invalidObjectException(
OpenConverter.java:1403)
------------

What version of the product are you using? On what operating system?
Javasimon 2.3.0 and 2.5.0 on Windows XP SP3

Please provide any additional information below.

See attached OtherTest.java for unit test

Original issue reported on code.google.com by [email protected] on 31 May 2011 at 8:04

Attachments:

org.javasimon.jmx.SimonMXBean lacks reset() and sampleAndReset() methods

Interface org.javasimon.jmx.SimonMXBean has no reset() and sampleAndReset() 
methods.

Now I use the SimonMXBeanImpl to retrieve an array of SimonInfo[].
For all Simons of type Stopwatch, I must to sample the data and reset 
atomically. In order to achieve that I iterate over the SimonInfo[], and 
for every stopwatch found I need to access another StopwatchMXBean.

I.M.H.O., it would be very helpful from a programming point of view if the 
reset(String name) sampleAndReset(String name) methods were added to the 
SimonMXBean.

--
What version of the product are you using? On what operating system?
version: Simon v2
O/S: Windows XP and Redhat Linux

--
Please provide any additional information below.
[email protected]

Original issue reported on code.google.com by [email protected] on 15 Jul 2009 at 8:08

NullPointerException in SimonStatement.executeQuery

What steps will reproduce the problem?
1. disable stopwatch(org.javasimon.jdbc.Driver.DEFAULT_PREFIX)
add line to method main (Complex.java)
Simon jdbcSimon =
SimonManager.getStopwatch(org.javasimon.jdbc.Driver.DEFAULT_PREFIX);
jdbcSimon.setState(SimonState.DISABLED, true);

2.run Complex.main()

What is the expected output? What do you see instead?
Expected output is a monitor hierarchy. Instead a NullPointerException is
thrown ( line 159 of SimonStatement.java).

What version of the product are you using? On what operating system?
Simon 2.3 (from SVN-repo). 
Linux 2.6.31-17-generic Ubuntu SMP x86_64 GNU/Linux

Please provide any additional information below.

greetings, 
Andrey Kalinichenko

Original issue reported on code.google.com by [email protected] on 5 Feb 2010 at 1:00

Add Stopwatch.addSplit(Split) and anonymous Split support

This addition should better support cases where one doesn't know which 
Stopwatch to update until after the end of the split. Following modifications 
were made:

  # added public Split() constructor
  # Split.stop() returns this, not ns timer, you can use split.stop().runningFor() for previous functionality
  # added Stopwatch.addSplit(Split) - you can either use unstopped split, or split.stop() in argument (thanks to the aforementioned change)
  # added Callback.stopwatchAdd(Stopwatch, Split)
  # added Split.getStart() - useful in the previous callback function

All these changes were inspired by Perf4J - see 
`org.javasimon.examples.Perf4JLikeExample` source code for the result. However 
Perf4J isn't the main reason :-) I consider the whole idea of adding the Split 
(+callback hook for it) to the Stopwatch more handy for aggregate stopwatches. 
Also the option to select Stopwatch after the split is stop (or in the same 
moment) was missing.

Original issue reported on code.google.com by virgo47 on 27 Nov 2011 at 5:13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.