Profiler.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <stdint.h>
  3. #include "il2cpp-config.h"
  4. namespace il2cpp
  5. {
  6. namespace vm
  7. {
  8. #if IL2CPP_ENABLE_PROFILER
  9. class LIBIL2CPP_CODEGEN_API Profiler
  10. {
  11. // exported
  12. public:
  13. static void Install(Il2CppProfiler *prof, Il2CppProfileFunc shutdownCallback);
  14. static void SetEvents(Il2CppProfileFlags events);
  15. static void InstallEnterLeave(Il2CppProfileMethodFunc enter, Il2CppProfileMethodFunc fleave);
  16. static void InstallAllocation(Il2CppProfileAllocFunc callback);
  17. static void InstallGC(Il2CppProfileGCFunc callback, Il2CppProfileGCResizeFunc heap_resize_callback);
  18. static void InstallFileIO(Il2CppProfileFileIOFunc callback);
  19. // internal
  20. public:
  21. static void Allocation(Il2CppObject *obj, Il2CppClass *klass);
  22. static void MethodEnter(const MethodInfo *method);
  23. static void MethodExit(const MethodInfo *method);
  24. static void GCEvent(Il2CppGCEvent eventType);
  25. static void GCHeapResize(int64_t newSize);
  26. static void FileIO(Il2CppProfileFileIOKind kind, int count);
  27. static Il2CppProfileFlags s_profilerEvents;
  28. static inline bool ProfileAllocations()
  29. {
  30. return (s_profilerEvents & IL2CPP_PROFILE_ALLOCATIONS) != 0;
  31. }
  32. static inline bool ProfileFileIO()
  33. {
  34. return (s_profilerEvents & IL2CPP_PROFILE_FILEIO) != 0;
  35. }
  36. private:
  37. };
  38. #endif
  39. } /* namespace vm */
  40. } /* namespace il2cpp */