1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <string>
20 #include <vector>
21 
22 #include <binder/Parcelable.h>
23 
24 namespace android {
25 
26 /*
27  * class for transporting gpu global stats from GpuService to authorized
28  * recipents. This class is intended to be a data container.
29  */
30 class GpuStatsGlobalInfo : public Parcelable {
31 public:
32     GpuStatsGlobalInfo() = default;
33     GpuStatsGlobalInfo(const GpuStatsGlobalInfo&) = default;
34     virtual ~GpuStatsGlobalInfo() = default;
35     virtual status_t writeToParcel(Parcel* parcel) const;
36     virtual status_t readFromParcel(const Parcel* parcel);
37     std::string toString() const;
38 
39     std::string driverPackageName = "";
40     std::string driverVersionName = "";
41     uint64_t driverVersionCode = 0;
42     int64_t driverBuildTime = 0;
43     int32_t glLoadingCount = 0;
44     int32_t glLoadingFailureCount = 0;
45     int32_t vkLoadingCount = 0;
46     int32_t vkLoadingFailureCount = 0;
47     int32_t vulkanVersion = 0;
48     int32_t cpuVulkanVersion = 0;
49     int32_t glesVersion = 0;
50     int32_t angleLoadingCount = 0;
51     int32_t angleLoadingFailureCount = 0;
52 };
53 
54 /*
55  * class for transporting gpu app stats from GpuService to authorized recipents.
56  * This class is intended to be a data container.
57  */
58 class GpuStatsAppInfo : public Parcelable {
59 public:
60     GpuStatsAppInfo() = default;
61     GpuStatsAppInfo(const GpuStatsAppInfo&) = default;
62     virtual ~GpuStatsAppInfo() = default;
63     virtual status_t writeToParcel(Parcel* parcel) const;
64     virtual status_t readFromParcel(const Parcel* parcel);
65     std::string toString() const;
66 
67     std::string appPackageName = "";
68     uint64_t driverVersionCode = 0;
69     std::vector<int64_t> glDriverLoadingTime = {};
70     std::vector<int64_t> vkDriverLoadingTime = {};
71     std::vector<int64_t> angleDriverLoadingTime = {};
72     bool cpuVulkanInUse = false;
73 };
74 
75 } // namespace android
76