TraceSpan.h 976 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) Meta Platforms, Inc. and affiliates.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree.
  7. */
  8. #pragma once
  9. #include <atomic>
  10. #include <string>
  11. #include <thread>
  12. namespace libkineto {
  13. struct TraceSpan {
  14. TraceSpan() = delete;
  15. TraceSpan(int64_t startTime, int64_t endTime, std::string name)
  16. : startTime(startTime), endTime(endTime), name(std::move(name)) {}
  17. TraceSpan(int opCount, int it, std::string name, std::string prefix)
  18. : opCount(opCount),
  19. iteration(it),
  20. name(std::move(name)),
  21. prefix(std::move(prefix)) {}
  22. // FIXME: change to duration?
  23. int64_t startTime{0};
  24. int64_t endTime{0};
  25. int opCount{0};
  26. int iteration{-1};
  27. // Name is used to identify timeline
  28. std::string name;
  29. // Prefix used to distinguish trace spans on the same timeline
  30. std::string prefix;
  31. };
  32. } // namespace libkineto