从Android APP读取跟踪文件

时间:2015-02-26 05:50:34

标签: android trace systrace

我正在尝试从我的代码中读取/ sys / kernel / debug / tracing / trace文件的内容,但我无法这样做。我尝试使用安装 mount -o rw,remount -t debugfs nodev / sys / kernel / debug 并且还完成了chmod -R 777 / sys / kernel / debug

          File myFile = new File("/sys/kernel/debug/tracing/trace");
    FileInputStream fIn = null;
    try {
        fIn = new FileInputStream(myFile);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    BufferedReader myReader = new BufferedReader(
            new InputStreamReader(fIn));
    String aDataRow;
    try {
        while ((aDataRow = myReader.readLine()) != null) {
            // Toast.makeText(getBaseContext(), aDataRow, Toast.LENGTH_LONG).show();
            t.setText(aDataRow);
            break;
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

0 个答案:

没有答案