Methods Summary |
---|
public void | btnRun(android.view.View v)
IPTestListJB.TestName t[] = IPTestListJB.TestName.values();
int count = 0;
for (int i = 0; i < t.length; i++) {
if (mTestListView.isItemChecked(i)) {
count++;
}
}
if (count == 0) {
return;
}
int testList[] = new int[count];
count = 0;
for (int i = 0; i < t.length; i++) {
if (mTestListView.isItemChecked(i)) {
testList[count++] = i;
}
}
Intent intent = makeBasicLaunchIntent();
intent.putExtra("tests", testList);
startActivityForResult(intent, 0);
|
public void | btnSelAll(android.view.View v)
IPTestListJB.TestName t[] = IPTestListJB.TestName.values();
for (int i=0; i < t.length; i++) {
mTestListView.setItemChecked(i, true);
}
|
public void | btnSelHp(android.view.View v)
checkGroup(0);
|
public void | btnSelIntrinsic(android.view.View v)
checkGroup(2);
|
public void | btnSelLp(android.view.View v)
checkGroup(1);
|
public void | btnSelNone(android.view.View v)
checkGroup(-1);
|
public void | btnSettings(android.view.View v)
IPSettings newFragment = new IPSettings(mSettings);
newFragment.show(getFragmentManager(), "settings");
|
private void | checkGroup(int group)
IPTestListJB.TestName t[] = IPTestListJB.TestName.values();
for (int i=0; i < t.length; i++) {
mTestListView.setItemChecked(i, group == t[i].group);
}
|
void | init()
for (int i=0; i < IPTestListJB.TestName.values().length; i++) {
mTestList.add(IPTestListJB.TestName.values()[i].toString());
}
mTestListView = (ListView) findViewById(R.id.test_list);
mTestListAdapter = new ArrayAdapter(this,
android.R.layout.simple_list_item_activated_1,
mTestList);
mTestListView.setAdapter(mTestListAdapter);
mTestListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mTestListAdapter.notifyDataSetChanged();
mResultView = (TextView) findViewById(R.id.results);
mTestListView.setOnItemLongClickListener(new ListView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int pos, long id) {
launchDemo(pos);
return true;
}
});
|
void | launchDemo(int id)
IPTestListJB.TestName t[] = IPTestListJB.TestName.values();
int testList[] = new int[1];
testList[0] = id;
Intent intent = makeBasicLaunchIntent();
intent.putExtra("tests", testList);
intent.putExtra("demo", true);
startActivityForResult(intent, 0);
|
android.content.Intent | makeBasicLaunchIntent()
Intent intent = new Intent(this, ImageProcessingActivityJB.class);
intent.putExtra("enable io", mSettings[SETTING_USE_IO]);
intent.putExtra("enable dvfs", mSettings[SETTING_USE_DVFS]);
intent.putExtra("enable long", mSettings[SETTING_LONG_RUN]);
intent.putExtra("enable pause", mSettings[SETTING_PAUSE]);
intent.putExtra("enable animate", mSettings[SETTING_ANIMATE]);
intent.putExtra("enable display", mSettings[SETTING_DISPLAY]);
intent.putExtra("resolution X", mRes.width);
intent.putExtra("resolution Y", mRes.height);
return intent;
|
protected void | onActivityResult(int requestCode, int resultCode, android.content.Intent data)
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
java.text.DecimalFormat df = new java.text.DecimalFormat("######.#");
mResults = new float[IPTestListJB.TestName.values().length];
float r[] = data.getFloatArrayExtra("results");
int id[] = data.getIntArrayExtra("tests");
for (int ct=0; ct < id.length; ct++) {
IPTestListJB.TestName t = IPTestListJB.TestName.values()[id[ct]];
String s = t.toString() + " " + df.format(rebase(r[ct], t)) +
"X, " + df.format(r[ct]) + "ms";
mTestList.set(id[ct], s);
mTestListAdapter.notifyDataSetChanged();
mResults[id[ct]] = r[ct];
}
double gm[] = {1.0, 1.0, 1.0};
double count[] = {0, 0, 0};
for (int ct=0; ct < IPTestListJB.TestName.values().length; ct++) {
IPTestListJB.TestName t = IPTestListJB.TestName.values()[ct];
gm[t.group] *= rebase(mResults[ct], t);
count[t.group] += 1.0;
}
gm[0] = java.lang.Math.pow(gm[0], 1.0 / count[0]);
gm[1] = java.lang.Math.pow(gm[1], 1.0 / count[1]);
gm[2] = java.lang.Math.pow(gm[2], 1.0 / count[2]);
String s = "Results: fp full=" + df.format(gm[0]) +
", fp relaxed=" +df.format(gm[1]) +
", intrinsics=" + df.format(gm[2]);
mResultView.setText(s);
writeResults();
}
}
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.controls);
init();
|
public boolean | onCreateOptionsMenu(android.view.Menu menu)
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_activity_actions, menu);
MenuItem searchItem = menu.findItem(R.id.action_res);
mResSpinner = (Spinner) searchItem.getActionView();
mResSpinner.setOnItemSelectedListener(mResSpinnerListener);
mResSpinner.setAdapter(new ArrayAdapter<Resolutions>(
this, R.layout.spinner_layout, Resolutions.values()));
// Choose one of the image sizes that close to the resolution
// of the screen.
Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
int md = (size.x > size.y) ? size.x : size.y;
for (int ct=0; ct < Resolutions.values().length; ct++) {
if (Resolutions.values()[ct].width <= (int)(md * 1.2)) {
mResSpinner.setSelection(ct);
break;
}
}
return super.onCreateOptionsMenu(menu);
|
public boolean | onOptionsItemSelected(android.view.MenuItem item)
// Handle presses on the action bar items
switch(item.getItemId()) {
case R.id.action_settings:
IPSettings newFragment = new IPSettings(mSettings);
newFragment.show(getFragmentManager(), "settings");
return true;
default:
return super.onOptionsItemSelected(item);
}
|
protected void | onPause()
super.onPause();
//cleanup();
|
protected void | onResume()
super.onResume();
// init();
|
float | rebase(float v, IPTestListJB.TestName t)
if (v > 0.001) {
v = t.baseline / v;
}
float pr = (1920.f / mRes.width) * (1080.f / mRes.height);
return v / pr;
|
private void | writeResults()
// write result into a file
File externalStorage = Environment.getExternalStorageDirectory();
if (!externalStorage.canWrite()) {
Log.v(TAG, "sdcard is not writable");
return;
}
File resultFile = new File(externalStorage, RESULT_FILE);
resultFile.setWritable(true, false);
try {
BufferedWriter rsWriter = new BufferedWriter(new FileWriter(resultFile));
Log.v(TAG, "Saved results in: " + resultFile.getAbsolutePath());
java.text.DecimalFormat df = new java.text.DecimalFormat("######.##");
for (int ct=0; ct < IPTestListJB.TestName.values().length; ct++) {
IPTestListJB.TestName t = IPTestListJB.TestName.values()[ct];
final float r = mResults[ct];
float r2 = rebase(r, t);
String s = new String("" + t.toString() + ", " + df.format(r) + ", " + df.format(r2));
rsWriter.write(s + "\n");
}
rsWriter.close();
} catch (IOException e) {
Log.v(TAG, "Unable to write result file " + e.getMessage());
}
|