WaitCounterDynamicBackend.h 916 B

1234567891011121314151617181920212223242526
  1. #if !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)
  2. #pragma once
  3. #include <cstdint>
  4. #include <string_view>
  5. namespace c10::monitor::detail {
  6. struct WaitCounterDynamicBackend {
  7. void* self{nullptr};
  8. intptr_t (*start)(void* self, int64_t nowUs){nullptr};
  9. void (*stop)(void* self, int64_t nowUs, intptr_t ctx){nullptr};
  10. void (*destroy)(void* self){nullptr};
  11. };
  12. using WaitCounterDynamicBackendInit =
  13. void (*)(WaitCounterDynamicBackend*, const char* key, std::size_t keyLen);
  14. // This name needs to be updated if anything in the API above is changed.
  15. constexpr std::string_view kWaitCounterDynamicBackendInitFn =
  16. "c10_monitor_wait_counter_dynamic_backend_init_v1";
  17. } // namespace c10::monitor::detail
  18. #else
  19. #error "This file should not be included when either TORCH_STABLE_ONLY or TORCH_TARGET_VERSION is defined."
  20. #endif // !defined(TORCH_STABLE_ONLY) && !defined(TORCH_TARGET_VERSION)