Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 209724 | Differences between
and this patch

Collapse All | Expand All

(-)src-native/include/Martini/MpiAPI.h (-52 / +53 lines)
Lines 106-112 Link Here
106
                                   //!  EV_CONTENDED_MONITOR_ENTER,
106
                                   //!  EV_CONTENDED_MONITOR_ENTER,
107
                                   //!  EV_CONTENDED_MONITOR_ENTERED
107
                                   //!  EV_CONTENDED_MONITOR_ENTERED
108
108
109
        EG_THREAD_INTERACTION,     //!< @brief Thread interaction event:
109
        EG_THREAD_INTERACTION,     //!< @brief Thread Interaction events:
110
                                   //!  EV_THREAD_INTERACTION
110
                                   //!  EV_THREAD_INTERACTION
111
111
112
        EG_LAST             //! End sentinel
112
        EG_LAST             //! End sentinel
Lines 655-663 Link Here
655
    //! @brief Monitor timeout for "wait" operations, in milliseconds
655
    //! @brief Monitor timeout for "wait" operations, in milliseconds
656
    const TDataRequestType DR_MONITOR_TIMEOUT                   = 0x00040000;
656
    const TDataRequestType DR_MONITOR_TIMEOUT                   = 0x00040000;
657
657
658
    //! @brief Monitor boolean exit status for "wait" operations,
658
    //! @brief Monitor timeout expiration status for "wait" operations
659
    //! true - timeout expired
660
    //! false - notified or interrupted
661
    const TDataRequestType DR_MONITOR_TIMED_OUT                 = 0x00800000;
659
    const TDataRequestType DR_MONITOR_TIMED_OUT                 = 0x00800000;
662
660
663
    //! @brief Type of interaction between threads,
661
    //! @brief Type of interaction between threads,
Lines 1180-1186 Link Here
1180
    {
1178
    {
1181
        TId threadId;       //!< Id of the waiting thread
1179
        TId threadId;       //!< Id of the waiting thread
1182
        TId objectId;       //!< Id of the monitor object
1180
        TId objectId;       //!< Id of the monitor object
1183
        bool isTimedOut;    //!< Wait exit status, true if timed out
1181
        bool isTimedOut;    //!< Whether the wait operation timed out (true) or not (false)
1184
        BitSet validData;   //!< Bit-mask of the valid data in the struct
1182
        BitSet validData;   //!< Bit-mask of the valid data in the struct
1185
    };
1183
    };
1186
    
1184
    
Lines 1304-1346 Link Here
1304
        virtual void HandleEvent(SContendedMonitorEnteredEventData &data) = 0;
1302
        virtual void HandleEvent(SContendedMonitorEnteredEventData &data) = 0;
1305
    };
1303
    };
1306
1304
1307
1308
1309
1310
1311
    
1312
    /**
1305
    /**
1313
    * @brief method id constants
1306
     * @brief Defines Thread Interaction types
1314
    */
1307
     *
1308
     * Defines Thread Interaction types
1309
     */
1315
    enum EThreadInteractionType
1310
    enum EThreadInteractionType
1316
    {
1311
    {
1317
        IT_NOTIFY_ALL     = 1,
1312
        IT_NOTIFY_ALL = 1,  //!< @brief A thread generated a notification on a monitor to 
1318
        IT_NOTIFY         = 2,
1313
                            //!  wake up all waiting threads
1319
        IT_INTERRUPT      = 3,
1314
        IT_NOTIFY = 2,      //!< @brief A thread generated a notification on a monitor to
1320
        IT_START          = 4,
1315
                            //!  wake up a single thread
1316
        IT_INTERRUPT = 3,   //!< @brief A thread interrupted the execution of another thread
1317
        IT_START = 4        //!< @brief A thread started a new thread
1321
    };
1318
    };
1322
1319
1323
1324
    /**
1320
    /**
1325
     * @brief Defines Thread Interactions Event data
1321
     * @brief Defines Thread Interaction event data
1326
     *
1322
     *
1327
     * Defines Thread Interaction event data for the 
1323
     * Defines Thread Interaction event data for the 
1328
     * IThreadInteractionEvent::HandleEvent callback function.
1324
     * IThreadInteractionEventObserver::HandleEvent callback function.
1329
     */
1325
     */
1330
    struct SThreadInteractionEventData
1326
    struct SThreadInteractionEventData
1331
    {
1327
    {
1332
        TId threadId;                              //!< Id of the thread calling one of notify methods 
1328
        TId threadId;                           //!< @brief Id of the thread performing 
1333
        TId objectId;                              //!< Id of the object for which method is called
1329
                                                //!  the interaction
1334
        EThreadInteractionType interactionType;    //!< alled method ID
1330
        TId objectId;                           //!< @brief ID of the object on which the 
1335
        BitSet validData;                          //!< Bit-mask of the valid data in the struct
1331
                                                //!  the interaction is performed
1332
        EThreadInteractionType interactionType; //!< The type of the interaction
1333
        BitSet validData;                       //!< Bit-mask of the valid data in the struct
1336
    };
1334
    };
1337
    
1335
    
1338
    /**
1336
    /**
1339
     * @interface IThreadInteractionEventObserver
1337
     * @interface IThreadInteractionEventObserver
1340
     * @brief Observer interface for receiving Call CA Method events.
1338
     * @brief Observer interface for receiving Thread Interaction events.
1341
     *
1339
     *
1342
     * The Thread Interaction event is sent when a thread about to call one of the methods 
1340
     * The Thread Interaction event is sent when a thread is about to perform any of the 
1343
     * important for contention analysis (notify, notifyAll, interrupt, start)
1341
     * following operations:
1342
     * - Wake-up (notify) all threads waiting on a monitor object
1343
     * - Wake-up (notify) a single thread waiting on a monitor object
1344
     * - Interrupt the execution of another thread
1345
     * - Start a newly created thread.
1346
     *
1347
     * The Thread Interaction event is always sent on the thread which performs the operation.
1348
     * The event data provides information about the thread, the object it interacts with 
1349
     * and the type of the interaction.
1344
     *
1350
     *
1345
     * The event is currently supported only in Java 5.0 and later.
1351
     * The event is currently supported only in Java 5.0 and later.
1346
     *
1352
     *
Lines 1360-1375 Link Here
1360
        /**
1366
        /**
1361
         * @brief Event Handler
1367
         * @brief Event Handler
1362
         *
1368
         *
1363
         * Call CA method event handler
1369
         * Thread Interaction event handler
1364
         *
1370
         *
1365
         * @param[in]   data event data.
1371
         * @param[in]   data event data.
1366
         */
1372
         */
1367
        virtual void HandleEvent(SThreadInteractionEventData &data) = 0;
1373
        virtual void HandleEvent(SThreadInteractionEventData &data) = 0;
1368
    };
1374
    };
1369
1375
1370
1371
1372
1373
    //////////////////////////////////////////////////////////////////////////
1376
    //////////////////////////////////////////////////////////////////////////
1374
    // Heap Events and Data
1377
    // Heap Events and Data
1375
    //////////////////////////////////////////////////////////////////////////
1378
    //////////////////////////////////////////////////////////////////////////
Lines 2057-2065 Link Here
2057
    //////////////////////////////////////////////////////////////////////////
2060
    //////////////////////////////////////////////////////////////////////////
2058
2061
2059
    /**
2062
    /**
2060
     * @brief Defines data for the Call Graph events filter.
2063
     * @brief Defines data for the Call Graph events filter
2061
     *
2064
     *
2062
     * Defines data for the Call Graph events filter.
2065
     * Defines data for the Call Graph events filter
2063
     */
2066
     */
2064
    struct SCallGraphFilterData
2067
    struct SCallGraphFilterData
2065
    {   
2068
    {   
Lines 2114-2122 Link Here
2114
    //////////////////////////////////////////////////////////////////////////
2117
    //////////////////////////////////////////////////////////////////////////
2115
2118
2116
    /**
2119
    /**
2117
     * @brief Defines data for the Heap events filter.
2120
     * @brief Defines data for the Heap events filter
2118
     *
2121
     *
2119
     * Defines data for the Heap events filter.
2122
     * Defines data for the Heap events filter
2120
     */
2123
     */
2121
    struct SHeapFilterData
2124
    struct SHeapFilterData
2122
    {
2125
    {
Lines 2164-2201 Link Here
2164
        virtual bool ShouldNotify(SHeapFilterData &objectInfo) = 0;
2167
        virtual bool ShouldNotify(SHeapFilterData &objectInfo) = 0;
2165
    };
2168
    };
2166
2169
2167
2168
    //////////////////////////////////////////////////////////////////////////
2170
    //////////////////////////////////////////////////////////////////////////
2169
    // Thread Events Filter
2171
    // Thread Interaction Events Filter
2170
    //////////////////////////////////////////////////////////////////////////
2172
    //////////////////////////////////////////////////////////////////////////
2171
2173
2172
    /**
2174
    /**
2173
     * @brief Defines data for the Thread events filter.
2175
     * @brief Defines data for the Thread Interaction events filter
2174
     *
2176
     *
2175
     * Defines data for the Thread events filter.
2177
     * Defines data for the Thread Interaction events filter
2176
     */
2178
     */
2177
    struct SThreadInteractionFilterData
2179
    struct SThreadInteractionFilterData
2178
    {
2180
    {
2179
        const char *szClassName;            //!< Fully qualified class name
2181
        const char *szClassName;    //!< Fully qualified class name
2180
        const char *szMethodName;           //!< Method name
2182
        const char *szMethodName;   //!< Method name
2181
    };
2183
    };
2182
2184
2183
    /**
2185
    /**
2184
     * @interface IThreadInteractionFilter 
2186
     * @interface IThreadInteractionFilter 
2185
     * @brief Event Filter interface for defining selectivity for Thread events
2187
     * @brief Event Filter interface for defining selectivity for Thread Interaction events
2186
     *
2188
     *
2187
     * Event Filter interface for defining selectivity for the following
2189
     * Event Filter interface for defining selectivity for the following
2188
     * events: Thread interactions
2190
     * events: Thread Interaction
2189
     *
2191
     *
2190
     * To implement selectivity, the client defines a filter class which implements this 
2192
     * To implement selectivity, the client defines a filter class which implements this 
2191
     * interface, and then registers an instance of this class with MPI using the 
2193
     * interface, and then registers an instance of this class with MPI using the 
2192
     * IMpi::SetEventGroupFilter method.
2194
     * IMpi::SetEventGroupFilter method.
2193
     *
2195
     *
2194
     * The MPI implementation will call the ShouldNotify method of the filter class for each
2196
     * The MPI implementation will call the ShouldNotify method of the filter class for each
2195
     * new class it encounters, in order to determine whether to generate (add BCI) Thread events
2197
     * new method it encounters, in order to determine whether to report Thread
2196
     * for this class.
2198
     * Interaction events that occur within the method
2197
     *
2198
     * @remark - currently it isn't implemented properly
2199
     */
2199
     */
2200
    class IThreadInteractionFilter : public IEventFilter
2200
    class IThreadInteractionFilter : public IEventFilter
2201
    {
2201
    {
Lines 2203-2223 Link Here
2203
        virtual EFilterType Type() { return FT_THREAD_INTERACTION; }
2203
        virtual EFilterType Type() { return FT_THREAD_INTERACTION; }
2204
2204
2205
        /**
2205
        /**
2206
         * @brief Invoked to determine event selectivity for a class
2206
         * @brief Invoked to determine event selectivity for a method
2207
         *
2207
         *
2208
         * This method is implemented by the filter class and called by the MPI implementation
2208
         * This method is implemented by the filter class and called by the MPI implementation
2209
         * to determine whether to report (add BCI for event generation) thread events for a class
2209
         * for each method that is about to execute to determine whether to report Thread
2210
         * Interaction events that occur within the method
2210
         *
2211
         *
2211
         * @param[in]   objectInfo  class information
2212
         * @param[in]   methodInfo  method information
2212
         *
2213
         *
2213
         * @retval      true        an implementation returns true to indicate that events
2214
         * @retval      true        an implementation returns true to indicate that events
2214
         *                          should be reported for this class
2215
         *                          should be reported for this method
2215
         *
2216
         *
2216
         * @retval      false       an implementation returns false to indicate that events
2217
         * @retval      false       an implementation returns false to indicate that events
2217
         *                          should not be reported for this class
2218
         *                          should not be reported for this method
2218
         *
2219
         *
2219
         */
2220
         */
2220
        virtual bool ShouldNotify(SThreadInteractionFilterData &objectInfo) = 0;
2221
        virtual bool ShouldNotify(SThreadInteractionFilterData &methodInfo) = 0;
2221
    };
2222
    };
2222
2223
2223
    //////////////////////////////////////////////////////////////////////////
2224
    //////////////////////////////////////////////////////////////////////////
(-)src-native/include/Martini/MpiBase.h (-3 / +3 lines)
Lines 133-139 Link Here
133
 * - EG_HEAP: Object Alloc and Object Free
133
 * - EG_HEAP: Object Alloc and Object Free
134
 * - EG_MONITOR: Monitor Wait, Monitor Waited, Contended Monitor Enter and 
134
 * - EG_MONITOR: Monitor Wait, Monitor Waited, Contended Monitor Enter and 
135
 *               Contended Monitor Entered
135
 *               Contended Monitor Entered
136
 * - EG_THREAD_INTERACTION: Thread notification, interuption and spawning
136
 * - EG_THREAD_INTERACTION: Thread Interaction
137
 * 
137
 * 
138
 * To apply a filter to an MPI event group, the MPI client must define an Event Filter class
138
 * To apply a filter to an MPI event group, the MPI client must define an Event Filter class
139
 * for the specific event group it wants to restrict, and then register an instance of this 
139
 * for the specific event group it wants to restrict, and then register an instance of this 
Lines 396-403 Link Here
396
        enum EFilterType
396
        enum EFilterType
397
        {
397
        {
398
            FT_CALLGRAPH,          //!< Call-graph filter
398
            FT_CALLGRAPH,          //!< Call-graph filter
399
            FT_HEAP,               //!< Heap filters
399
            FT_HEAP,               //!< Heap filter
400
            FT_THREAD_INTERACTION  //!< Thread filters
400
            FT_THREAD_INTERACTION  //!< Thread-interaction filter
401
        };
401
        };
402
402
403
        /**
403
        /**
(-)src-native/src/Martini/Infrastructure/JPI/EventDispatcher.h (-1 / +1 lines)
Lines 464-470 Link Here
464
464
465
465
466
    /**
466
    /**
467
     * @brief Dispatcher for the Call CA methoda event
467
     * @brief Dispatcher for the Thread Interaction event
468
     */
468
     */
469
    class CThreadInteractionEventDispatcher : public CEventDispatcher
469
    class CThreadInteractionEventDispatcher : public CEventDispatcher
470
    {
470
    {
(-)src-native/src/Martini/Infrastructure/JPI/EventDispatcher.cpp (-1 / +2 lines)
Lines 1001-1007 Link Here
1001
1001
1002
1002
1003
//////////////////////////////////////////////////////////////////////////
1003
//////////////////////////////////////////////////////////////////////////
1004
// CCallNotifyEventDispatcher
1004
// CThreadInteractionEventDispatcher
1005
1005
void CThreadInteractionEventDispatcher::Notify(SEmData *pData, 
1006
void CThreadInteractionEventDispatcher::Notify(SEmData *pData, 
1006
                                               IEventObserver *pObserver,
1007
                                               IEventObserver *pObserver,
1007
                                               BitSet dataItems)
1008
                                               BitSet dataItems)
(-)src-native/src/Martini/Infrastructure/Include/ThreadAdaptor.h (-7 / +9 lines)
Lines 31-47 Link Here
31
namespace Martini { namespace ThreadAdaptor {
31
namespace Martini { namespace ThreadAdaptor {
32
    
32
    
33
    /**
33
    /**
34
     * @brief Function prototype for the callThreadInteraction native method of the Thread Proxy Java 
34
     * @brief Function prototype for the callThreadInteraction native method of the 
35
     *        class
35
     * Thread Proxy Java class
36
     *
36
     *
37
     * This is a prototype for a function that provides an implementation of the 
37
     * This is a prototype for a function that provides an implementation of the 
38
     * CallNotify native method of ThreadProxy.java.
38
     * callThreadInteraction native method of ThreadProxy.java.
39
     */
39
     */
40
    typedef void (JNICALL *TThreadInteractionHandler)(JNIEnv *env, jclass self, 
40
    typedef void (JNICALL *TThreadInteractionHandler)(JNIEnv *env, 
41
                                                jobject obj, jint methodID);
41
                                                      jclass self, 
42
                                                      jobject obj, 
43
                                                      jint methodID);
42
44
43
45
    struct SHookMethodCall 
44
    struct SHookMethodCall {
46
    {
45
        const char *methodName;
47
        const char *methodName;
46
        JIE::TConstantPoolIndex cpCallback;
48
        JIE::TConstantPoolIndex cpCallback;
47
    };
49
    };

Return to bug 209724