mirror of https://github.com/rusefi/rusefi-1.git
docs & refactoring
This commit is contained in:
parent
1c86e4a2f9
commit
3821ef6702
|
@ -7,6 +7,9 @@ import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This command line utility is part of rusEfi unknown trigger discovery
|
||||||
|
* https://rusefi.com/wiki/index.php?title=Manual:Software:Trigger
|
||||||
|
*
|
||||||
* 2/15/2015
|
* 2/15/2015
|
||||||
*/
|
*/
|
||||||
public class AverageAnglesUtil {
|
public class AverageAnglesUtil {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.text.NumberFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class Histograms {
|
public final class Histograms {
|
||||||
private static final String SQL_STATEMENT = "SQL-statement";
|
private static final String MAGIC = "total";
|
||||||
public static final double H_ACCURACY = 0.05;
|
public static final double H_ACCURACY = 0.05;
|
||||||
public static final int BOUND_LENGTH = (int) (Math.log(Long.MAX_VALUE) / Math.log(1.0 + H_ACCURACY));
|
public static final int BOUND_LENGTH = (int) (Math.log(Long.MAX_VALUE) / Math.log(1.0 + H_ACCURACY));
|
||||||
|
|
||||||
|
@ -20,12 +20,7 @@ public final class Histograms {
|
||||||
|
|
||||||
private final HashMap<String, StatisticsGroup> total_stats = new HashMap<>();
|
private final HashMap<String, StatisticsGroup> total_stats = new HashMap<>();
|
||||||
private final long start_time = System.currentTimeMillis();
|
private final long start_time = System.currentTimeMillis();
|
||||||
public final ThreadLocal<LocalStats> local_stats = new ThreadLocal<LocalStats>() {
|
public final ThreadLocal<LocalStats> local_stats = ThreadLocal.withInitial(LocalStats::new);
|
||||||
@Override
|
|
||||||
protected LocalStats initialValue() {
|
|
||||||
return new LocalStats();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private final HashSet<LocalStats> all_local_stats = new HashSet<>();
|
private final HashSet<LocalStats> all_local_stats = new HashSet<>();
|
||||||
|
|
||||||
private long last_dump = System.currentTimeMillis();
|
private long last_dump = System.currentTimeMillis();
|
||||||
|
@ -247,7 +242,7 @@ public final class Histograms {
|
||||||
* Sorts specified statistics of specified statistics group for logging.
|
* Sorts specified statistics of specified statistics group for logging.
|
||||||
*/
|
*/
|
||||||
private static void sortStatistics(StatisticsGroup sg, Statistics[] sts) {
|
private static void sortStatistics(StatisticsGroup sg, Statistics[] sts) {
|
||||||
final boolean use_total = sg.type.startsWith(SQL_STATEMENT);
|
final boolean use_total = sg.type.startsWith(MAGIC);
|
||||||
Arrays.sort(sts, new Comparator<Statistics>() {
|
Arrays.sort(sts, new Comparator<Statistics>() {
|
||||||
public int compare(Statistics st1, Statistics st2) {
|
public int compare(Statistics st1, Statistics st2) {
|
||||||
if (use_total && st1.total_value != st2.total_value)
|
if (use_total && st1.total_value != st2.total_value)
|
||||||
|
@ -376,7 +371,7 @@ public final class Histograms {
|
||||||
Statistics[] sts = sg.data.values().toArray(new Statistics[sg.data.size()]);
|
Statistics[] sts = sg.data.values().toArray(new Statistics[sg.data.size()]);
|
||||||
sortStatistics(sg, sts);
|
sortStatistics(sg, sts);
|
||||||
for (Statistics st : sts) {
|
for (Statistics st : sts) {
|
||||||
appendStatistics(sb, st, new ArrayList<Long>());
|
appendStatistics(sb, st, new ArrayList<>());
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
public interface SensorConversion {
|
public interface SensorConversion {
|
||||||
SensorConversion C_TO_F = new SensorConversion() {
|
SensorConversion celsius_to_fahrenheit = celsius -> celsius * 9 / 5 + 32;
|
||||||
@Override
|
|
||||||
public double convertValue(double c) {
|
|
||||||
return c * 9 / 5 + 32;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
double convertValue(double value);
|
double convertValue(double value);
|
||||||
}
|
}
|
|
@ -5,6 +5,8 @@ import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* tuner studio project to C data structure converter command line utility
|
||||||
|
*
|
||||||
* 12/27/2014
|
* 12/27/2014
|
||||||
* Andrey Belomutskiy, (c) 2012-2016
|
* Andrey Belomutskiy, (c) 2012-2016
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -86,8 +86,8 @@ public class EngineState {
|
||||||
SensorStats.startDelta(Sensor.INJECTOR_1_DWELL, Sensor.INJECTOR_2_DWELL, Sensor.INJ_1_2_DELTA);
|
SensorStats.startDelta(Sensor.INJECTOR_1_DWELL, Sensor.INJECTOR_2_DWELL, Sensor.INJ_1_2_DELTA);
|
||||||
SensorStats.startDelta(Sensor.INJECTOR_3_DWELL, Sensor.INJECTOR_4_DWELL, Sensor.INJ_3_4_DELTA);
|
SensorStats.startDelta(Sensor.INJECTOR_3_DWELL, Sensor.INJECTOR_4_DWELL, Sensor.INJ_3_4_DELTA);
|
||||||
|
|
||||||
SensorStats.startConversion(Sensor.CLT, Sensor.CLT_F, SensorConversion.C_TO_F);
|
SensorStats.startConversion(Sensor.CLT, Sensor.CLT_F, SensorConversion.celsius_to_fahrenheit);
|
||||||
SensorStats.startConversion(Sensor.IAT, Sensor.IAT_F, SensorConversion.C_TO_F);
|
SensorStats.startConversion(Sensor.IAT, Sensor.IAT_F, SensorConversion.celsius_to_fahrenheit);
|
||||||
SensorStats.startConversion(Sensor.MAFR, Sensor.MAFR_CFM, new SensorConversion() {
|
SensorStats.startConversion(Sensor.MAFR, Sensor.MAFR_CFM, new SensorConversion() {
|
||||||
@Override
|
@Override
|
||||||
public double convertValue(double value) {
|
public double convertValue(double value) {
|
||||||
|
|
Loading…
Reference in New Issue