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

sampling.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 _SAMPLING_H_
00036 #define _SAMPLING_H_
00037 
00038 #include "../main/includes.h"
00039 #include "../prof/lock.h"
00040 
00048 class Sampling {
00049 
00051         enum CMD {
00052 
00053                 CMD_TURN_ON,
00054                 CMD_TURN_OFF,
00055                 CMD_TERMINATE
00056         };
00057 
00058 private:
00059 
00061         CMD _cmd;
00062 
00063 #ifdef USE_RAW_MONITORS
00064 
00065         Lock _lock;
00066 #else
00067 #ifdef WIN32
00068 
00069         HANDLE _turnedOn;
00070 
00072         CRITICAL_SECTION _cs;
00073 #else
00074 
00075         pthread_cond_t  _cond;
00076 
00078         pthread_mutex_t _mutex;
00079 #endif
00080 #endif
00081 
00082 public:
00083 
00089         Sampling( JVMPI_Interface* jvmpi);
00090         
00092         ~Sampling();
00093 
00103         int startThread(int turnedOn);
00104 
00108         void terminateThread();
00109 
00110 #ifndef USE_RAW_MONITORS
00111 
00114         void turnOn();
00115 
00119         void turnOff();
00120 #endif
00121 
00122 private:
00123 
00125         void main();
00126 
00128         void doOneSample();
00129 
00130 private:
00131 
00136         static void samplingMain( void*);
00137 
00138 #ifdef _DEBUG
00139 public:
00140 
00141         unsigned long start;
00142         unsigned long finish;
00143         unsigned long samples;
00144 #endif // _DEBUG
00145 
00146 private:
00147 
00149         int _terminated;
00150 
00151 public:
00152 
00159         int isTerminated();
00160 };
00161 
00162 #endif // _SAMPLING_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