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 #include "../shared/method.h" 00036 #include "../shared/class.h" 00037 #include "../prof/prof.h" 00038 #include "../alloc/allocThreadMethod.h" 00039 #include "../cpu/cpuThreadMethod.h" 00040 #include "../mon/monThreadMethod.h" 00041 #include "../alloc/allocTrace.h" 00042 #include "../cpu/cpuTrace.h" 00043 #include "../mon/monTrace.h" 00044 00045 #ifdef USE_ALLOCATOR 00046 Allocator Method::_allocator; 00047 #endif 00048 00049 Buffer& Method::infoToBin( Buffer& b) { 00050 00051 b += methodName; 00052 b += methodSignature; 00053 b += startLineno; 00054 b += endLineno; 00055 b += (clss->getProfID()); 00056 00057 return b; 00058 } 00059 00060 void Method::deactivate() { 00061 00062 Prof::prof().activeMethods.removeNoRehash(this); 00063 00064 AllocThreadMethod* atm = allocThreadMethods.first(); 00065 while (atm) { 00066 atm->deactivate(); 00067 atm = allocThreadMethods.next(atm); 00068 } 00069 00070 CpuThreadMethod* ctm = cpuThreadMethods.first(); 00071 while (ctm) { 00072 ctm->deactivate(); 00073 ctm = cpuThreadMethods.next(ctm); 00074 } 00075 00076 MonThreadMethod* mtm = monThreadMethods.first(); 00077 while (mtm) { 00078 mtm->deactivate(); 00079 mtm = monThreadMethods.next(mtm); 00080 } 00081 00082 AllocTrace* at = allocTraces.first(); 00083 while (at) { 00084 at->deactivate(); 00085 at = allocTraces.next(at); 00086 } 00087 00088 CpuTrace* ct = cpuTraces.first(); 00089 while (ct) { 00090 ct->deactivate(); 00091 ct = cpuTraces.next(ct); 00092 } 00093 00094 MonTrace* mt = monTraces.first(); 00095 while (mt) { 00096 mt->deactivate(); 00097 mt = monTraces.next(mt); 00098 } 00099 } 00100 00101 int Method::isActive() { 00102 00103 return (clss) ? clss->isActive() : 1; 00104 } 00105 00106 int Method::isChanged() { 00107 00108 return (activeChanged() || 00109 AllocStatData::dataChanged() || 00110 CpuStatData::dataChanged() || 00111 MonStatData::dataChanged()); // order dependent ! 00112 } 00113 00114 void Method::setUnchanged() { 00115 00116 IdObject::setUnchanged(); 00117 AllocStatData::clearDataChanged(); 00118 CpuStatData::clearDataChanged(); 00119 MonStatData::clearDataChanged(); 00120 }