2 * Copyright (C) 2008 Google Inc.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.google.zxing.client.androidtest;
19 import com.google.zxing.BarcodeFormat;
21 public class BenchmarkItem {
25 private int mPosition;
26 private boolean mDecoded;
27 private BarcodeFormat mFormat;
29 public BenchmarkItem(String path, int runs) {
31 mTimes = new int[runs];
37 // I'm storing these separately instead of as a running total so I can add features like
38 // calculating the min and max later, or ignoring outliers.
39 public void addResult(int milliseconds) {
40 mTimes[mPosition] = milliseconds;
44 public void setDecoded(boolean decoded) {
48 public void setFormat(BarcodeFormat format) {
52 public String getPath() {
56 public int getAverageMilliseconds() {
57 int size = mTimes.length;
59 for (int x = 0; x < size; x++) {
69 public int getCount() {
73 public boolean getDecoded() {
77 public BarcodeFormat getFormat() {