#include "global.h"
#include "types.h"
#include "output.h"
#include "classes.h"
#include "background.h"
#include "monitors.h"
#include "threads.h"
#include "communication.h"
Include dependency graph for xdprof.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | NotifyEvent (JVMPI_Event *event) |
This contains all the headers and global declarations. More... | |
Variables | |
MethodMap | Methods |
Current methods. More... | |
ThreadMap | Threads |
Currently running threads. More... | |
ClassMethopMap | ClassMethods |
Class to a set of methods. More... | |
ClassInfoMap | Classes |
Class to ClassInfo. More... | |
MethodMap | MethodCache |
This is a cache of methods that have popped up in the call stack. More... | |
ClassInfoMap | ClassCache |
|
This contains all the headers and global declarations. The space allocated for the JVMPI_Event structure and any event specific information is freed by the virtual machine once this function returns. The profiler agent must copy any necessary data it needs to retain into its internal buffers.
Definition at line 102 of file xdprof.cpp. 00103 { 00104 switch(event->event_type) 00105 { 00106 case JVMPI_EVENT_CLASS_LOAD: 00107 case JVMPI_EVENT_CLASS_LOAD | JVMPI_REQUESTED_EVENT: 00108 Lock(methods_lock); 00109 ClassLoadEvent(event->env_id, 00110 const_cast<char**>(& event->u.class_load.class_name), 00111 &event->u.class_load.source_name, 00112 event->u.class_load.num_interfaces, 00113 event->u.class_load.num_static_fields, 00114 event->u.class_load.statics, 00115 event->u.class_load.num_instance_fields, 00116 event->u.class_load.instances, 00117 event->u.class_load.num_methods, 00118 event->u.class_load.methods, 00119 event->u.class_load.class_id, 00120 event->event_type); 00121 Unlock(methods_lock); 00122 return; 00123 00124 case JVMPI_EVENT_CLASS_UNLOAD: 00125 ClassUnloadEvent(event->u.class_unload.class_id); 00126 return; 00127 00128 case JVMPI_EVENT_THREAD_START: 00129 case JVMPI_EVENT_THREAD_START | JVMPI_REQUESTED_EVENT: 00130 { 00131 debug("threadstart: ", event->env_id, event->u.thread_start.thread_env_id, (event->u.thread_start.thread_name != null) ? event->u.thread_start.thread_name : "null"); 00132 ThreadInfo ti(event->u.thread_start.thread_name, 00133 event->u.thread_start.group_name, 00134 event->u.thread_start.parent_name, 00135 event->u.thread_start.thread_id, 00136 event->u.thread_start.thread_env_id); 00137 //cerr << event->u.thread_start.thread_env_id << endl; 00138 ThreadStartHandler(event->u.thread_start.thread_env_id, ti); 00139 } 00140 return; 00141 00142 case JVMPI_EVENT_THREAD_END: 00143 //cerr << "remove " << event->env_id << endl; 00144 ThreadEndHandler(event->env_id); 00145 return; 00146 00147 case JVMPI_EVENT_OBJECT_ALLOC: 00148 { 00149 if (event->u.obj_alloc.class_id == null) 00150 return; 00151 00152 debug("alloc", event->env_id, event->u.obj_alloc.class_id, event->u.obj_alloc.obj_id); 00153 00154 // if we haven't caught the VM loading classes, we want to see if we can 00155 if (!CaughtVM) 00156 { 00157 // check thread 00158 Lock(threads_lock); 00159 bool loadThread = (Threads.find(event->env_id) == Threads.end()) && 00160 (DeadThreads.find(event->env_id) == DeadThreads.end()); 00161 Unlock(threads_lock); 00162 00163 if (loadThread) 00164 { 00165 jobjectID o = CALL(GetThreadObject)(event->env_id); 00166 if ((o != null) && (o != event->u.obj_alloc.obj_id)) 00167 { 00168 debug("in alloc, about to call RequestEvent JVMPI_EVENT_THREAD_START" , o); 00169 CHECKEDCALL(RequestEvent(JVMPI_EVENT_THREAD_START, o)); 00170 debug("back from thread start"); 00171 CaughtVM = true; 00172 CHECKEDCALL(DisableEvent(JVMPI_EVENT_OBJECT_ALLOC, NULL)); 00173 } 00174 } 00175 } 00176 else 00177 { 00178 // debug("CaughtVM == true!"); 00179 // should never be reached 00180 } 00181 } 00182 return; 00183 00184 case JVMPI_EVENT_JVM_SHUT_DOWN: 00185 { 00186 ShutdownRequested = true; 00187 CALL(RawMonitorNotifyAll(BackgroundMonitor)); 00188 00189 //{ for (int tdu = 0; tdu < 10; ++tdu) ThreadDump("???\n", event->env_id); } 00190 00191 //Lock(output_lock); 00192 ShutdownCommunications(); 00193 //Unlock(output_lock); 00194 00195 ShutdownMonitors(); 00196 //DeleteMethods(); 00197 } 00198 return; 00199 00200 case JVMPI_EVENT_JVM_INIT_DONE: 00201 debug("Init done!!!", event->env_id ); 00202 CreateBackgroundThread(); 00203 return; 00204 00205 00206 default: 00207 unsafe_debug("Unhandled event", event->event_type); 00208 return; 00209 } // end switch 00210 } // end notifyEvent |
|
|
|
Class to a set of methods.
|
|
Class to ClassInfo.
|
|
This is a cache of methods that have popped up in the call stack.
|
|
Current methods.
|
|
Currently running threads.
|