Ejemplo n.º 1
0
 public void setCSVOutput(Module br, String csv) {
   if (csv == null) return;
   String fn = br.getRelRawDir() + csv + ".csv";
   try {
     mCsvF = new FileOutputStream(br.getBaseDir() + fn);
     mCsvOut = new PrintStream(mCsvF);
     new Hint(this).add("A CSV format version is saved as: ").add(new Link(fn, fn));
   } catch (IOException e) {
     br.printErr(4, "Failed creating CSV file `" + fn + "': " + e);
     mCsvF = null;
     mCsvOut = null;
   }
 }
Ejemplo n.º 2
0
 @Override
 public void load(Module br) {
   Section section = br.findSection(Section.KERNEL_WAKELOCKS);
   if (section == null) {
     br.printErr(3, TAG + "Section not found: " + Section.KERNEL_WAKELOCKS + " (aborting plugin)");
     return;
   }
   String line = section.getLine(0);
   String columns[] = line.split("\t");
   boolean ok = true;
   if (columns.length < COLUMNS.length) {
     ok = false;
   }
   for (int i = 0; i < COLUMNS.length; i++) {
     if (!COLUMNS[i].equals(columns[i])) {
       ok = false;
     }
   }
   if (!ok) {
     br.printErr(
         3,
         TAG
             + "Data format changed in section "
             + Section.KERNEL_WAKELOCKS
             + " (aborting plugin)");
     return;
   }
   int cnt = section.getLineCount();
   for (int i = 1; i < cnt; i++) {
     line = section.getLine(i);
     columns = line.split("\t");
     if (columns.length < COLUMNS.length) {
       continue;
     }
     KernelWakelock lock = new KernelWakelock();
     lock.name = columns[0];
     if (lock.name.startsWith("\"") && lock.name.endsWith("\"")) {
       lock.name = lock.name.substring(1, lock.name.length() - 1);
     }
     lock.count = Long.parseLong(columns[1]);
     lock.expire_count = Long.parseLong(columns[2]);
     lock.wake_count = Long.parseLong(columns[3]);
     lock.active_since = Long.parseLong(columns[4]);
     lock.total_time = Long.parseLong(columns[5]);
     lock.sleep_time = Long.parseLong(columns[6]);
     lock.max_time = Long.parseLong(columns[7]);
     lock.last_change = Long.parseLong(columns[8]);
     mLocks.add(lock);
   }
   mLoaded = true;
 }
Ejemplo n.º 3
0
 public void setTableName(Module br, String name) {
   mConn = br.getSQLConnection();
   if (mConn != null) {
     mTable = name;
     new Hint(this).add("A table is created in the report database: " + mTable);
   }
 }