Merge "Remove perfprofd support." into stage-aosp-master
This commit is contained in:
committed by
Android (Google) Code Review
commit
680c3dc33b
@@ -71,7 +71,6 @@ cc_defaults {
|
|||||||
"src/config/ConfigManager.cpp",
|
"src/config/ConfigManager.cpp",
|
||||||
"src/external/GpuStatsPuller.cpp",
|
"src/external/GpuStatsPuller.cpp",
|
||||||
"src/external/Perfetto.cpp",
|
"src/external/Perfetto.cpp",
|
||||||
"src/external/Perfprofd.cpp",
|
|
||||||
"src/external/StatsPuller.cpp",
|
"src/external/StatsPuller.cpp",
|
||||||
"src/external/StatsCallbackPuller.cpp",
|
"src/external/StatsCallbackPuller.cpp",
|
||||||
"src/external/StatsCompanionServicePuller.cpp",
|
"src/external/StatsCompanionServicePuller.cpp",
|
||||||
@@ -109,8 +108,6 @@ cc_defaults {
|
|||||||
"src/socket/StatsSocketListener.cpp",
|
"src/socket/StatsSocketListener.cpp",
|
||||||
"src/shell/ShellSubscriber.cpp",
|
"src/shell/ShellSubscriber.cpp",
|
||||||
"src/shell/shell_config.proto",
|
"src/shell/shell_config.proto",
|
||||||
|
|
||||||
":perfprofd_aidl",
|
|
||||||
],
|
],
|
||||||
|
|
||||||
local_include_dirs: [
|
local_include_dirs: [
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
#include <binder/IServiceManager.h>
|
#include <binder/IServiceManager.h>
|
||||||
|
|
||||||
#include "external/Perfetto.h"
|
#include "external/Perfetto.h"
|
||||||
#include "external/Perfprofd.h"
|
|
||||||
#include "subscriber/IncidentdReporter.h"
|
#include "subscriber/IncidentdReporter.h"
|
||||||
#include "subscriber/SubscriberReporter.h"
|
#include "subscriber/SubscriberReporter.h"
|
||||||
|
|
||||||
@@ -64,12 +63,6 @@ void triggerSubscribers(int64_t ruleId, int64_t metricId, const MetricDimensionK
|
|||||||
SubscriberReporter::getInstance().alertBroadcastSubscriber(configKey, subscription,
|
SubscriberReporter::getInstance().alertBroadcastSubscriber(configKey, subscription,
|
||||||
dimensionKey);
|
dimensionKey);
|
||||||
break;
|
break;
|
||||||
case Subscription::SubscriberInformationCase::kPerfprofdDetails:
|
|
||||||
if (!CollectPerfprofdTraceAndUploadToDropbox(subscription.perfprofd_details(),
|
|
||||||
ruleId, configKey)) {
|
|
||||||
ALOGW("Failed to generate perfprofd traces.");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
74
cmds/statsd/src/external/Perfprofd.cpp
vendored
74
cmds/statsd/src/external/Perfprofd.cpp
vendored
@@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Perfprofd.h"
|
|
||||||
|
|
||||||
#define DEBUG false // STOPSHIP if true
|
|
||||||
#include "config/ConfigKey.h"
|
|
||||||
#include "Log.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <binder/IServiceManager.h>
|
|
||||||
|
|
||||||
#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" // Alert
|
|
||||||
|
|
||||||
#include "android/os/IPerfProfd.h"
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace os {
|
|
||||||
namespace statsd {
|
|
||||||
|
|
||||||
bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config,
|
|
||||||
int64_t alert_id,
|
|
||||||
const ConfigKey& configKey) {
|
|
||||||
VLOG("Starting trace collection through perfprofd");
|
|
||||||
|
|
||||||
if (!config.has_perfprofd_config()) {
|
|
||||||
ALOGE("The perfprofd trace config is empty, aborting");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
sp<IPerfProfd> service = interface_cast<IPerfProfd>(
|
|
||||||
defaultServiceManager()->getService(android::String16("perfprofd")));
|
|
||||||
if (service == NULL) {
|
|
||||||
ALOGE("Could not find perfprofd service");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto* data = reinterpret_cast<const uint8_t*>(config.perfprofd_config().data());
|
|
||||||
std::vector<uint8_t> proto_serialized(data, data + config.perfprofd_config().size());
|
|
||||||
|
|
||||||
// TODO: alert-id etc?
|
|
||||||
|
|
||||||
binder::Status status = service->startProfilingProtobuf(proto_serialized);
|
|
||||||
if (status.isOk()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ALOGE("Error starting perfprofd profiling: %s", status.toString8().c_str());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace statsd
|
|
||||||
} // namespace os
|
|
||||||
} // namespace android
|
|
||||||
38
cmds/statsd/src/external/Perfprofd.h
vendored
38
cmds/statsd/src/external/Perfprofd.h
vendored
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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 <inttypes.h>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace os {
|
|
||||||
namespace statsd {
|
|
||||||
|
|
||||||
class ConfigKey;
|
|
||||||
class PerfprofdDetails; // Declared in statsd_config.pb.h
|
|
||||||
|
|
||||||
// Starts the collection of a Perfprofd trace with the given |config|.
|
|
||||||
// The trace is uploaded to Dropbox by the perfprofd service once done.
|
|
||||||
// This method returns immediately after passing the config and does NOT wait
|
|
||||||
// for the full duration of the trace.
|
|
||||||
bool CollectPerfprofdTraceAndUploadToDropbox(const PerfprofdDetails& config,
|
|
||||||
int64_t alert_id,
|
|
||||||
const ConfigKey& configKey);
|
|
||||||
|
|
||||||
} // namespace statsd
|
|
||||||
} // namespace os
|
|
||||||
} // namespace android
|
|
||||||
@@ -343,15 +343,6 @@ message PerfettoDetails {
|
|||||||
optional bytes trace_config = 1;
|
optional bytes trace_config = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message PerfprofdDetails {
|
|
||||||
// The |perfprofd_config| field is a proto-encoded message of type
|
|
||||||
// android.perfprofd.ProfilingConfig defined in
|
|
||||||
// //system/extras/perfprofd/. On device, statsd doesn't need to
|
|
||||||
// deserialize the message as it's just passed binary-encoded to
|
|
||||||
// the perfprofd service.
|
|
||||||
optional bytes perfprofd_config = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message BroadcastSubscriberDetails {
|
message BroadcastSubscriberDetails {
|
||||||
optional int64 subscriber_id = 1;
|
optional int64 subscriber_id = 1;
|
||||||
repeated string cookie = 2;
|
repeated string cookie = 2;
|
||||||
@@ -373,10 +364,12 @@ message Subscription {
|
|||||||
IncidentdDetails incidentd_details = 4;
|
IncidentdDetails incidentd_details = 4;
|
||||||
PerfettoDetails perfetto_details = 5;
|
PerfettoDetails perfetto_details = 5;
|
||||||
BroadcastSubscriberDetails broadcast_subscriber_details = 6;
|
BroadcastSubscriberDetails broadcast_subscriber_details = 6;
|
||||||
PerfprofdDetails perfprofd_details = 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
optional float probability_of_informing = 7 [default = 1.1];
|
optional float probability_of_informing = 7 [default = 1.1];
|
||||||
|
|
||||||
|
// This was used for perfprofd historically.
|
||||||
|
reserved 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ActivationType {
|
enum ActivationType {
|
||||||
|
|||||||
Reference in New Issue
Block a user