Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 200251

Summary: [enh] Add support for "application" mode in the Java 1.5+ (JVMTI) Profiler
Product: z_Archived Reporter: Asaf Yaffe <asaf.yaffe>
Component: TPTPAssignee: Igor Alelekov <igor.alelekov>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P1 CC: analexee, asaf.yaffe, chris.l.elford, dfayerma, jkubasta, kiryl.kazakevich, mauromol, paulslau, sluiman
Version: unspecifiedKeywords: plan
Target Milestone: ---Flags: asaf.yaffe: review+
Hardware: All   
OS: All   
URL: http://www.eclipse.org/tptp/groups/Architecture/documents/features/hf_200251.html
Whiteboard: closed460
Attachments:
Description Flags
Oct. 24 Description Document
none
Feature Description
none
patch
none
updated patch
none
updated patch none

Description Asaf Yaffe CLA 2007-08-16 16:27:47 EDT
Previous TPTP/Hyades versions supported an operation mode called "application mode". In this mode, the profiler could be started and stopped programatically by the profiled application itself. This feature enabled developers to have a fine-grained control over the parts of the application that will be profiled.

I suggest to consider supporting this feature in 4.5
Comment 1 Asaf Yaffe CLA 2007-08-19 04:34:13 EDT
Please consider for 4.5
Comment 2 Asaf Yaffe CLA 2007-10-07 04:23:13 EDT
Updated feature description URL and time estimates
Comment 3 Paul Slauenwhite CLA 2007-10-21 21:02:43 EDT
Approved by the AG for TPTP 4.5 with the following comments:

-Sizings total 5 PW (not 4 PW).
-Test sizing is too low.
-Who is requiring this over the loss of function from JVMPI?
-No need to have enableGC0() in the design since it is a private JNI method.
-Do we need emitXMLFragments(String)?
-Can the caller specify filters?  Or an output mode (e.g. binary or XML)?
-Is there a use case to leverage this with ProbeKit (e.g. probes calling this API).
Comment 4 Alexander N. Alexeev CLA 2007-10-24 09:55:38 EDT
> -Test sizing is too low.
I increase test time up to 1ww but reduce time for commiter work

> -Who is requiring this over the loss of function from JVMPI?
some post were in maillist which require this functionality

> -No need to have enableGC0() in the design since it is a private JNI method.
This is misprinting, disableGC() should be here.

> -Do we need emitXMLFragments(String)?
I think yes, service information, comments or debug messages can be added to trace over it.
   
> -Can the caller specify filters?  Or an output mode (e.g. binary or XML)?
> -Is there a use case to leverage this with ProbeKit (e.g. probes calling this
> API).
These two points could be considered as stretch goal.
Before they aren't implemented command line options should be used.

Comment 5 Alexander N. Alexeev CLA 2007-10-24 09:59:39 EDT
Created attachment 81060 [details]
Oct. 24 Description Document

Please, commit updated version of hf_200251.html

Thanks.
Alex.
Comment 6 jkubasta CLA 2007-10-24 12:52:52 EDT
FDD committed to cvs
Comment 7 Harm Sluiman CLA 2007-11-23 09:49:29 EST
When this is supported with PI, the idea that the data could be collected in application and standalone mode was missed. The workbench must be attached before data is collected/sent.
Since everything is in theory actually controlled by the application code, it would seem that standalone mode would be a more popular scenario so that profiling data could be collected quickly and easily in cases where the workbench was not used to launch the application being monitored.

Would it be a significant effort to provide both variations of application mode?
Comment 8 Igor Alelekov CLA 2007-12-10 10:36:48 EST
Harm,
Do you mean that "application mode" should be available with all
JVMTI modes (Server=enabled/controlled/standalone), not exclusive as before?
Comment 9 Harm Sluiman CLA 2007-12-19 22:00:19 EST
(In reply to comment #8)
> Harm,
> Do you mean that "application mode" should be available with all
> JVMTI modes (Server=enabled/controlled/standalone), not exclusive as before?
> 

Sorry for the delay. Yes. I can see and have seen equally valid use cases in all modes. 
Comment 10 Igor Alelekov CLA 2007-12-24 03:07:02 EST
*** Bug 203415 has been marked as a duplicate of this bug. ***
Comment 11 Igor Alelekov CLA 2008-01-16 09:28:35 EST
Created attachment 87048 [details]
Feature Description
Comment 12 Igor Alelekov CLA 2008-01-21 01:44:31 EST
*** Bug 142986 has been marked as a duplicate of this bug. ***
Comment 13 Igor Alelekov CLA 2008-01-21 10:38:56 EST
Created attachment 87410 [details]
patch
Comment 14 Igor Alelekov CLA 2008-01-22 11:24:47 EST
Asaf, would you please review the patch?
Comment 15 Asaf Yaffe CLA 2008-02-04 15:39:31 EST
Hi Igor,
Patch looks good. 

Some comments:

Profiler Java class
===================
- Need Javadoc for all public methods
- getProfier: Need to provide meaningful messages for the exceptions, to help the user understand why it happened and how it can be fixed

JVMTI Runtime General Comments
==============================
- The term "application mode" appears in several places in the code. This term is anachronistic and does not reflect the implementation direction we chose (i.e., adding a new "api" flag rather than adding a new "application" operation mode). Please consider updating variable names to be consistent with the design (e.g., m_Options.isProfilerApiEnabled instead of m_Options.isApplicationMode).

Options.h/Options.cpp
=====================
- printUsage(): please change the description of the "api" argument to:
api=true|false\ <tab> Whether to enable the Profiler API (true) or not (false). 
                      Default is false.
                      
Option parsing: is it really necessary to rewrite the option parsing code? Please test this thoroughly to verify it does not cause any regression issues.

Profiler.h/Profiler.c
=====================
Files should be added to the build process. Need to update BuildJPIAgent32.dsp and BuildJPIAgent32.mak. To make <jni.h> (in Profiler.h) accessible to the compiler, please use the $JAVA_HOME variable in the project/make file and do not hard-code a JVM installation path. You can see examples in the Martini JPI project/make file. Also, please update the build_tptp_profiler batch/shell script to validate that $JAVA_HOME is properly defined (see example in build_tptp_martini script).

Thanks,
Asaf
Comment 16 Igor Alelekov CLA 2008-02-06 11:38:55 EST
Created attachment 89022 [details]
updated patch

Updated patch implementing Asaf's comments.
Comment 17 jkubasta CLA 2008-02-06 12:02:30 EST
Are you ready to check this into Head? We are about to start the candidate driver build
Comment 18 Alexander N. Alexeev CLA 2008-02-06 12:31:35 EST
(In reply to comment #17)
> Are you ready to check this into Head? We are about to start the candidate
> driver build
> 

Joanna, can I commit it in head now?
Comment 19 jkubasta CLA 2008-02-06 13:02:52 EST
I think we should commit this to Head now so that we can test this added function in the i5 test pass
Comment 20 jkubasta CLA 2008-02-06 13:32:53 EST
Patch applied to Head
Comment 21 Asaf Yaffe CLA 2008-02-06 13:41:17 EST
Comments to updated patch:

1. I don't see any updates to the build_tptp_profiler Windows and Linux script files (for checking the existence and validity of the JAVA_HOME variable). Since is not urgent, but should be done.

2. I don't see any updates to JPIAgent Linux makefile (src/JPIAgent/Makefile). This must be done prior to check-in, otherwise the Linux build is likely to fail.

Thanks,
Asaf
Comment 22 jkubasta CLA 2008-02-06 15:38:35 EST
Backed out patch
Comment 23 Igor Alelekov CLA 2008-02-07 04:15:31 EST
Created attachment 89110 [details]
updated patch

Updated patch including required changes to the makefiles.
Tested on Linux and Windows.
Comment 24 Asaf Yaffe CLA 2008-02-07 04:24:13 EST
Updated patch is OK.
Comment 25 Igor Alelekov CLA 2008-02-07 09:48:42 EST
Patch applied to HEAD
Comment 26 Paul Slauenwhite CLA 2009-06-30 13:26:37 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.
Comment 27 Paul Slauenwhite CLA 2009-06-30 13:27:56 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.