zend_jit_vtune.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. | https://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. #if defined(__x86_64__) || defined(i386)
  19. #define HAVE_VTUNE 1
  20. #include "jit/vtune/jitprofiling.h"
  21. #include "jit/vtune/jitprofiling.c"
  22. static void zend_jit_vtune_register(const char *name,
  23. const void *start,
  24. size_t size)
  25. {
  26. iJIT_Method_Load jmethod = {0};
  27. if (iJIT_IsProfilingActive() != iJIT_SAMPLING_ON) {
  28. return;
  29. }
  30. jmethod.method_id = iJIT_GetNewMethodID();
  31. jmethod.method_name = (char*)name;
  32. jmethod.class_file_name = NULL;
  33. jmethod.source_file_name = NULL;
  34. jmethod.method_load_address = (void*)start;
  35. jmethod.method_size = size;
  36. iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
  37. }
  38. #endif /* defined(__x86_64__) || defined(i386) */