mirror of
https://github.com/zxing/zxing.git
synced 2024-11-09 20:44:03 -08:00
Calculated total time taken by the benchmark, and also reported it in the UI (in addition to logcat).
git-svn-id: https://zxing.googlecode.com/svn/trunk@966 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
96025842a1
commit
5edd5dab77
|
@ -68,7 +68,6 @@ public final class BenchmarkActivity extends Activity {
|
|||
handleBenchmarkDone(message);
|
||||
mBenchmarkThread = null;
|
||||
mRunBenchmarkButton.setEnabled(true);
|
||||
mTextView.setText(R.string.benchmark_help);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -76,17 +75,21 @@ public final class BenchmarkActivity extends Activity {
|
|||
}
|
||||
};
|
||||
|
||||
private static void handleBenchmarkDone(Message message) {
|
||||
private void handleBenchmarkDone(Message message) {
|
||||
List<BenchmarkItem> items = (List<BenchmarkItem>) message.obj;
|
||||
int count = 0;
|
||||
int time = 0;
|
||||
for (int x = 0; x < items.size(); x++) {
|
||||
BenchmarkItem item = items.get(x);
|
||||
if (item != null) {
|
||||
Log.v(TAG, item.toString());
|
||||
count++;
|
||||
time += item.getAverageTime();
|
||||
}
|
||||
}
|
||||
Log.v(TAG, "TOTAL: Decoded " + count + " images");
|
||||
String totals = "TOTAL: Decoded " + count + " images in " + time + " us";
|
||||
Log.v(TAG, totals);
|
||||
mTextView.setText(totals + "\n\n" + getString(R.string.benchmark_help));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public final class BenchmarkItem {
|
|||
*
|
||||
* @return The average decoding time in microseconds.
|
||||
*/
|
||||
private int getAverageTime() {
|
||||
public int getAverageTime() {
|
||||
int size = mTimes.length;
|
||||
int total = 0;
|
||||
int max = mTimes[0];
|
||||
|
|
Loading…
Reference in a new issue