Home | History | Annotate | Download | only in moarram
      1 package com.android.benchmark.moarram;
      2 
      3 import android.os.Bundle;
      4 import android.app.Activity;
      5 import android.view.Menu;
      6 import android.view.View;
      7 import android.widget.RadioGroup;
      8 
      9 public class MainActivity extends Activity {
     10 
     11     @Override
     12     protected void onCreate(Bundle savedInstanceState) {
     13         super.onCreate(savedInstanceState);
     14         System.loadLibrary("moarram-32");
     15         System.loadLibrary("moarram-2M");
     16         System.loadLibrary("moarram-17_71");
     17         setContentView(R.layout.activity_main);
     18     }
     19 
     20     @Override
     21     public boolean onCreateOptionsMenu(Menu menu) {
     22         getMenuInflater().inflate(R.menu.main, menu);
     23         return true;
     24     }
     25 
     26     public void add32ByteBlocks(View view) {
     27         add32ByteBlocksNative();
     28     }
     29 
     30     public void free32ByteBlocks(View view) {
     31         free32ByteBlocksNative();
     32     }
     33 
     34     public void add2MByteBlocks(View view) {
     35         add2MByteBlocksNative();
     36     }
     37 
     38     public void free2MByteBlocks(View view) {
     39         free2MByteBlocksNative();
     40     }
     41 
     42     public void addVariableSizedBlocks(View view) {
     43 
     44         RadioGroup sizeGroup = (RadioGroup) findViewById(R.id.blockSize);
     45 
     46         int sizeId = sizeGroup.getCheckedRadioButtonId();
     47         addVariableSizedBlocksNative(sizeId == R.id.radio17 ? 0 : 1);
     48     }
     49 
     50     public void freeVariableSizedBlocks(View view) {
     51 
     52         RadioGroup sizeGroup = (RadioGroup) findViewById(R.id.blockSize);
     53 
     54         int sizeId = sizeGroup.getCheckedRadioButtonId();
     55         freeVariableSizedBlocksNative(sizeId == R.id.radio17 ? 0 : 1);
     56     }
     57 
     58     public native void add32ByteBlocksNative();
     59     public native void free32ByteBlocksNative();
     60     public native void add2MByteBlocksNative();
     61     public native void free2MByteBlocksNative();
     62     public native void addVariableSizedBlocksNative(int sizeId);
     63     public native void freeVariableSizedBlocksNative(int sizeId);
     64 }
     65