1 // Copyright 2015 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 5 #ifndef SERVICES_VIZ_PUBLIC_CPP_GPU_COMMAND_BUFFER_METRICS_H_ 6 #define SERVICES_VIZ_PUBLIC_CPP_GPU_COMMAND_BUFFER_METRICS_H_ 7 8 #include <string> 9 10 #include "gpu/command_buffer/common/constants.h" 11 12 namespace viz { 13 namespace command_buffer_metrics { 14 15 // A rough classification for what the context is used for. These enum types 16 // correspond to the GPU.ContextLost UMA suffixes. Make sure to update 17 // UmaRecordContextLost() and tools/metrics/histograms/histograms.xml when 18 // adding a new value here. 19 enum class ContextType { 20 BROWSER_COMPOSITOR, 21 BROWSER_MAIN_THREAD, 22 BROWSER_WORKER, 23 RENDER_COMPOSITOR, 24 RENDER_WORKER, 25 RENDERER_MAIN_THREAD, 26 VIDEO_ACCELERATOR, 27 VIDEO_CAPTURE, 28 WEBGL, 29 WEBGPU, 30 MEDIA, 31 UNKNOWN, 32 FOR_TESTING, 33 XR_COMPOSITING, 34 }; 35 36 std::string ContextTypeToString(ContextType type); 37 38 void UmaRecordContextInitFailed(ContextType type); 39 40 void UmaRecordContextLost(ContextType type, 41 gpu::error::Error error, 42 gpu::error::ContextLostReason reason); 43 44 } // namespace command_buffer_metrics 45 } // namespace viz 46 47 #endif // SERVICES_VIZ_PUBLIC_CPP_GPU_COMMAND_BUFFER_METRICS_H_ 48