| /* |
| * Copyright (C) 2016 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. |
| */ |
| syntax = "proto3"; |
| |
| package profiler.proto; |
| option java_package = "com.android.tools.profiler.proto"; |
| option java_outer_classname = "EnergyProfiler"; |
| |
| service EnergyService { |
| // Requests energy data sampled between |start_time_excl| and |end_time_incl| |
| // for app specified by |app_id|. Note it is possible for the returned |
| // EnergyDataResponse to have have zero energy samples depending on the time |
| // range specified. |
| rpc GetEnergyData(EnergyDataRequest) returns (EnergyDataResponse) { |
| } |
| |
| // Requests wake lock data between |start_time_excl| and |end_time_incl| |
| // for app specified by |app_id|. Note it is possible for the returned |
| // WakeLockDataResponse to have have zero wake lock events depending on the |
| // time range specified. |
| rpc GetWakeLockData(WakeLockDataRequest) returns (WakeLockDataResponse) { |
| } |
| |
| // Starts energy data collection for app specified by |app_id|. Returns a |
| // device |timestamp| of when the collection started. |
| rpc StartCollection(StartEnergyCollectionRequest) |
| returns (EnergyCollectionStatusResponse) { |
| } |
| |
| // Stops energy stats collection for the given |app_id|. Returns a device |
| // |timestamp| of when the collection stopped. |
| rpc StopCollection(StopEnergyCollectionRequest) |
| returns (EnergyCollectionStatusResponse) { |
| } |
| } |
| |
| message EnergyDataRequest { |
| int32 app_id = 1; |
| int64 start_time_excl = 2; |
| int64 end_time_incl = 3; |
| } |
| |
| message EnergyDataResponse { |
| int32 app_id = 1; |
| repeated EnergySample energy_samples = 2; |
| } |
| |
| // Contains power usages of each system component. |
| message EnergySample { |
| int64 timestamp = 1; // When this sample was taken. |
| int32 screen_power_usage = 2; // (touch)screen. |
| int32 cpu_system_power_usage = 3; // System cpu time. |
| int32 cpu_user_power_usage = 4; // User cpu time. |
| int32 cell_network_power_usage = 5; // Cellular mobile network / radio. |
| int32 wifi_network_power_usage = 6; // Wifi network. |
| } |
| |
| message WakeLockDataRequest { |
| int32 app_id = 1; |
| int64 start_time_excl = 2; |
| int64 end_time_incl = 3; |
| } |
| |
| message WakeLockDataResponse { |
| int32 app_id = 1; |
| repeated WakeLockEvent wake_lock_events = 2; |
| } |
| |
| // An event related to the use of wake locks. |
| message WakeLockEvent { |
| // Type of wake lock this event refers to. |
| enum WakeLockType { |
| WINDOW = 0; |
| PM = 1; |
| } |
| |
| // The action performed on/by wake lock. |
| enum WakeLockAction { |
| CREATED = 0; |
| ACQUIRED = 1; |
| RELEASED_MANUAL = 2; |
| RELEASED_AUTOMATIC = 3; |
| } |
| |
| int64 timestamp = 1; |
| WakeLockType type = 2; |
| WakeLockAction action = 3; |
| string name = 4; |
| } |
| |
| message StartEnergyCollectionRequest { |
| int32 app_id = 1; |
| } |
| |
| message StopEnergyCollectionRequest { |
| int32 app_id = 1; |
| } |
| |
| message EnergyCollectionStatusResponse { |
| int32 app_id = 1; |
| int64 timestamp = 2; |
| } |