暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Profiler.h 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Shutdown();
  15. static void SetEvents(Il2CppProfileFlags events);
  16. static void InstallEnterLeave(Il2CppProfileMethodFunc enter, Il2CppProfileMethodFunc fleave);
  17. static void InstallAllocation(Il2CppProfileAllocFunc callback);
  18. static void InstallGC(Il2CppProfileGCFunc callback, Il2CppProfileGCResizeFunc heap_resize_callback);
  19. static void InstallFileIO(Il2CppProfileFileIOFunc callback);
  20. static void InstallThread(Il2CppProfileThreadFunc start, Il2CppProfileThreadFunc end);
  21. // internal
  22. public:
  23. static void Allocation(Il2CppObject *obj, Il2CppClass *klass);
  24. static void MethodEnter(const MethodInfo *method);
  25. static void MethodExit(const MethodInfo *method);
  26. static void GCEvent(Il2CppGCEvent eventType);
  27. static void GCHeapResize(int64_t newSize);
  28. static void FileIO(Il2CppProfileFileIOKind kind, int count);
  29. static void ThreadStart(unsigned long tid);
  30. static void ThreadEnd(unsigned long tid);
  31. static Il2CppProfileFlags s_profilerEvents;
  32. static inline bool ProfileAllocations()
  33. {
  34. return (s_profilerEvents & IL2CPP_PROFILE_ALLOCATIONS) != 0;
  35. }
  36. static inline bool ProfileFileIO()
  37. {
  38. return (s_profilerEvents & IL2CPP_PROFILE_FILEIO) != 0;
  39. }
  40. static void AllocateStaticData();
  41. static void FreeStaticData();
  42. private:
  43. };
  44. #endif
  45. } /* namespace vm */
  46. } /* namespace il2cpp */