blob: 389f599f439f656a6933b181af19b2b8ae99db1a [file] [log] [blame]
John Reckdf1742e2017-01-19 15:56:21 -08001/*
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
24namespace android {
Kweku Adams1856a4c2018-04-03 16:31:10 -070025namespace uirenderer {
26namespace protos {
John Reckdf1742e2017-01-19 15:56:21 -080027class GraphicsStatsProto;
28}
29
John Reckdf1742e2017-01-19 15:56:21 -080030/*
31 * The exported entry points used by GraphicsStatsService.java in f/b/services/core
32 *
33 * NOTE: Avoid exporting a requirement on the protobuf itself. Keep the usage
34 * of the generated protobuf classes internal to libhwui.so to minimize library
35 * bloat.
36 */
37class GraphicsStatsService {
38public:
39 class Dump;
40 enum class DumpType {
41 Text,
42 Protobuf,
43 };
44
45 ANDROID_API static void saveBuffer(const std::string& path, const std::string& package,
Dianne Hackborn73453e42017-12-11 16:30:36 -080046 int64_t versionCode, int64_t startTime, int64_t endTime,
John Reck1bcacfd2017-11-03 10:12:19 -070047 const ProfileData* data);
John Reckdf1742e2017-01-19 15:56:21 -080048
49 ANDROID_API static Dump* createDump(int outFd, DumpType type);
John Reck1bcacfd2017-11-03 10:12:19 -070050 ANDROID_API static void addToDump(Dump* dump, const std::string& path,
Dianne Hackborn73453e42017-12-11 16:30:36 -080051 const std::string& package, int64_t versionCode,
John Reck1bcacfd2017-11-03 10:12:19 -070052 int64_t startTime, int64_t endTime, const ProfileData* data);
John Reckdf1742e2017-01-19 15:56:21 -080053 ANDROID_API static void addToDump(Dump* dump, const std::string& path);
54 ANDROID_API static void finishDump(Dump* dump);
55
56 // Visible for testing
Kweku Adams1856a4c2018-04-03 16:31:10 -070057 static bool parseFromFile(const std::string& path, protos::GraphicsStatsProto* output);
John Reckdf1742e2017-01-19 15:56:21 -080058};
59
60} /* namespace uirenderer */
Kweku Adams1856a4c2018-04-03 16:31:10 -070061} /* namespace android */