• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 
21 #include "JankTracker.h"
22 #include "utils/Macros.h"
23 
24 namespace android {
25 namespace service {
26 class GraphicsStatsProto;
27 }
28 
29 namespace uirenderer {
30 
31 /*
32  * The exported entry points used by GraphicsStatsService.java in f/b/services/core
33  *
34  * NOTE: Avoid exporting a requirement on the protobuf itself. Keep the usage
35  * of the generated protobuf classes internal to libhwui.so to minimize library
36  * bloat.
37  */
38 class GraphicsStatsService {
39 public:
40     class Dump;
41     enum class DumpType {
42         Text,
43         Protobuf,
44     };
45 
46     ANDROID_API static void saveBuffer(const std::string& path, const std::string& package,
47             int versionCode, int64_t startTime, int64_t endTime, const ProfileData* data);
48 
49     ANDROID_API static Dump* createDump(int outFd, DumpType type);
50     ANDROID_API static void addToDump(Dump* dump, const std::string& path, const std::string& package,
51             int versionCode, int64_t startTime, int64_t endTime, const ProfileData* data);
52     ANDROID_API static void addToDump(Dump* dump, const std::string& path);
53     ANDROID_API static void finishDump(Dump* dump);
54 
55     // Visible for testing
56     static bool parseFromFile(const std::string& path, service::GraphicsStatsProto* output);
57 };
58 
59 } /* namespace uirenderer */
60 } /* namespace android */