xref: /PHP-8.0/ext/opcache/jit/zend_jit_vtune.c (revision 9a068760)
1 /*
2    +----------------------------------------------------------------------+
3    | Zend JIT                                                             |
4    +----------------------------------------------------------------------+
5    | Copyright (c) The PHP Group                                          |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 3.01 of the PHP license,      |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available through the world-wide-web at the following url:           |
10    | http://www.php.net/license/3_01.txt                                  |
11    | If you did not receive a copy of the PHP license and are unable to   |
12    | obtain it through the world-wide-web, please send a note to          |
13    | license@php.net so we can mail you a copy immediately.               |
14    +----------------------------------------------------------------------+
15    | Authors: Dmitry Stogov <dmitry@php.net>                              |
16    +----------------------------------------------------------------------+
17 */
18 
19 #define HAVE_VTUNE 1
20 
21 #include "jit/vtune/jitprofiling.h"
22 #include "jit/vtune/jitprofiling.c"
23 
zend_jit_vtune_register(const char * name,const void * start,size_t size)24 static void zend_jit_vtune_register(const char *name,
25                                     const void *start,
26                                     size_t      size)
27 {
28 	iJIT_Method_Load jmethod = {0};
29 
30 	if (iJIT_IsProfilingActive() != iJIT_SAMPLING_ON) {
31 		return;
32 	}
33 
34 	jmethod.method_id = iJIT_GetNewMethodID();
35 	jmethod.method_name = (char*)name;
36 	jmethod.class_file_name = NULL;
37 	jmethod.source_file_name = NULL;
38 	jmethod.method_load_address = (void*)start;
39 	jmethod.method_size = size;
40 
41 	iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
42 }
43