Integrating profiler4j. GSoC result of Vladimir.

cusax-fix
Benoit Pradelle 17 years ago
parent 0ec995e1f5
commit 3aecc0800f

@ -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">

@ -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>

@ -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

@ -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

@ -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

@ -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]");
}
}
}

@ -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;
}
}

@ -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;
}
}

@ -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
Loading…
Cancel
Save