auto-sync

This commit is contained in:
rusEfi 2014-09-11 23:04:33 -05:00
parent cf4c4019c2
commit 70e5f4f91d
3 changed files with 65 additions and 38 deletions

View File

@ -303,10 +303,10 @@ void updateDevConsoleState(void) {
* that would be 'show fuel for rpm 3500 maf 4.0' * that would be 'show fuel for rpm 3500 maf 4.0'
*/ */
static void showFuelMap2(float rpm, float engineLoad) { static void showFuelInfo2(float rpm, float engineLoad) {
float baseFuel = getBaseTableFuel((int) rpm, engineLoad); float baseFuel = getBaseTableFuel((int) rpm, engineLoad);
scheduleMsg(&logger2, "algo=%s", algorithmToString(engineConfiguration->algorithm)); scheduleMsg(&logger2, "algo=%s/pump=%s", algorithmToString(engineConfiguration->algorithm), boolToString(getOutputPinValue(FUEL_PUMP_RELAY)));
scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel()); scheduleMsg(&logger2, "cranking fuel: %f", getCrankingFuel());
@ -325,8 +325,8 @@ static void showFuelMap2(float rpm, float engineLoad) {
} }
} }
static void showFuelMap(void) { static void showFuelInfo(void) {
showFuelMap2((float) getRpm(), getEngineLoad()); showFuelInfo2((float) getRpm(), getEngineLoad());
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -419,8 +419,8 @@ void initStatusLoop(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
initLogging(&logger2, "main event handler"); initLogging(&logger2, "main event handler");
addConsoleActionFF("fuelinfo2", showFuelMap2); addConsoleActionFF("fuelinfo2", showFuelInfo2);
addConsoleAction("fuelinfo", showFuelMap); addConsoleAction("fuelinfo", showFuelInfo);
addConsoleAction("status", printStatus); addConsoleAction("status", printStatus);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */

View File

@ -69,6 +69,7 @@ board_configuration_s *boardConfiguration = &persistentState.persistentConfigura
/** /**
* CH_FREQUENCY is the number of system ticks in a second * CH_FREQUENCY is the number of system ticks in a second
*/ */
// todo: this should probably be configurable?
#define FUEL_PUMP_DELAY (4 * CH_FREQUENCY) #define FUEL_PUMP_DELAY (4 * CH_FREQUENCY)
static VirtualTimer everyMsTimer; static VirtualTimer everyMsTimer;

View File

@ -103,20 +103,23 @@ static void testMath(const int count) {
int64_t temp64 = 0; int64_t temp64 = 0;
start = currentTimeMillis(); start = currentTimeMillis();
for (int64_t i = 0; i < count; i++) for (int64_t i = 0; i < count; i++) {
temp64 += i; temp64 += i;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (temp64 != 0) if (temp64 != 0) {
scheduleMsg(&logger, "Finished %d iterations of int64_t summation in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of int64_t summation in %dms", count, time);
}
temp64 = 1; temp64 = 1;
start = currentTimeMillis(); start = currentTimeMillis();
for (int64_t i = 0; i < count; i++) for (int64_t i = 0; i < count; i++) {
temp64 *= i; temp64 *= i;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (temp64 == 0) if (temp64 == 0) {
scheduleMsg(&logger, "Finished %d iterations of int64_t multiplication in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of int64_t multiplication in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
@ -124,52 +127,65 @@ static void testMath(const int count) {
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
scheduleMsg(&logger, "Finished %d iterations of empty loop in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of empty loop in %dms", count, time);
int tempi = 1; uint32_t tempi = 1;
start = currentTimeMillis(); start = currentTimeMillis();
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempi += tempi; tempi += tempi;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempi == 0) if (tempi == 0) {
scheduleMsg(&logger, "Finished %d iterations of int summation in %dms", count, time); // Finished 100000 iterations of uint32_t summation in 11ms
scheduleMsg(&logger, "Finished %d iterations of uint32_t summation in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
tempi = 1; tempi = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempi += (tempi + 100) / 130; tempi += (tempi + 100) / 130;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempi != 0) if (tempi != 0) {
scheduleMsg(&logger, "Finished %d iterations of int division in %dms", count, time); // Finished 100000 iterations of uint32_t division in 16ms
scheduleMsg(&logger, "Finished %d iterations of uint32_t division in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
long templ = 1; temp64 = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
templ += templ; temp64 += temp64;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (templ == 0) if (temp64 == 0) {
scheduleMsg(&logger, "Finished %d iterations of long summation in %dms", count, time); // Finished 100000 iterations of int64_t summation in 21ms
scheduleMsg(&logger, "Finished %d iterations of int64_t summation in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
templ = 1; temp64 = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
templ += (templ + 100) / 130; temp64 += (temp64 + 100) / 130;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (templ != 0) { if (temp64 != 0) {
// Finished 100000 iterations of long division in 45ms // Finished 100000 iterations of int64_t division in 181ms
scheduleMsg(&logger, "Finished %d iterations of long division in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of int64_t division in %dms", count, time);
} }
start = currentTimeMillis(); start = currentTimeMillis();
float tempf = 1; float tempf = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempf += tempf; tempf += tempf;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempf != 0) if (tempf != 0) {
scheduleMsg(&logger, "Finished %d iterations of float summation in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of float summation in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
tempf = 1; tempf = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempf += (tempf + 100) / 130.0; tempf += (tempf + 100) / 130.0;
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempf != 0) { if (tempf != 0) {
// Finished 100000 iterations of float division in 65ms // Finished 100000 iterations of float division in 65ms
@ -178,35 +194,45 @@ static void testMath(const int count) {
start = currentTimeMillis(); start = currentTimeMillis();
tempf = 1; tempf = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempf += logf(tempf); tempf += logf(tempf);
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempf != 0) if (tempf != 0) {
// Finished 100000 iterations of float log in 191ms
scheduleMsg(&logger, "Finished %d iterations of float log in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of float log in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
double tempd = 1; double tempd = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
tempd += tempd / 2; tempd += tempd / 2;
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempd != 0) if (tempd != 0) {
// Finished 100000 iterations of double summation in 80ms
scheduleMsg(&logger, "Finished %d iterations of double summation in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of double summation in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
tempd = 1; tempd = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
tempd += (tempd + 100) / 130.0; tempd += (tempd + 100) / 130.0;
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempd != 0) if (tempd != 0) {
// Finished 100000 iterations of double division in 497ms
scheduleMsg(&logger, "Finished %d iterations of double division in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of double division in %dms", count, time);
}
start = currentTimeMillis(); start = currentTimeMillis();
tempd = 1; tempd = 1;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++) {
tempd += log(tempd); tempd += log(tempd);
}
time = currentTimeMillis() - start; time = currentTimeMillis() - start;
if (tempd != 0) if (tempd != 0) {
// Finished 100000 iterations of double log in 242ms
scheduleMsg(&logger, "Finished %d iterations of double log in %dms", count, time); scheduleMsg(&logger, "Finished %d iterations of double log in %dms", count, time);
}
} }
static void runTests(const int count) { static void runTests(const int count) {