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

Commit 71d56044 authored by Lalit Maganti's avatar Lalit Maganti Committed by Android (Google) Code Review
Browse files

Merge "statsd: add subscription id to Perfetto command line and fix printf bug"

parents 38421787 e5755008
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ void triggerSubscribers(const int64_t rule_id,
                break;
            case Subscription::SubscriberInformationCase::kPerfettoDetails:
                if (!CollectPerfettoTraceAndUploadToDropbox(subscription.perfetto_details(),
                                                            rule_id, configKey)) {
                                                            subscription.id(), rule_id, configKey)) {
                    ALOGW("Failed to generate perfetto traces.");
                }
                break;
+7 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ namespace os {
namespace statsd {

bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config,
                                            int64_t subscription_id,
                                            int64_t alert_id,
                                            const ConfigKey& configKey) {
    VLOG("Starting trace collection through perfetto");
@@ -48,9 +49,11 @@ bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config,
        return false;
    }

    char alertId[20];
    char configId[20];
    char configUid[20];
    char subscriptionId[25];
    char alertId[25];
    char configId[25];
    char configUid[25];
    snprintf(subscriptionId, sizeof(subscriptionId), "%" PRId64, subscription_id);
    snprintf(alertId, sizeof(alertId), "%" PRId64, alert_id);
    snprintf(configId, sizeof(configId), "%" PRId64, configKey.GetId());
    snprintf(configUid, sizeof(configUid), "%d", configKey.GetUid());
@@ -94,7 +97,7 @@ bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config,

        execl("/system/bin/perfetto", "perfetto", "--background", "--config", "-", "--dropbox",
              kDropboxTag, "--alert-id", alertId, "--config-id", configId, "--config-uid",
              configUid, nullptr);
              configUid, "--subscription-id", subscriptionId, nullptr);

        // execl() doesn't return in case of success, if we get here something
        // failed.
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ class PerfettoDetails; // Declared in statsd_config.pb.h
// This method returns immediately after passing the config and does NOT wait
// for the full duration of the trace.
bool CollectPerfettoTraceAndUploadToDropbox(const PerfettoDetails& config,
                                            int64_t subscription_id,
                                            int64_t alert_id,
                                            const ConfigKey& configKey);