aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Pradelle <pradelle@java.net>2008-10-02 02:00:26 +0000
committerBenoit Pradelle <pradelle@java.net>2008-10-02 02:00:26 +0000
commit3aecc0800f6ff4ec4313719487d12a520793ad30 (patch)
tree89e8c64de31ee968333f37f43eb8fb556a67440c
parent0ec995e1f51458b96d175ee4605f32af33acb970 (diff)
downloadjitsi-3aecc0800f6ff4ec4313719487d12a520793ad30.zip
jitsi-3aecc0800f6ff4ec4313719487d12a520793ad30.tar.gz
jitsi-3aecc0800f6ff4ec4313719487d12a520793ad30.tar.bz2
Integrating profiler4j. GSoC result of Vladimir.
-rw-r--r--build.xml90
-rw-r--r--ide/eclipse/.classpath1
-rw-r--r--lib/felix.client.run.properties2
-rw-r--r--lib/installer-exclude/jcommon-1.0.0.jarbin0 -> 294514 bytes
-rw-r--r--lib/installer-exclude/jfreechart-1.0.1.jarbin0 -> 1075621 bytes
-rw-r--r--lib/installer-exclude/p4j-exclusions.txt25
-rw-r--r--lib/installer-exclude/profiler4j-1.0-beta3-SC.jarbin0 -> 603915 bytes
-rw-r--r--resources/languages/resources.properties3
-rw-r--r--src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java53
-rw-r--r--src/net/java/sip/communicator/plugin/profiler4j/Resources.java52
-rw-r--r--src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java85
-rw-r--r--src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf21
12 files changed, 330 insertions, 2 deletions
diff --git a/build.xml b/build.xml
index 430adae..ffabf69 100644
--- a/build.xml
+++ b/build.xml
@@ -139,6 +139,10 @@
<!-- end jmf.home-->
<property name="jdic_stub.jar" value="${os.lib.home}/jdic_stub.jar"/>
+
+ <property name="profiler.args" value="" />
+ <property name="profiler.bootdelegation" value="" />
+ <property name="profiler.autostart" value="" />
<tstamp>
<format property="build.date" pattern="dd-MM-yyyy"/>
@@ -569,12 +573,78 @@
<arg line="--debug"/>
<!-- pass to SC args that have been specified by the user -->
<arg line="${args}"/>
-
- <jvmarg line="${jvmarg.line}"/>
+
+ <sysproperty key="org.osgi.framework.bootdelegation" value="${profiler.bootdelegation}" />
+ <sysproperty key="felix.auto.start.68" value="${profiler.autostart}" />
+
+ <!-- add some eventual profiler args -->
+ <jvmarg line="${profiler.args} ${jvmarg.line}"/>
</java>
</target>
+ <!--RUN-SIP-COMMUNICATOR-WITH-INTEGRATED-PROFILER -->
+ <target name="run-with-profiler" description="Starts felix and runs sip-comunicator gui (use latest build) with the hooked classloader."
+ depends="bundle-plugin-profiler4j">
+
+ <antcall target="run">
+ <param name="profiler.args" value="-Xmx128m -javaagent:${lib.noinst}\profiler4j-1.0-beta3-SC.jar" />
+ <param name="profiler.bootdelegation" value="net.sf.profiler4j.agent.*" />
+ <param name="profiler.autostart" value="reference:file:sc-bundles/profiler4j.jar" />
+ </antcall>
+ </target>
+
+ <!--PROFILE-SIP-COMMUNICATOR-IN-NETBEANS-IDE -->
+ <target name="profile" depends="bundle-plugin-profiler4j,-deploy-os-specific-bundles"
+ description="Profile Project">
+ <fail unless="netbeans.home">
+ This target can only run inside the NetBeans IDE.
+ </fail>
+
+ <nbprofiledirect>
+ <classpath> <pathelement location="${dest}"/> </classpath>
+ </nbprofiledirect>
+
+ <java classname="net.java.sip.communicator.launcher.SIPCommunicator"
+ fork="true"
+ failonerror="true"
+ classpathref="project.class.path">
+
+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
+
+ <!-- Tell felix to run sip-communicator-->
+ <sysproperty key="felix.config.properties"
+ value="file:${lib}/felix.client.run.properties"/>
+
+ <!-- Tell java.util.logging about our logging preferences -->
+ <sysproperty key="java.util.logging.config.file"
+ value="${lib}/logging.properties"/>
+
+ <sysproperty key="java.net.preferIPv6Addresses"
+ value="false"/>
+
+ <sysproperty key="net.java.sip.communicator.SC_HOME_DIR_LOCATION"
+ value="${user.home}/schome"/>
+
+ <!-- Setting properties necessary for dependencies on native libs-->
+ <sysproperty key="java.library.path"
+ path="${ld.library.path}:${path}:${dyld.library.path}"/>
+
+ <!-- pass l10n properties from ant call for
+ easy translation debugging -->
+ <sysproperty key="user.language" value="${user.language}" />
+ <sysproperty key="user.country" value="${user.country}" />
+ <sysproperty key="user.variant" value="${user.variant}" />
+
+ <env key="LD_LIBRARY_PATH" path="${ld.library.path}"/>
+ <env key="PATH" path="${path}"/>
+ <env key="DYLD_LIBRARY_PATH" path="${dyld.library.path}"/>
+
+ </java>
+
+ <delete file="${bundles.dest}/profiler4j.jar"/>
+ </target>
+
<!-- we run this target before we run SC in order to copy os-specific
bundles from sc-bundles/osname to its parent sc-bundles-->
<target name="-deploy-os-specific-bundles" if="bundles.dest.os">
@@ -1631,6 +1701,22 @@ javax.swing.event, javax.swing.border"/>
prefix="net/java/sip/communicator/plugin/autoaway" />
</jar>
</target>
+
+ <!--BUNDLE-PLUGIN-PROFILER-->
+ <target name="bundle-plugin-profiler4j">
+ <jar compress="false" destfile="${bundles.dest}/profiler4j.jar"
+ manifest="${src}/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf">
+ <zipfileset dir="${dest}/net/java/sip/communicator/plugin/profiler4j"
+ prefix="net/java/sip/communicator/plugin/profiler4j" />
+ <zipfileset src="${lib.noinst}/profiler4j-1.0-beta3-SC.jar"
+ prefix=""/>
+ <zipfileset src="${lib.noinst}/jdom.jar" prefix=""/>
+ <zipfileset src="${lib.noinst}/jcommon-1.0.0.jar" prefix=""/>
+ <zipfileset src="${lib.noinst}/commons-logging.jar" prefix=""/>
+ <zipfileset src="${lib.noinst}/jfreechart-1.0.1.jar" prefix=""/>
+ <fileset file="${lib.noinst}/p4j-exclusions.txt"/>
+ </jar>
+ </target>
<!--BUNDLE-SimpleAccRegPlugin-->
<target name="bundle-plugin-simpleaccreg">
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index a6c9a9c..b2f8089 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -53,5 +53,6 @@
<classpathentry kind="lib" path="lib/installer-exclude/izpack-shortcut-link.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/jfontchooser-1.0.5.jar"/>
<classpathentry kind="lib" path="lib/installer-exclude/KeybindingUtil.jar"/>
+ <classpathentry kind="lib" path="lib/installer-exclude/profiler4j-1.0-beta3-SC.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties
index 4eb1607..33cb052 100644
--- a/lib/felix.client.run.properties
+++ b/lib/felix.client.run.properties
@@ -149,6 +149,8 @@ felix.auto.start.67= \
reference:file:sc-bundles/generalconfig.jar \
reference:file:sc-bundles/dictaccregwizz.jar
+#level 68 is for profiler, don't use it or change the build.xml file accordingly
+
felix.auto.start.70= \
reference:file:sc-bundles/simpleaccreg.jar
diff --git a/lib/installer-exclude/jcommon-1.0.0.jar b/lib/installer-exclude/jcommon-1.0.0.jar
new file mode 100644
index 0000000..c5d23f4
--- /dev/null
+++ b/lib/installer-exclude/jcommon-1.0.0.jar
Binary files differ
diff --git a/lib/installer-exclude/jfreechart-1.0.1.jar b/lib/installer-exclude/jfreechart-1.0.1.jar
new file mode 100644
index 0000000..6a01524
--- /dev/null
+++ b/lib/installer-exclude/jfreechart-1.0.1.jar
Binary files differ
diff --git a/lib/installer-exclude/p4j-exclusions.txt b/lib/installer-exclude/p4j-exclusions.txt
new file mode 100644
index 0000000..a81183f
--- /dev/null
+++ b/lib/installer-exclude/p4j-exclusions.txt
@@ -0,0 +1,25 @@
+#
+# This file lists those classes that should be ignored by
+# the agent during instrumentation. In most cases these
+# classes trigger JVM internal errors and should be simply
+# ignored. Notice that some classes are ignored even if
+# not listed here (they may cause your JVM to crash
+# seriously so I hard-coded exclusions for those within
+# the agent)
+#
+# The agent will ignore all classes STARTING WITH the string
+# indicated. So, you can exclude a whole package by ending
+# with '.'
+#
+
+org.apache.tomcat.jni.OS
+org.jboss.util.xml.DOMWriter
+org.jboss.mq.il.uil2.ServerSocketManagerHandler
+org.hsqldb.jdbc.jdbcConnection
+org.hsqldb.Index
+bsh.ParserTokenManager
+org.eclipse.jdt.internal.compiler.lookup.TypeBinding
+org.eclipse.jdt.internal.compiler.ast.Expression
+org.eclipse.jdt.internal.compiler.problem.ProblemReporter
+org.eclipse.jdt.internal.compiler.impl.Constant
+com.arjuna.ats.internal.arjuna.objectstore.ShadowingStore \ No newline at end of file
diff --git a/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar b/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar
new file mode 100644
index 0000000..3e38fe3
--- /dev/null
+++ b/lib/installer-exclude/profiler4j-1.0-beta3-SC.jar
Binary files differ
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index 4c70edb..dbaf7a7 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -721,3 +721,6 @@ sasPeerUnsuportedTooltip=Securing call not supported/enabled by the other peer
peerToggledOffSecurityMessage=Call peer toggled secure mode off
peerToggledOffSecurityCaption=Secure Off
sasUnsecuredAtPeerRequestTooltip=Call unsecured at peer request
+
+# Profiler4J
+profiler=Profiler4j \ No newline at end of file
diff --git a/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java b/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java
new file mode 100644
index 0000000..c4c9fd9
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/profiler4j/ProfilerActivator.java
@@ -0,0 +1,53 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.profiler4j;
+
+import java.util.*;
+import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.util.*;
+import org.osgi.framework.*;
+
+/**
+ * Activates the profiler plug-in.
+ *
+ * @author Vladimir Škarupelov
+ */
+public class ProfilerActivator implements BundleActivator {
+
+ public static BundleContext bundleContext;
+
+ Logger logger = Logger.getLogger(ProfilerActivator.class);
+
+ private ServiceRegistration menuRegistration = null;
+
+ public void start(BundleContext bc) throws Exception {
+ bundleContext = bc;
+
+ SettingsWindowMenuEntry menuEntry = new SettingsWindowMenuEntry(
+ Container.CONTAINER_TOOLS_MENU);
+
+ Hashtable<String, String> toolsMenuFilter =
+ new Hashtable<String, String>();
+ toolsMenuFilter.put(Container.CONTAINER_ID,
+ Container.CONTAINER_TOOLS_MENU.getID());
+
+ menuRegistration = bc.registerService(PluginComponent.class
+ .getName(), menuEntry, toolsMenuFilter);
+
+ logger.info("PROFILER4J [REGISTERED]");
+
+ }
+
+ public void stop(BundleContext bc) throws Exception {
+ if (menuRegistration != null)
+ {
+ menuRegistration.unregister();
+ logger.info("PROFILER4J [UNREGISTERED]");
+ }
+ }
+
+}
diff --git a/src/net/java/sip/communicator/plugin/profiler4j/Resources.java b/src/net/java/sip/communicator/plugin/profiler4j/Resources.java
new file mode 100644
index 0000000..3af86ee
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/profiler4j/Resources.java
@@ -0,0 +1,52 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.profiler4j;
+
+import java.util.*;
+import org.osgi.framework.*;
+import net.java.sip.communicator.service.resources.*;
+
+/**
+ * The Messages class manages the access to the internationalization properties
+ * files.
+ *
+ * @author Vladimir Škarupelov;
+ */
+public class Resources
+{
+ private static ResourceManagementService resourcesService = null;
+
+ /**
+ * Returns an internationalized string corresponding to the given key.
+ *
+ * @param key The key of the string.
+ * @return An internationalized string corresponding to the given key.
+ */
+ public static String getString(String key)
+ {
+ return getResources().getI18NString(key);
+ }
+
+ public static ResourceManagementService getResources()
+ {
+ if (resourcesService == null)
+ {
+ ServiceReference serviceReference = ProfilerActivator.bundleContext
+ .getServiceReference(ResourceManagementService.class.getName());
+
+ if (serviceReference == null) {
+ return null;
+ }
+
+ resourcesService =
+ (ResourceManagementService) ProfilerActivator.bundleContext
+ .getService(serviceReference);
+ }
+
+ return resourcesService;
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java b/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
new file mode 100644
index 0000000..120d6cd
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/profiler4j/SettingsWindowMenuEntry.java
@@ -0,0 +1,85 @@
+/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.plugin.profiler4j;
+
+/**
+ * Menu entry for the profiler plug-in
+ *
+ * @author Vladimir Å karupelov
+ */
+import java.awt.event.*;
+import javax.swing.*;
+import net.java.sip.communicator.service.contactlist.*;
+import net.java.sip.communicator.service.gui.*;
+import net.sf.profiler4j.console.*;
+
+public class SettingsWindowMenuEntry implements PluginComponent
+{
+ private static final String PROFILER_NAME = "profiler";
+ private JMenuItem settingsMenuEntry;
+ private Container container;
+
+ public SettingsWindowMenuEntry(Container container)
+ {
+ settingsMenuEntry = new JMenuItem(Resources.getString( PROFILER_NAME ));
+ settingsMenuEntry.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ Prefs prefs = new Prefs();
+
+ System.setProperty("swing.aatext",
+ String.valueOf(prefs.isAntialiasing()));
+
+ final Console app = new Console(prefs);
+ app.connect();
+ MainFrame f = new MainFrame(app);
+ app.setMainFrame(f);
+ f.pack();
+ f.setVisible(true);
+ }
+ });
+ this.container = container;
+ }
+
+ public Object getComponent()
+ {
+ return settingsMenuEntry;
+ }
+
+ public String getConstraints()
+ {
+ return null;
+ }
+
+ public Container getContainer()
+ {
+ return container;
+ }
+
+ public String getName()
+ {
+ return Resources.getString( PROFILER_NAME );
+ }
+
+ public void setCurrentContact(MetaContact metaContact)
+ {
+ }
+
+ public void setCurrentContactGroup(MetaContactGroup metaGroup)
+ {
+ }
+
+ public int getPositionIndex()
+ {
+ return -1;
+ }
+
+ public boolean isNativeComponent() {
+ return false;
+ }
+}
diff --git a/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf b/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
new file mode 100644
index 0000000..fdc32da
--- /dev/null
+++ b/src/net/java/sip/communicator/plugin/profiler4j/profiler4j.manifest.mf
@@ -0,0 +1,21 @@
+Bundle-Activator: net.java.sip.communicator.plugin.profiler4j.ProfilerActivator
+Bundle-Name: Integrated profiler plugin
+Bundle-Description: A bundle that provides profile cpu and memory of the running app.
+Bundle-Vendor: sip-communicator.org
+Bundle-Version: 0.0.1
+Import-Package: org.osgi.framework,
+ net.java.sip.communicator.util,
+ net.java.sip.communicator.service.contactlist,
+ net.java.sip.communicator.service.gui,
+ net.java.sip.communicator.service.resources,
+ javax.swing,
+ javax.swing.filechooser,
+ javax.swing.tree,
+ javax.swing.event,
+ javax.swing.border,
+ javax.swing.table,
+ javax.swing.text,
+ javax.xml.parsers,
+ org.xml.sax,
+ org.xml.sax.ext,
+ org.xml.sax.helpers \ No newline at end of file