Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

thread.h

00001 /*
00002  *                         Sun Public License Notice
00003  *
00004  * The contents of this file are subject to the Sun Public License
00005  * Version 1.0 (the "License"); you may not use this file except
00006  * in compliance with the License. A copy of the License is available
00007  * at http://www.sun.com/
00008  *
00009  * The Original Code is the Java Profiler module.  The Initial Developers
00010  * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner,
00011  * Lukas Petru and Marek Przeczek.
00012  *
00013  * Portions created by Jan Stola are Copyright (C) 2000-2001.
00014  * All Rights Reserved.
00015  *
00016  * Portions created by Pavel Vacha are Copyright (C) 2000-2001.
00017  * All Rights Reserved.
00018  *
00019  * Portions created by Michal Pise are Copyright (C) 2000-2001.
00020  * All Rights Reserved.
00021  *
00022  * Portions created by Petr Luner are Copyright (C) 2000-2001.
00023  * All Rights Reserved.
00024  *
00025  * Portions created by Lukas Petru are Copyright (C) 2000-2001.
00026  * All Rights Reserved.
00027  *
00028  * Portions created by Marek Przeczek are Copyright (C) 2000-2001.
00029  * All Rights Reserved.
00030  *
00031  * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner,
00032  *               Lukas Petru and Marek Przeczek.
00033  */
00034 
00035 #ifndef _THREAD_H_
00036 #define _THREAD_H_
00037 
00038 #include "../main/includes.h"
00039 #include "../list/listItem.h"
00040 #include "../alloc/allocStatData.h"
00041 #include "../commun2/idObject.h"
00042 #include "../commun/binaryFormat.h"
00043 #include "../string/string.h"
00044 #include "../list/list.h"
00045 #include "../shared/thread.h"
00046 #include "../alloc/allocThreadObject.h"
00047 #include "../alloc/allocThreadMethod.h"
00048 #include "../cpu/cpuThreadMethod.h"
00049 #include "../mon/monThreadMethod.h"
00050 #include "../cpu/cpuStack.h"
00051 #include "../main/const.h"
00052 #include "../commun/buffer.h"
00053 #include "../allocator/allocator.h"
00054 
00065 class Thread: public LI1,
00066               public LI2,
00067               public LI3,
00068               public LI4,
00069               public LI5,
00070               public AllocStatData,
00071               public IdObject,
00072               public InfoBinaryFormat {
00073 public:
00074 
00076         String threadName;
00077 
00079         GroupThread* group;
00080 
00082         Thread* parent;
00083 
00085         List<Thread,LI3> children;
00086 
00088         jobjectID threadId;
00089 
00091         JNIEnv* threadEnvId;
00092 
00094         int active;
00095 
00097         List<AllocThreadObject,LI1> allocThreadObjects;
00098 
00100         List<AllocThreadMethod,LI1> allocThreadMethods;
00101 
00103         List<CpuThreadMethod,LI2> cpuThreadMethods;
00104 
00106         List<MonThreadMethod,LI2> monThreadMethods;
00107 
00109         CpuStack stack;
00110 
00114         JVMPI_CallTrace callTrace;
00115 
00117         Thread* nextSuspended;
00118 
00120         int hasRun;
00121 
00127         int monitorEnter;
00128 
00133         jobjectID monitorEnterObject;
00134 
00139         unsigned long monitorEnterTime;
00140 
00141 private:
00142 
00143         // not documented - for internal use
00144         JVMPI_CallFrame _frames[MAX_TRACE];
00145 
00146 public:
00147 
00149         Thread() :
00150 
00151                 group( NULL),
00152                 parent( NULL),
00153                 threadId( 0),
00154                 threadEnvId( NULL),
00155                 active( 1),
00156                 monitorEnter(0),
00157                 monitorEnterObject(0),
00158                 monitorEnterTime(0) {
00159 
00160                 callTrace.frames = _frames;
00161         }
00162 
00164         virtual ~Thread() {}
00165 
00174         JNIEnv* const& getKey(JNIEnv*& key) { return key = threadEnvId;}
00175 
00185         int operator==(JNIEnv* const& key) { return (threadEnvId == key);}
00186 
00193         static int hashKey(JNIEnv* const& key) { return (int)key;}
00194 
00203         virtual Buffer& infoToBin( Buffer& b);
00204 
00207         void deactivate();
00208 
00209 #ifdef USE_ALLOCATOR
00210 private:
00211 
00213         static Allocator _allocator;
00214 
00215 public:
00216 
00219         void* operator new( size_t sz) { return _allocator.get( sz);}
00220 
00223         void operator delete( void* unit) { _allocator.put( unit);}
00224 #endif
00225 
00226 public:
00227 
00232         virtual eClassIdent getClassIdent() { return THREAD;}
00233 
00240         virtual int isActive() { return active;}
00241 
00247         virtual int isChanged() { return (activeChanged() || dataChanged());} // order dependent !
00248 
00251         virtual void setUnchanged();
00252 };
00253 
00254 #endif // _THREAD_H_

Generated on Mon Jan 28 14:53:27 2002 for Java Profiler Dynamic Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001