Merge branch 'dev' into omnipod_eros_dev_dagger
This commit is contained in:
commit
a805f5b827
|
@ -20,7 +20,6 @@ import androidx.test.rule.GrantPermissionRule
|
|||
import info.nightscout.androidaps.interfaces.PluginType
|
||||
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.OpenAPSSMBPlugin
|
||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
|
||||
import info.nightscout.androidaps.plugins.constraints.objectives.ObjectivesPlugin
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||
import info.nightscout.androidaps.plugins.pump.virtual.VirtualPumpPlugin
|
||||
|
@ -28,7 +27,6 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin
|
|||
import info.nightscout.androidaps.plugins.source.RandomBgPlugin
|
||||
import info.nightscout.androidaps.setupwizard.SetupWizardActivity
|
||||
import info.nightscout.androidaps.utils.HardLimits
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import info.nightscout.androidaps.utils.extensions.isRunningTest
|
||||
import org.hamcrest.CoreMatchers.allOf
|
||||
import org.hamcrest.Description
|
||||
|
@ -60,7 +58,7 @@ class SetupWizardActivityTest {
|
|||
|
||||
@Before
|
||||
fun clear() {
|
||||
SP.clear()
|
||||
sp.clear()
|
||||
}
|
||||
/*
|
||||
|
||||
|
@ -77,7 +75,7 @@ adb shell settings put global animator_duration_scale 0 &
|
|||
|
||||
@Test
|
||||
fun setupWizardActivityTest() {
|
||||
SP.clear()
|
||||
sp.clear()
|
||||
Assert.assertTrue(isRunningTest())
|
||||
// Welcome page
|
||||
onView(withId(R.id.next_button)).perform(click())
|
||||
|
|
|
@ -52,6 +52,8 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
private final TreatmentsPlugin treatmentsPlugin;
|
||||
private final IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||
private final HardLimits hardLimits;
|
||||
private final Profiler profiler;
|
||||
private final FabricPrivacy fabricPrivacy;
|
||||
|
||||
// last values
|
||||
DetermineBasalAdapterAMAJS lastDetermineBasalAdapterAMAJS = null;
|
||||
|
@ -71,7 +73,9 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
ActivePluginProvider activePlugin,
|
||||
TreatmentsPlugin treatmentsPlugin,
|
||||
IobCobCalculatorPlugin iobCobCalculatorPlugin,
|
||||
HardLimits hardLimits
|
||||
HardLimits hardLimits,
|
||||
Profiler profiler,
|
||||
FabricPrivacy fabricPrivacy
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.APS)
|
||||
|
@ -92,6 +96,8 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
this.treatmentsPlugin = treatmentsPlugin;
|
||||
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
|
||||
this.hardLimits = hardLimits;
|
||||
this.profiler = profiler;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,11 +167,11 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
long start = System.currentTimeMillis();
|
||||
long startPart = System.currentTimeMillis();
|
||||
IobTotal[] iobArray = iobCobCalculatorPlugin.calculateIobArrayInDia(profile);
|
||||
Profiler.log(aapsLogger, LTag.APS, "calculateIobArrayInDia()", startPart);
|
||||
profiler.log(LTag.APS, "calculateIobArrayInDia()", startPart);
|
||||
|
||||
startPart = System.currentTimeMillis();
|
||||
MealData mealData = iobCobCalculatorPlugin.getMealData();
|
||||
Profiler.log(aapsLogger, LTag.APS, "getMealData()", startPart);
|
||||
profiler.log(LTag.APS, "getMealData()", startPart);
|
||||
|
||||
double maxIob = constraintChecker.getMaxIOBAllowed().value();
|
||||
|
||||
|
@ -206,8 +212,8 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
lastAutosensResult = new AutosensResult();
|
||||
lastAutosensResult.sensResult = "autosens disabled";
|
||||
}
|
||||
Profiler.log(aapsLogger, LTag.APS, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
Profiler.log(aapsLogger, LTag.APS, "AMA data gathering", start);
|
||||
profiler.log(LTag.APS, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
profiler.log(LTag.APS, "AMA data gathering", start);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
|
||||
|
@ -217,13 +223,13 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
|
|||
isTempTarget
|
||||
);
|
||||
} catch (JSONException e) {
|
||||
FabricPrivacy.getInstance().logException(e);
|
||||
fabricPrivacy.logException(e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DetermineBasalResultAMA determineBasalResultAMA = determineBasalAdapterAMAJS.invoke();
|
||||
Profiler.log(aapsLogger, LTag.APS, "AMA calculation", start);
|
||||
profiler.log(LTag.APS, "AMA calculation", start);
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResultAMA == null) {
|
||||
aapsLogger.error(LTag.APS, "SMB calculation returned null");
|
||||
|
|
|
@ -54,6 +54,8 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
private final TreatmentsPlugin treatmentsPlugin;
|
||||
private final IobCobCalculatorPlugin iobCobCalculatorPlugin;
|
||||
private final HardLimits hardLimits;
|
||||
private final Profiler profiler;
|
||||
private final FabricPrivacy fabricPrivacy;
|
||||
|
||||
// last values
|
||||
DetermineBasalAdapterSMBJS lastDetermineBasalAdapterSMBJS = null;
|
||||
|
@ -73,7 +75,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
ActivePluginProvider activePlugin,
|
||||
TreatmentsPlugin treatmentsPlugin,
|
||||
IobCobCalculatorPlugin iobCobCalculatorPlugin,
|
||||
HardLimits hardLimits
|
||||
HardLimits hardLimits,
|
||||
Profiler profiler,
|
||||
FabricPrivacy fabricPrivacy
|
||||
) {
|
||||
super(new PluginDescription()
|
||||
.mainType(PluginType.APS)
|
||||
|
@ -94,6 +98,8 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
this.treatmentsPlugin = treatmentsPlugin;
|
||||
this.iobCobCalculatorPlugin = iobCobCalculatorPlugin;
|
||||
this.hardLimits = hardLimits;
|
||||
this.profiler = profiler;
|
||||
this.fabricPrivacy = fabricPrivacy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -168,7 +174,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
long startPart = System.currentTimeMillis();
|
||||
|
||||
MealData mealData = iobCobCalculatorPlugin.getMealData();
|
||||
Profiler.log(getAapsLogger(), LTag.APS, "getMealData()", startPart);
|
||||
profiler.log(LTag.APS, "getMealData()", startPart);
|
||||
|
||||
Constraint<Double> maxIOBAllowedConstraint = constraintChecker.getMaxIOBAllowed();
|
||||
inputConstraints.copyReasons(maxIOBAllowedConstraint);
|
||||
|
@ -213,7 +219,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
}
|
||||
|
||||
IobTotal[] iobArray = iobCobCalculatorPlugin.calculateIobArrayForSMB(lastAutosensResult, SMBDefaults.exercise_mode, SMBDefaults.half_basal_exercise_target, isTempTarget);
|
||||
Profiler.log(getAapsLogger(), LTag.APS, "calculateIobArrayInDia()", startPart);
|
||||
profiler.log(LTag.APS, "calculateIobArrayInDia()", startPart);
|
||||
|
||||
startPart = System.currentTimeMillis();
|
||||
Constraint<Boolean> smbAllowed = new Constraint<>(!tempBasalFallback);
|
||||
|
@ -228,8 +234,8 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
constraintChecker.isUAMEnabled(uam);
|
||||
inputConstraints.copyReasons(uam);
|
||||
|
||||
Profiler.log(getAapsLogger(), LTag.APS, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
Profiler.log(getAapsLogger(), LTag.APS, "SMB data gathering", start);
|
||||
profiler.log(LTag.APS, "detectSensitivityandCarbAbsorption()", startPart);
|
||||
profiler.log(LTag.APS, "SMB data gathering", start);
|
||||
|
||||
start = System.currentTimeMillis();
|
||||
try {
|
||||
|
@ -241,14 +247,14 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
|||
advancedFiltering.value()
|
||||
);
|
||||
} catch (JSONException e) {
|
||||
FabricPrivacy.getInstance().logException(e);
|
||||
fabricPrivacy.logException(e);
|
||||
return;
|
||||
}
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
DetermineBasalResultSMB determineBasalResultSMB = determineBasalAdapterSMBJS.invoke();
|
||||
Profiler.log(getAapsLogger(), LTag.APS, "SMB calculation", start);
|
||||
profiler.log(LTag.APS, "SMB calculation", start);
|
||||
if (determineBasalResultSMB == null) {
|
||||
getAapsLogger().error(LTag.APS, "SMB calculation returned null");
|
||||
lastDetermineBasalAdapterSMBJS = null;
|
||||
|
|
|
@ -23,7 +23,6 @@ import info.nightscout.androidaps.db.TempTarget;
|
|||
import info.nightscout.androidaps.events.Event;
|
||||
import info.nightscout.androidaps.interfaces.ActivePluginProvider;
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.L;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
import info.nightscout.androidaps.plugins.aps.openAPSSMB.SMBDefaults;
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper;
|
||||
|
@ -66,6 +65,8 @@ public class IobCobOref1Thread extends Thread {
|
|||
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
@Inject BuildHelper buildHelper;
|
||||
@Inject Profiler profiler;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
|
||||
private final HasAndroidInjector injector;
|
||||
private boolean bgDataReload;
|
||||
|
@ -222,7 +223,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
FabricPrivacy.getInstance().logException(e);
|
||||
fabricPrivacy.logException(e);
|
||||
aapsLogger.debug(autosensDataTable.toString());
|
||||
aapsLogger.debug(bucketed_data.toString());
|
||||
aapsLogger.debug(iobCobCalculatorPlugin.getBgReadings().toString());
|
||||
|
@ -391,7 +392,7 @@ public class IobCobOref1Thread extends Thread {
|
|||
rxBus.send(new EventIobCalculationProgress(""));
|
||||
aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: " + from);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Midnights: " + MidnightTime.log());
|
||||
Profiler.log(aapsLogger, LTag.AUTOSENS, "IobCobOref1Thread", start);
|
||||
profiler.log(LTag.AUTOSENS, "IobCobOref1Thread", start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ public class IobCobThread extends Thread {
|
|||
@Inject SensitivityAAPSPlugin sensitivityAAPSPlugin;
|
||||
@Inject SensitivityWeightedAveragePlugin sensitivityWeightedAveragePlugin;
|
||||
@Inject BuildHelper buildHelper;
|
||||
@Inject Profiler profiler;
|
||||
@Inject FabricPrivacy fabricPrivacy;
|
||||
|
||||
private final HasAndroidInjector injector;
|
||||
private boolean bgDataReload;
|
||||
|
@ -218,7 +220,7 @@ public class IobCobThread extends Thread {
|
|||
}
|
||||
} catch (Exception e) {
|
||||
aapsLogger.error("Unhandled exception", e);
|
||||
FabricPrivacy.getInstance().logException(e);
|
||||
fabricPrivacy.logException(e);
|
||||
aapsLogger.debug(autosensDataTable.toString());
|
||||
aapsLogger.debug(bucketed_data.toString());
|
||||
aapsLogger.debug(iobCobCalculatorPlugin.getBgReadings().toString());
|
||||
|
@ -314,7 +316,7 @@ public class IobCobThread extends Thread {
|
|||
rxBus.send(new EventIobCalculationProgress(""));
|
||||
aapsLogger.debug(LTag.AUTOSENS, "AUTOSENSDATA thread ended: " + from);
|
||||
aapsLogger.debug(LTag.AUTOSENS, "Midnights: " + MidnightTime.log());
|
||||
Profiler.log(aapsLogger, LTag.AUTOSENS, "IobCobThread", start);
|
||||
profiler.log(LTag.AUTOSENS, "IobCobThread", start);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package info.nightscout.androidaps.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger;
|
||||
import info.nightscout.androidaps.logging.LTag;
|
||||
|
||||
/**
|
||||
* Created by mike on 29.01.2017.
|
||||
*/
|
||||
|
||||
public class Profiler {
|
||||
public Profiler() {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
static public void log(Logger log, String function, long start) {
|
||||
long msec = System.currentTimeMillis() - start;
|
||||
log.debug(">>> " + function + " <<< executed in " + msec + " miliseconds");
|
||||
}
|
||||
|
||||
static public void log(AAPSLogger log, LTag lTag, String function, long start) {
|
||||
long msec = System.currentTimeMillis() - start;
|
||||
log.debug(lTag, ">>> " + function + " <<< executed in " + msec + " miliseconds");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package info.nightscout.androidaps.utils
|
||||
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
@Singleton
|
||||
class Profiler @Inject constructor(val aapsLogger: AAPSLogger) {
|
||||
|
||||
fun log(lTag: LTag, function: String, start: Long) {
|
||||
val msec = System.currentTimeMillis() - start
|
||||
aapsLogger.debug(lTag, ">>> $function <<< executed in $msec miliseconds")
|
||||
}
|
||||
}
|
|
@ -10,7 +10,6 @@ import info.nightscout.androidaps.logging.L
|
|||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction
|
||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus
|
||||
import info.nightscout.androidaps.utils.DefaultValueHelper
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
import org.junit.Assert
|
||||
import org.junit.Before
|
||||
|
@ -27,7 +26,7 @@ import java.util.*
|
|||
import java.util.logging.Logger
|
||||
|
||||
@RunWith(PowerMockRunner::class)
|
||||
@PrepareForTest(MainApp::class, Logger::class, L::class, SP::class, GlucoseStatus::class)
|
||||
@PrepareForTest(MainApp::class, Logger::class, L::class, GlucoseStatus::class)
|
||||
class BgReadingTest : TestBase() {
|
||||
|
||||
@Mock lateinit var defaultValueHelper: DefaultValueHelper
|
||||
|
|
Loading…
Reference in a new issue