Home | History | Annotate | Download | only in android
      1 /*
      2  * Copyright (C) 2019 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 syntax = "proto2";
     18 option optimize_for = LITE_RUNTIME;
     19 
     20 package perfetto.protos;
     21 
     22 // Memory metrics on Android.
     23 message AndroidMemoryMetric {
     24   // Next id: 6
     25   message SystemMetrics {
     26     reserved 3;
     27 
     28     optional Counter anon_pages = 1;
     29     optional Counter mmaped_pages = 2;
     30     repeated NamedCounter ion_buffers = 4;
     31     optional LowMemoryKills lmks = 5;
     32   }
     33 
     34   message LowMemoryKills {
     35     message LowMemoryKillBreakdown {
     36       optional int32 oom_score_adj = 1;
     37       optional int32 count = 2;
     38     }
     39 
     40     optional int32 total_count = 1;
     41     repeated LowMemoryKillBreakdown breakdown = 2;
     42   }
     43 
     44   // Next id: 14
     45   message ProcessMetrics {
     46     reserved 2 to 9;
     47 
     48     optional string process_name = 1;
     49     optional ProcessMemoryCounters overall_counters = 10;
     50 
     51     message ProcessMetricsBreakdown {
     52       reserved 1;
     53       optional string process_priority = 3;
     54       optional ProcessMemoryCounters counters = 2;
     55     }
     56     repeated ProcessMetricsBreakdown breakdown = 11;
     57 
     58     // Reserved for internal use.
     59     extensions 12;
     60 
     61     // A single process might have started one or more times in the duration of
     62     // a trace. For each of these instances, measure the starting and ending
     63     // anon+swap memory values.
     64     repeated SpanGrowth anon_growth = 13;
     65   }
     66 
     67   message ProcessMemoryCounters {
     68     optional Counter anon_rss = 1;
     69     optional Counter file_rss = 2;
     70     optional Counter swap = 3;
     71     optional Counter anon_and_swap = 4;
     72   }
     73 
     74   message NamedCounter {
     75     optional string name = 1;
     76     optional Counter counter = 2;
     77   }
     78 
     79   message Counter {
     80     optional double min = 1;
     81     optional double max = 2;
     82     optional double avg = 3;
     83   }
     84 
     85   message SpanGrowth {
     86     // Initial value (at the beginning of the trace or process start)
     87     optional double start_val = 1;
     88 
     89     // End value (last sample for the pid).
     90     optional double end_val = 2;
     91 
     92     // Process duration (might or might not match the trace duration).
     93     optional int64 duration = 3;
     94 
     95     // (end_val - start_val) / start_val
     96     optional double growth = 4;
     97   }
     98 
     99   optional SystemMetrics system_metrics = 4;
    100 
    101   // Process-level metrics
    102   repeated ProcessMetrics process_metrics = 3;
    103 }
    104