2017-01-19 15:56:21 -08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "JankTracker.h"
|
|
|
|
#include "utils/Macros.h"
|
|
|
|
|
|
|
|
namespace android {
|
2018-04-12 13:09:04 -07:00
|
|
|
namespace uirenderer {
|
|
|
|
namespace protos {
|
2017-01-19 15:56:21 -08:00
|
|
|
class GraphicsStatsProto;
|
|
|
|
}
|
|
|
|
|
2019-08-16 13:43:08 -04:00
|
|
|
typedef void (*DumpMemoryFn)(void* buffer, int bufferOffset, int bufferSize, int totalSize,
|
|
|
|
void* param1, void* param2);
|
|
|
|
|
2017-01-19 15:56:21 -08:00
|
|
|
/*
|
|
|
|
* The exported entry points used by GraphicsStatsService.java in f/b/services/core
|
|
|
|
*
|
|
|
|
* NOTE: Avoid exporting a requirement on the protobuf itself. Keep the usage
|
|
|
|
* of the generated protobuf classes internal to libhwui.so to minimize library
|
|
|
|
* bloat.
|
|
|
|
*/
|
|
|
|
class GraphicsStatsService {
|
|
|
|
public:
|
|
|
|
class Dump;
|
|
|
|
enum class DumpType {
|
|
|
|
Text,
|
|
|
|
Protobuf,
|
2019-08-16 13:43:08 -04:00
|
|
|
ProtobufStatsd,
|
2017-01-19 15:56:21 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
ANDROID_API static void saveBuffer(const std::string& path, const std::string& package,
|
2017-12-11 16:30:36 -08:00
|
|
|
int64_t versionCode, int64_t startTime, int64_t endTime,
|
2017-11-03 10:12:19 -07:00
|
|
|
const ProfileData* data);
|
2017-01-19 15:56:21 -08:00
|
|
|
|
|
|
|
ANDROID_API static Dump* createDump(int outFd, DumpType type);
|
2017-11-03 10:12:19 -07:00
|
|
|
ANDROID_API static void addToDump(Dump* dump, const std::string& path,
|
2017-12-11 16:30:36 -08:00
|
|
|
const std::string& package, int64_t versionCode,
|
2017-11-03 10:12:19 -07:00
|
|
|
int64_t startTime, int64_t endTime, const ProfileData* data);
|
2017-01-19 15:56:21 -08:00
|
|
|
ANDROID_API static void addToDump(Dump* dump, const std::string& path);
|
|
|
|
ANDROID_API static void finishDump(Dump* dump);
|
2019-08-16 13:43:08 -04:00
|
|
|
ANDROID_API static void finishDumpInMemory(Dump* dump, const DumpMemoryFn& reader, void* param1,
|
|
|
|
void* param2);
|
2017-01-19 15:56:21 -08:00
|
|
|
|
|
|
|
// Visible for testing
|
2018-04-12 13:09:04 -07:00
|
|
|
static bool parseFromFile(const std::string& path, protos::GraphicsStatsProto* output);
|
2017-01-19 15:56:21 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace uirenderer */
|
2018-04-12 13:09:04 -07:00
|
|
|
} /* namespace android */
|