execution_status.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_EXECUTION_STATUS_H_
  5. #define COMPONENTS_OPTIMIZATION_GUIDE_CORE_EXECUTION_STATUS_H_
  6. #include <string>
  7. namespace optimization_guide {
  8. // The status of a model execution. These values are logged to UMA histograms,
  9. // do not change or reorder values. Make sure to update
  10. // |OptimizationGuideExecutionStatus| in //tools/metrics/histograms/enums.xml.
  11. enum class ExecutionStatus {
  12. // Status is unknown.
  13. kUnknown = 0,
  14. // Execution finished successfully.
  15. kSuccess = 1,
  16. // Execution is still pending.
  17. kPending = 2,
  18. // Execution failed because the model file is not available.
  19. kErrorModelFileNotAvailable = 3,
  20. // Execution failed because the model file could not be loaded into TFLite.
  21. kErrorModelFileNotValid = 4,
  22. // Execution failed because the input was empty or otherwise invalid.
  23. kErrorEmptyOrInvalidInput = 5,
  24. // Execution failed because of an unknown error.
  25. kErrorUnknown = 6,
  26. // Execution was cancelled. This can happen if the execution took too long to
  27. // finish and it was automatically cancelled after an experiment-controlled
  28. // timeout.
  29. kErrorCancelled = 7,
  30. kMaxValue = kErrorCancelled,
  31. };
  32. // Returns a string representation of |status|.
  33. std::string ExecutionStatusToString(ExecutionStatus status);
  34. } // namespace optimization_guide
  35. #endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_EXECUTION_STATUS_H_