OLD | NEW |
1 /* | 1 /* |
2 This file is provided under a dual BSD/GPLv2 license. When using or | 2 This file is provided under a dual BSD/GPLv2 license. When using or |
3 redistributing this file, you may do so under either license. | 3 redistributing this file, you may do so under either license. |
4 | 4 |
5 GPL LICENSE SUMMARY | 5 GPL LICENSE SUMMARY |
6 | 6 |
7 Copyright(c) 2005-2012 Intel Corporation. All rights reserved. | 7 Copyright(c) 2005-2012 Intel Corporation. All rights reserved. |
8 | 8 |
9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
10 it under the terms of version 2 of the GNU General Public License as | 10 it under the terms of version 2 of the GNU General Public License as |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 typedef unsigned int(*TPInitialize)(void); | 96 typedef unsigned int(*TPInitialize)(void); |
97 static TPInitialize FUNC_Initialize=NULL; | 97 static TPInitialize FUNC_Initialize=NULL; |
98 | 98 |
99 typedef unsigned int(*TPNotify)(unsigned int, void*); | 99 typedef unsigned int(*TPNotify)(unsigned int, void*); |
100 static TPNotify FUNC_NotifyEvent=NULL; | 100 static TPNotify FUNC_NotifyEvent=NULL; |
101 | 101 |
102 static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING; | 102 static iJIT_IsProfilingActiveFlags executionMode = iJIT_NOTHING_RUNNING; |
103 | 103 |
104 /* end collector dll part. */ | 104 /* end collector dll part. */ |
105 | 105 |
106 /* loadiJIT_Funcs() : this function is called just in the beginning and is respo
nsible | 106 /* loadiJIT_Funcs() : this function is called just in the beginning and is respo
nsible |
107 ** to load the functions from BistroJavaCollector.dll | 107 ** to load the functions from BistroJavaCollector.dll |
108 ** result: | 108 ** result: |
109 ** on success: the functions loads, iJIT_DLL_is_missing=0, retur
n value = 1. | 109 ** on success: the functions loads, iJIT_DLL_is_missing=0, retur
n value = 1. |
110 ** on failure: the functions are NULL, iJIT_DLL_is_missing=1, retur
n value = 0. | 110 ** on failure: the functions are NULL, iJIT_DLL_is_missing=1, retur
n value = 0. |
111 */ | 111 */ |
112 static int loadiJIT_Funcs(void); | 112 static int loadiJIT_Funcs(void); |
113 | 113 |
114 /* global representing whether the BistroJavaCollector can't be loaded */ | 114 /* global representing whether the BistroJavaCollector can't be loaded */ |
115 static int iJIT_DLL_is_missing = 0; | 115 static int iJIT_DLL_is_missing = 0; |
116 | 116 |
117 /* Virtual stack - the struct is used as a virtual stack for each thread. | 117 /* Virtual stack - the struct is used as a virtual stack for each thread. |
118 ** Every thread initializes with a stack of size INIT_TOP_STACK. | 118 ** Every thread initializes with a stack of size INIT_TOP_STACK. |
119 ** Every method entry decreases from the current stack point, | 119 ** Every method entry decreases from the current stack point, |
120 ** and when a thread stack reaches its top of stack (return from the global func
tion), | 120 ** and when a thread stack reaches its top of stack (return from the global func
tion), |
121 ** the top of stack and the current stack increase. Notice that when returning f
rom a function | 121 ** the top of stack and the current stack increase. Notice that when returning f
rom a function |
122 ** the stack pointer is the address of the function return. | 122 ** the stack pointer is the address of the function return. |
123 */ | 123 */ |
124 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 124 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
125 static DWORD threadLocalStorageHandle = 0; | 125 static DWORD threadLocalStorageHandle = 0; |
126 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 126 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
127 static pthread_key_t threadLocalStorageHandle = (pthread_key_t)0; | 127 static pthread_key_t threadLocalStorageHandle = (pthread_key_t)0; |
128 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 128 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
129 | 129 |
130 #define INIT_TOP_Stack 10000 | 130 #define INIT_TOP_Stack 10000 |
131 | 131 |
132 typedef struct | 132 typedef struct |
133 { | 133 { |
134 unsigned int TopStack; | 134 unsigned int TopStack; |
135 unsigned int CurrentStack; | 135 unsigned int CurrentStack; |
136 } ThreadStack, *pThreadStack; | 136 } ThreadStack, *pThreadStack; |
137 | 137 |
138 /* end of virtual stack. */ | 138 /* end of virtual stack. */ |
139 | 139 |
140 /* | 140 /* |
141 ** The function for reporting virtual-machine related events to VTune. | 141 ** The function for reporting virtual-machine related events to VTune. |
142 ** Note: when reporting iJVM_EVENT_TYPE_ENTER_NIDS, there is no need to fill in
the stack_id | 142 ** Note: when reporting iJVM_EVENT_TYPE_ENTER_NIDS, there is no need to fill in
the stack_id |
143 ** field in the iJIT_Method_NIDS structure, as VTune fills it. | 143 ** field in the iJIT_Method_NIDS structure, as VTune fills it. |
144 ** | 144 ** |
145 ** The return value in iJVM_EVENT_TYPE_ENTER_NIDS && iJVM_EVENT_TYPE_LEAVE_NIDS
events | 145 ** The return value in iJVM_EVENT_TYPE_ENTER_NIDS && iJVM_EVENT_TYPE_LEAVE_NIDS
events |
146 ** will be 0 in case of failure. | 146 ** will be 0 in case of failure. |
147 ** in iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event it will be -1 if EventSpecificD
ata == 0 | 147 ** in iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED event it will be -1 if EventSpecificD
ata == 0 |
148 ** otherwise it will be 0. | 148 ** otherwise it will be 0. |
149 */ | 149 */ |
150 | 150 |
151 ITT_EXTERN_C int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventS
pecificData) | 151 ITT_EXTERN_C int JITAPI iJIT_NotifyEvent(iJIT_JVM_EVENT event_type, void *EventS
pecificData) |
152 { | 152 { |
153 int ReturnValue; | 153 int ReturnValue; |
154 | 154 |
155 /***************************************************************************
**** | 155 /***************************************************************************
**** |
156 ** This section is for debugging outside of VTune. | 156 ** This section is for debugging outside of VTune. |
157 ** It creates the environment variables that indicates call graph mode. | 157 ** It creates the environment variables that indicates call graph mode. |
158 ** If running outside of VTune remove the remark. | 158 ** If running outside of VTune remove the remark. |
159 ** | 159 ** |
160 | 160 |
161 static int firstTime = 1; | 161 static int firstTime = 1; |
162 char DoCallGraph[12] = "DoCallGraph"; | 162 char DoCallGraph[12] = "DoCallGraph"; |
163 if (firstTime) | 163 if (firstTime) |
164 { | 164 { |
165 firstTime = 0; | 165 firstTime = 0; |
166 SetEnvironmentVariable( "BISTRO_COLLECTORS_DO_CALLGRAPH", DoCallGraph); | 166 SetEnvironmentVariable( "BISTRO_COLLECTORS_DO_CALLGRAPH", DoCallGraph); |
167 } | 167 } |
168 | 168 |
169 ** end of section. | 169 ** end of section. |
170 ****************************************************************************
***/ | 170 ****************************************************************************
***/ |
171 | 171 |
172 /* initialization part - the functions have not been loaded yet. This part | 172 /* initialization part - the functions have not been loaded yet. This part |
173 **» » will load the functions, and check if we are in Call Graph mode.
| 173 **» » will load the functions, and check if we are in Call Graph mode. |
174 ** (for special treatment). | 174 ** (for special treatment). |
175 */ | 175 */ |
176 if (!FUNC_NotifyEvent) | 176 if (!FUNC_NotifyEvent) |
177 { | 177 { |
178 if (iJIT_DLL_is_missing) | 178 if (iJIT_DLL_is_missing) |
179 return 0; | 179 return 0; |
180 | 180 |
181 // load the Function from the DLL | 181 // load the Function from the DLL |
182 if (!loadiJIT_Funcs()) | 182 if (!loadiJIT_Funcs()) |
183 return 0; | 183 return 0; |
184 | 184 |
185 /* Call Graph initialization. */ | 185 /* Call Graph initialization. */ |
186 } | 186 } |
187 | 187 |
188 /* If the event is method entry/exit, check that in the current mode | 188 /* If the event is method entry/exit, check that in the current mode |
189 ** VTune is allowed to receive it | 189 ** VTune is allowed to receive it |
190 */ | 190 */ |
191 if ((event_type == iJVM_EVENT_TYPE_ENTER_NIDS || event_type == iJVM_EVENT_TY
PE_LEAVE_NIDS) && | 191 if ((event_type == iJVM_EVENT_TYPE_ENTER_NIDS || event_type == iJVM_EVENT_TY
PE_LEAVE_NIDS) && |
192 (executionMode != iJIT_CALLGRAPH_ON)) | 192 (executionMode != iJIT_CALLGRAPH_ON)) |
193 { | 193 { |
194 return 0; | 194 return 0; |
195 } | 195 } |
196 /* This section is performed when method enter event occurs. | 196 /* This section is performed when method enter event occurs. |
197 ** It updates the virtual stack, or creates it if this is the first | 197 ** It updates the virtual stack, or creates it if this is the first |
198 ** method entry in the thread. The stack pointer is decreased. | 198 ** method entry in the thread. The stack pointer is decreased. |
199 */ | 199 */ |
200 if (event_type == iJVM_EVENT_TYPE_ENTER_NIDS) | 200 if (event_type == iJVM_EVENT_TYPE_ENTER_NIDS) |
201 { | 201 { |
202 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 202 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
203 pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorage
Handle); | 203 pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorage
Handle); |
204 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 204 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
205 pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocal
StorageHandle); | 205 pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocal
StorageHandle); |
206 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 206 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
207 | 207 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 ((piJIT_Method_NIDS) EventSpecificData)->stack_id = (unsigned int)-1
; | 256 ((piJIT_Method_NIDS) EventSpecificData)->stack_id = (unsigned int)-1
; |
257 } | 257 } |
258 | 258 |
259 if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED) | 259 if (event_type == iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED) |
260 { | 260 { |
261 // check for use of reserved method IDs | 261 // check for use of reserved method IDs |
262 if ( ((piJIT_Method_Load) EventSpecificData)->method_id <= 999 ) | 262 if ( ((piJIT_Method_Load) EventSpecificData)->method_id <= 999 ) |
263 return 0; | 263 return 0; |
264 } | 264 } |
265 | 265 |
266 ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData); | 266 ReturnValue = (int)FUNC_NotifyEvent(event_type, EventSpecificData); |
267 | 267 |
268 return ReturnValue; | 268 return ReturnValue; |
269 } | 269 } |
270 | 270 |
271 ITT_EXTERN_C void JITAPI iJIT_RegisterCallbackEx(void *userdata, iJIT_ModeChange
dEx NewModeCallBackFuncEx) // The new mode call back routine | 271 ITT_EXTERN_C void JITAPI iJIT_RegisterCallbackEx(void *userdata, iJIT_ModeChange
dEx NewModeCallBackFuncEx) // The new mode call back routine |
272 { | 272 { |
273 // is it already missing... or the load of functions from the DLL failed | 273 // is it already missing... or the load of functions from the DLL failed |
274 if (iJIT_DLL_is_missing || !loadiJIT_Funcs()) | 274 if (iJIT_DLL_is_missing || !loadiJIT_Funcs()) |
275 { | 275 { |
276 NewModeCallBackFuncEx(userdata, iJIT_NO_NOTIFICATIONS); // then do not
bother with notifications | 276 NewModeCallBackFuncEx(userdata, iJIT_NO_NOTIFICATIONS); // then do not
bother with notifications |
(...skipping 12 matching lines...) Expand all Loading... |
289 { | 289 { |
290 loadiJIT_Funcs(); | 290 loadiJIT_Funcs(); |
291 } | 291 } |
292 | 292 |
293 return executionMode; | 293 return executionMode; |
294 } | 294 } |
295 #include <stdio.h> | 295 #include <stdio.h> |
296 /* this function loads the collector dll (BistroJavaCollector) and the relevant
functions. | 296 /* this function loads the collector dll (BistroJavaCollector) and the relevant
functions. |
297 ** on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1
. | 297 ** on success: all functions load, iJIT_DLL_is_missing = 0, return value = 1
. |
298 ** on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0
. | 298 ** on failure: all functions are NULL, iJIT_DLL_is_missing = 1, return value = 0
. |
299 */ | 299 */ |
300 static int loadiJIT_Funcs() | 300 static int loadiJIT_Funcs() |
301 { | 301 { |
302 static int bDllWasLoaded = 0; | 302 static int bDllWasLoaded = 0; |
303 char *dllName = (char*)rcsid; // !!! Just to avoid unused code elimination !
!! | 303 char *dllName = (char*)rcsid; // !!! Just to avoid unused code elimination !
!! |
304 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 304 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
305 DWORD dNameLength = 0; | 305 DWORD dNameLength = 0; |
306 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 306 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
307 | 307 |
308 if(bDllWasLoaded) | 308 if(bDllWasLoaded) |
309 {// dll was already loaded, no need to do it for the second time | 309 {// dll was already loaded, no need to do it for the second time |
310 return 1; | 310 return 1; |
311 } | 311 } |
312 | 312 |
313 // Assumes that the DLL will not be found | 313 // Assumes that the DLL will not be found |
314 iJIT_DLL_is_missing = 1; | 314 iJIT_DLL_is_missing = 1; |
315 FUNC_NotifyEvent = NULL; | 315 FUNC_NotifyEvent = NULL; |
316 | 316 |
317 if (m_libHandle) | 317 if (m_libHandle) |
318 { | 318 { |
319 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 319 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
320 FreeLibrary(m_libHandle); | 320 FreeLibrary(m_libHandle); |
321 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 321 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
322 dlclose(m_libHandle); | 322 dlclose(m_libHandle); |
323 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 323 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
324 m_libHandle = NULL; | 324 m_libHandle = NULL; |
325 } | 325 } |
326 | 326 |
327 // try to get the dll name from the environment | 327 // try to get the dll name from the environment |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 if (!m_libHandle) | 383 if (!m_libHandle) |
384 { | 384 { |
385 iJIT_DLL_is_missing = 1; // don't try to initialize JIT agent the second
time | 385 iJIT_DLL_is_missing = 1; // don't try to initialize JIT agent the second
time |
386 return 0; | 386 return 0; |
387 } | 387 } |
388 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 388 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
389 FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent"); | 389 FUNC_NotifyEvent = (TPNotify)GetProcAddress(m_libHandle, "NotifyEvent"); |
390 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 390 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
391 FUNC_NotifyEvent = reinterpret_cast<TPNotify>(reinterpret_cast<intptr_t>(dls
ym(m_libHandle, "NotifyEvent"))); | 391 FUNC_NotifyEvent = reinterpret_cast<TPNotify>(reinterpret_cast<intptr_t>(dls
ym(m_libHandle, "NotifyEvent"))); |
392 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 392 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
393 if (!FUNC_NotifyEvent) | 393 if (!FUNC_NotifyEvent) |
394 { | 394 { |
395 FUNC_Initialize = NULL; | 395 FUNC_Initialize = NULL; |
396 return 0; | 396 return 0; |
397 } | 397 } |
398 | 398 |
399 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 399 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
400 FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize"); | 400 FUNC_Initialize = (TPInitialize)GetProcAddress(m_libHandle, "Initialize"); |
401 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 401 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
402 FUNC_Initialize = reinterpret_cast<TPInitialize>(reinterpret_cast<intptr_t>(
dlsym(m_libHandle, "Initialize"))); | 402 FUNC_Initialize = reinterpret_cast<TPInitialize>(reinterpret_cast<intptr_t>(
dlsym(m_libHandle, "Initialize"))); |
403 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 403 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
404 if (!FUNC_Initialize) | 404 if (!FUNC_Initialize) |
405 { | 405 { |
406 FUNC_NotifyEvent = NULL; | 406 FUNC_NotifyEvent = NULL; |
407 return 0; | 407 return 0; |
408 } | 408 } |
409 | 409 |
410 executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize(); | 410 executionMode = (iJIT_IsProfilingActiveFlags)FUNC_Initialize(); |
411 if (executionMode != iJIT_SAMPLING_ON) | 411 if (executionMode != iJIT_SAMPLING_ON) |
412 executionMode = iJIT_SAMPLING_ON; | 412 executionMode = iJIT_SAMPLING_ON; |
413 | 413 |
414 bDllWasLoaded = 1; | 414 bDllWasLoaded = 1; |
(...skipping 11 matching lines...) Expand all Loading... |
426 threadLocalStorageHandle = TlsAlloc(); | 426 threadLocalStorageHandle = TlsAlloc(); |
427 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 427 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
428 pthread_key_create(&threadLocalStorageHandle, NULL); | 428 pthread_key_create(&threadLocalStorageHandle, NULL); |
429 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 429 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
430 } | 430 } |
431 | 431 |
432 return 1; | 432 return 1; |
433 } | 433 } |
434 | 434 |
435 /* | 435 /* |
436 ** This function should be called by the user whenever a thread ends, to free th
e thread | 436 ** This function should be called by the user whenever a thread ends, to free th
e thread |
437 ** "virtual stack" storage | 437 ** "virtual stack" storage |
438 */ | 438 */ |
439 ITT_EXTERN_C void JITAPI FinalizeThread() | 439 ITT_EXTERN_C void JITAPI FinalizeThread() |
440 { | 440 { |
441 if (threadLocalStorageHandle) | 441 if (threadLocalStorageHandle) |
442 { | 442 { |
443 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 443 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
444 pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorage
Handle); | 444 pThreadStack threadStack = (pThreadStack)TlsGetValue (threadLocalStorage
Handle); |
445 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 445 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
446 pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocal
StorageHandle); | 446 pThreadStack threadStack = (pThreadStack)pthread_getspecific(threadLocal
StorageHandle); |
(...skipping 10 matching lines...) Expand all Loading... |
457 } | 457 } |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 /* | 461 /* |
462 ** This function should be called by the user when the process ends, to free the
local | 462 ** This function should be called by the user when the process ends, to free the
local |
463 ** storage index | 463 ** storage index |
464 */ | 464 */ |
465 ITT_EXTERN_C void JITAPI FinalizeProcess() | 465 ITT_EXTERN_C void JITAPI FinalizeProcess() |
466 { | 466 { |
467 if (m_libHandle) | 467 if (m_libHandle) |
468 { | 468 { |
469 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 469 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
470 FreeLibrary(m_libHandle); | 470 FreeLibrary(m_libHandle); |
471 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 471 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
472 dlclose(m_libHandle); | 472 dlclose(m_libHandle); |
473 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 473 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
474 m_libHandle = NULL; | 474 m_libHandle = NULL; |
475 } | 475 } |
476 | 476 |
477 if (threadLocalStorageHandle) | 477 if (threadLocalStorageHandle) |
478 #if ITT_PLATFORM==ITT_PLATFORM_WIN | 478 #if ITT_PLATFORM==ITT_PLATFORM_WIN |
479 TlsFree (threadLocalStorageHandle); | 479 TlsFree (threadLocalStorageHandle); |
480 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 480 #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
481 pthread_key_delete(threadLocalStorageHandle); | 481 pthread_key_delete(threadLocalStorageHandle); |
482 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ | 482 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ |
483 } | 483 } |
484 | 484 |
485 /* | 485 /* |
486 ** This function should be called by the user for any method once. | 486 ** This function should be called by the user for any method once. |
487 ** The function will return a unique method ID, the user should maintain the ID
for each | 487 ** The function will return a unique method ID, the user should maintain the ID
for each |
488 ** method | 488 ** method |
489 */ | 489 */ |
490 ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID() | 490 ITT_EXTERN_C unsigned int JITAPI iJIT_GetNewMethodID() |
491 { | 491 { |
492 static unsigned int methodID = 0x100000; | 492 static unsigned int methodID = 0x100000; |
493 | 493 |
494 if (methodID == 0) | 494 if (methodID == 0) |
495 return 0; // ERROR : this is not a valid value | 495 return 0; // ERROR : this is not a valid value |
496 | 496 |
497 return methodID++; | 497 return methodID++; |
498 } | 498 } |
499 | 499 |
OLD | NEW |