New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot capture performace #4
Comments
if you are using JDK 1.7 you should use the latest aspect 1.7.* if I remember correctly 1.8.* are for jdk 1.8.* For your class to be accessible via JMX, you will need to call on of Registry.export() methods supplying your instannce and custom naming is desired. what version of spf4j are you using? |
take a look at: PerformanceMonitorAspectTest it is is a example of what you are trying to do. |
Daniel, let me know if you want to add anything to this issue, otherwise I will proceed and close it. |
Thanks for the tips. I used aspectj 1.7 with JDK 1.7 but it still failed. My method is tagged as follows:
Any idea what am I missing? |
You should see current recorded metrics (what is currently aggregated in memory) under: org/spf4j/perf/recorders/class_org.spf4j.annotations.RecorderSourceInstance.Rs5m what version of the library are you using? the entire history of metrics you will get from the tsdb file. The @JmxExport annotation is no necessary for that... |
I'm using 7.2.12. My current classpath looks like this spf4j-example/bin:spf4j-example/depend/aspectj/aspectjrt-1.7.4.jar:spf4j-example/depend/spf4j/lib/spf4j-aspects-7.2.12.jar:spf4j-example/depend/spf4j/lib/spf4j-core-7.2.12.jar:depend/aspectj/aspectjweaver-1.7.4.jar I'm on MacOSX 10.9.5 in case that matters. |
To run the aspect runtime weaver, you also need to start you app with: The tsdb files location is controlled via : -Dperf.db.folder=[whatever] let me know. thank you |
Sorry, I forgot to mention. Yes I'm running it with weaver. And have in console And application starts as normal. After adding -Dperf.db.folder=output I don't get anything in that folder, no files are being created, Thanks for help so far |
is your annotated method being invoked? The JMX registration is Lazy... you can troubleshoot and see if your classes are being weaved with: weaver options="-verbose -debug" You should see something like: let me know. |
Hi Zoltan Thanks for tips on weaver options. NOw it shows class is weaved but still fails objc[40374]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined. I'm still on JDK1.7 and weaver 1.7.4 My current config
|
You should not exclude the aspect classes from weaving. I think including org.spf4j.perf.aspects.PerformanceMonitorAspect in your weaving should resolve your issue. |
Yes, you're absolutely right. I excluded it only because of the errors. What I had do now was explicitly including org. in weaver, add guava + slf4j + logback as dependencies and my application starts! Thanks a bunch.
I still don't see JMX beans exported though... Below my sample code
|
What is you JMX aim? If you want to be able to execute the method "execute()" via JMX, all you need to do is add: Registry.export(m); before m.execute() If you want to see the aggregated measurements you will find them via JMX console underneath: org.spf4j.perf.recorders. but since m.execute() does not ever finish, you will not find any measurements.. when you annotate the execute() method with PerformancceMonitor you basically measure the execution times of this method. if the method never finished nothing is ever recorded. I am not sure what you are trying to do... |
Thanks Zoltan This is exactly what I missed. Of course method never finishes. I changed code and now I can see both JMX and logs from PerformanceMonitorAspect. I had to add following dependencies (I'm not using Maven) Maybe it would be good idea to add info about that somewhere in the docs for future reference. Thanks a bunch for your help. |
Great! I will update the docs based on our conversation... Documentation is never enough |
Hi I've tagged my method with:
And I get exception on it:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.spf4j.perf.aspects.PerformanceMonitorAspect.aspectOf()Lorg/spf4j/perf/aspects/PerformanceMonitorAspect;
I'm starting application From Eclipse with JDK 1.7.0_55
-javaagent:depend/aspectj/1.8.6/lib/aspectjweaver-1.8.6.jar
and with aop-ajc.xml in src/META-INFO folder
` Also JMX Beans are not visible in VisualVM at this point What am I doing wrong?`
The text was updated successfully, but these errors were encountered: