Home | History | Annotate | Download | only in stacks
      1 /*
      2  * Copyright (C) 2016 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 package com.android.bugreport.stacks;
     18 
     19 import com.android.bugreport.cpuinfo.CpuUsageSnapshot;
     20 import com.android.bugreport.stacks.ProcessSnapshot;
     21 import com.android.bugreport.stacks.ThreadSnapshot;
     22 
     23 import java.util.ArrayList;
     24 
     25 /**
     26  * Contains the information about any ANRs that happend in this bugreport.
     27  */
     28 public class VmTraces {
     29     public ArrayList<ProcessSnapshot> processes = new ArrayList<ProcessSnapshot>();
     30     public ArrayList<ProcessSnapshot> interestingProcesses = new ArrayList<ProcessSnapshot>();
     31     public ArrayList<ProcessSnapshot> deadlockedProcesses = new ArrayList<ProcessSnapshot>();
     32 
     33     public ProcessSnapshot getProcess(int pid) {
     34         for (ProcessSnapshot process: this.processes) {
     35             if (process.pid == pid) {
     36                 return process;
     37             }
     38         }
     39         return null;
     40     }
     41 
     42     public ThreadSnapshot getThread(int pid, String name) {
     43         final ProcessSnapshot process = getProcess(pid);
     44         if (process == null) {
     45             return null;
     46         }
     47         return process.getThread(name);
     48     }
     49 
     50 }
     51 
     52