Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 680c3dc3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove perfprofd support." into stage-aosp-master

parents a3a404bb f2eb832c
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ cc_defaults {
        "src/config/ConfigManager.cpp",
        "src/external/GpuStatsPuller.cpp",
        "src/external/Perfetto.cpp",
        "src/external/Perfprofd.cpp",
        "src/external/StatsPuller.cpp",
        "src/external/StatsCallbackPuller.cpp",
        "src/external/StatsCompanionServicePuller.cpp",
@@ -109,8 +108,6 @@ cc_defaults {
        "src/socket/StatsSocketListener.cpp",
        "src/shell/ShellSubscriber.cpp",
        "src/shell/shell_config.proto",

        ":perfprofd_aidl",
    ],

    local_include_dirs: [
+0 −7
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <binder/IServiceManager.h>

#include "external/Perfetto.h"
#include "external/Perfprofd.h"
#include "subscriber/IncidentdReporter.h"
#include "subscriber/SubscriberReporter.h"

@@ -64,12 +63,6 @@ void triggerSubscribers(int64_t ruleId, int64_t metricId, const MetricDimensionK
                SubscriberReporter::getInstance().alertBroadcastSubscriber(configKey, subscription,
                                                                           dimensionKey);
                break;
            case Subscription::SubscriberInformationCase::kPerfprofdDetails:
                if (!CollectPerfprofdTraceAndUploadToDropbox(subscription.perfprofd_details(),
                                                             ruleId, configKey)) {
                    ALOGW("Failed to generate perfprofd traces.");
                }
                break;
            default:
                break;
        }
+0 −74
Original line number Diff line number Diff line
/*
 * 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
+0 −38
Original line number Diff line number Diff line
/*
 * 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
+3 −10
Original line number Diff line number Diff line
@@ -343,15 +343,6 @@ message PerfettoDetails {
  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 {
  optional int64 subscriber_id = 1;
  repeated string cookie = 2;
@@ -373,10 +364,12 @@ message Subscription {
    IncidentdDetails incidentd_details = 4;
    PerfettoDetails perfetto_details = 5;
    BroadcastSubscriberDetails broadcast_subscriber_details = 6;
    PerfprofdDetails perfprofd_details = 8;
  }

  optional float probability_of_informing = 7 [default = 1.1];

  // This was used for perfprofd historically.
  reserved 8;
}

enum ActivationType {