performance

This commit is contained in:
Arndt Brenschede 2016-09-09 19:42:00 +02:00
parent 62d089ebb5
commit 9d00b0181e
14 changed files with 194 additions and 105 deletions

View file

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Set;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
@ -57,8 +58,11 @@ public class BRouterActivity extends Activity implements OnInitListener
// Create a bright wake lock
mWakeLock = mPowerManager.newWakeLock( PowerManager.SCREEN_BRIGHT_WAKE_LOCK, getClass().getName() );
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int memoryClass = am.getMemoryClass();
// instantiate our simulation view and set it as the activity's content
mBRouterView = new BRouterView( this );
mBRouterView = new BRouterView( this, memoryClass );
mBRouterView.init();
setContentView( mBRouterView );
}

View file

@ -75,14 +75,17 @@ public class BRouterView extends View
private int[] imgPixels;
private int memoryClass;
public void stopRouting()
{
if ( cr != null ) cr.terminate();
}
public BRouterView( Context context )
public BRouterView( Context context, int memoryClass )
{
super( context );
this.memoryClass = memoryClass;
}
public void init()
@ -221,10 +224,14 @@ public class BRouterView extends View
}
catch( Exception e )
{
tracksDir = basedir + "/brouter";
tracksDir = null;
}
}
}
if ( tracksDir == null )
{
tracksDir = basedir + "/brouter"; // fallback
}
String[] fileNames = new File( profileDir ).list();
ArrayList<String> profiles = new ArrayList<String>();
@ -514,6 +521,17 @@ public class BRouterView extends View
startTime = System.currentTimeMillis();
rc.prepareNogoPoints( nogoList );
rc.nogopoints = nogoList;
rc.memoryclass = memoryClass;
if ( memoryClass < 16 )
{
rc.memoryclass = 16;
}
else if ( memoryClass > 256 )
{
rc.memoryclass = 256;
}
// for profile remote, use ref-track logic same as service interface
rc.rawTrackPath = rawTrackPath;
@ -748,7 +766,7 @@ public class BRouterView extends View
}
else
{
String result = "version = BRouter-1.4.4\n" + "distance = " + cr.getDistance() / 1000. + " km\n" + "filtered ascend = " + cr.getAscend()
String result = "version = BRouter-1.4.4\n" + "memory-class = " + memoryClass + "\ndistance = " + cr.getDistance() / 1000. + " km\n" + "filtered ascend = " + cr.getAscend()
+ " m\n" + "plain ascend = " + cr.getPlainAscend();
rawTrack = cr.getFoundRawTrack();