@Override public void generate(Module rep) { if (!mLoaded) return; BugReportModule br = (BugReportModule) rep; Chapter ch = br.findOrCreateChapter("Battery info/Kernel wakelocks"); addHelp(ch); long uptime = br.getUptime(); Table tg = new Table(Table.FLAG_SORT, ch); tg.setCSVOutput(rep, "kernel_wakelocks"); tg.setTableName(rep, "kernel_wakelocks"); tg.addColumn("Name", "The name of the wakelock as provided by the driver", 0, "name varchar"); tg.addColumn( "Count", "The number of times that the wakelock has been acquired.", Table.FLAG_ALIGN_RIGHT, "count int"); tg.addColumn( "Expire count", "The number of times that the wakelock has timed out. This indicates that some application has an input device open, but is not reading from it, which is a bug.", Table.FLAG_ALIGN_RIGHT, "expire_count int"); tg.addColumn( "Wake count", "The number of times that the wakelock was the first to be acquired in the resume path.", Table.FLAG_ALIGN_RIGHT, "wake_count int"); tg.addColumn( "Active since (ms)", "Tracks how long a wakelock has been held since it was last acquired, or zero if it is not currently held.", Table.FLAG_ALIGN_RIGHT, "active_since_ms int"); tg.addColumn( "Total time (ms)", "Accumulates the total amount of time that the corresponding wakelock has been held.", Table.FLAG_ALIGN_RIGHT, "total_time_ms int"); if (uptime > 0) { tg.addColumn( "Total time (%)", "Total time as percentage of uptime", Table.FLAG_ALIGN_RIGHT, "total_time_p int"); } tg.addColumn( "Average time (ms)", "Total time divided by Count.", Table.FLAG_ALIGN_RIGHT, "average_time_ms int"); tg.addColumn( "Sleep time (ms)", "The total time that the wakelock was held while the display was powered off.", Table.FLAG_ALIGN_RIGHT, "sleep_time_ms int"); tg.addColumn( "Max time (ms)", "The longest hold time for the wakelock. This allows finding cases where wakelocks are held for too long, but are eventually released. (In contrast, active_since is more useful in the held-forever case.)", Table.FLAG_ALIGN_RIGHT, "max_time_ms int"); tg.addColumn("Last change", "?", Table.FLAG_ALIGN_RIGHT, "last_change int"); tg.begin(); for (KernelWakelock lock : mLocks) { tg.addData(lock.name); tg.addData(lock.count); tg.addData(lock.expire_count); tg.addData(lock.wake_count); long activeSinceMs = lock.active_since / 1000000L; tg.addData(Util.formatTS(activeSinceMs), new ShadedValue(activeSinceMs)); long totalMs = lock.total_time / 1000000L; tg.addData(Util.formatTS(totalMs), new ShadedValue(totalMs)); if (uptime > 0) { tg.addData(lock.total_time / 10000000L / uptime); } long avgMs = (lock.count == 0) ? 0 : (lock.total_time / lock.count / 1000000L); tg.addData(Util.formatTS(avgMs), new ShadedValue(avgMs)); long sleepMs = lock.sleep_time / 1000000L; tg.addData(Util.formatTS(sleepMs), new ShadedValue(sleepMs)); long maxMs = lock.max_time / 1000000L; tg.addData(Util.formatTS(maxMs), new ShadedValue(maxMs)); tg.addData(lock.last_change); } tg.end(); }
public void addColumn(String title, int flag, String dbSpec) { addColumn(title, null, flag, dbSpec); }
public void addColumn(String title, String hint, int flag) { addColumn(title, hint, flag, null); }
public void addColumn(String title, int flag) { addColumn(title, null, flag); }