Lua refresh rate transparency/logic etc #5939

surprise: more tools!
This commit is contained in:
Andrey 2024-02-15 09:29:39 -05:00
parent 5f364768ea
commit 68b888f30a
6 changed files with 35 additions and 26 deletions

View File

@ -0,0 +1,8 @@
#!/bin/bash
cd ../java_tools
./gradlew :models:shadowJar
cd ../firmware
java -cp ../java_console/models/build/libs/models-all.jar com.rusefi.PerfTraceEnumGenerator development/perf_trace.h ../java_console/models/src/main/java/com/rusefi/tracing/EnumNames.java

View File

@ -1,5 +1,6 @@
plugins {
id 'java-library'
id 'java-library'
id 'com.github.johnrengelman.shadow' version "${shadowVersion}"
}
apply from: '../../java_tools/dependencies.gradle'
@ -8,4 +9,4 @@ dependencies {
api project(':inifile')
api global_libs.snakeyaml
api 'org.apache.commons:commons-math3:3.6.1'
}
}

View File

@ -11,39 +11,43 @@ import java.util.List;
/**
* This tool generates C# or Java class based on enum values from C/C++ header related to rusEfi own Perf Trace
*
* <p>
* This allows developers to only edit C/C++ header yet see proper names in chrome://tracing JSON file
*
* <p>
* This is not used in runtime while profiling actual firmware
*
* @see JsonOutput
* @see EnumNames
*
* @see EnumNames
* @see Entry
*
*/
public class PerfTraceTool {
public class PerfTraceEnumGenerator {
private static final String ENUM_START_TAG = "enum_start_tag";
private static final String ENUM_END_TAG = "enum_end_tag";
public static void readPerfTrace(String inputFileName, String outputFileName, String topClassLine, String stringType) throws IOException {
public static void main(String[] args) throws IOException {
if (args.length != 2) {
System.err.println("Input and output file names expected");
System.exit(-1);
}
String inputFileName = args[0];
String outputFileName = args[1];
List<String> enumNames = readEnums(inputFileName);
System.out.println("Got enums: " + enumNames);
writeClass(outputFileName, enumNames, topClassLine, stringType);
writeClass(outputFileName, enumNames);
}
private static void writeClass(String outputFileName, List<String> enumNames, String topClassLine, String stringType) throws IOException {
private static void writeClass(String outputFileName, List<String> enumNames) throws IOException {
BufferedWriter writer = new BufferedWriter(new FileWriter(outputFileName));
writer.write(topClassLine + "\n\n");
writer.write("// generated " + new Date() + " by " + PerfTraceTool.class + "\n");
writer.write("package com.rusefi.tracing;\n");
writer.write("// generated " + new Date() + " by " + PerfTraceEnumGenerator.class + "\n");
writer.write("public class EnumNames {\n");
writer.write("\t" +
stringType +
"[] TypeNames = {" + "\n");
"public static final String" +
"[] TypeNames = {" + "\n");
for (String enumValue : enumNames)
writer.write("\t\"" + enumValue + "\",\n");

View File

@ -1,5 +1,5 @@
package com.rusefi.tracing;
// generated Thu Feb 15 09:37:27 EST 2024 by class com.rusefi.PerfTraceEnumGenerator
public class EnumNames {
public static final String[] TypeNames = {
"INVALID",
@ -33,13 +33,13 @@ public class EnumNames {
"GetSpeedDensityFuel",
"WallFuelAdjust",
"MapAveragingTriggerCallback",
"AdcCallbackFastComplete",
"Unused1",
"SingleTimerExecutorScheduleByTimestamp",
"GetTimeNowUs",
"EventQueueExecuteCallback",
"PwmGeneratorCallback",
"TunerStudioHandleCrcCommand",
"PwmConfigTogglePwmState",
"Unused",
"PwmConfigStateChangeCallback",
"Temporary1",
"Temporary2",
@ -52,5 +52,7 @@ public class EnumNames {
"GlobalUnlock",
"SoftwareKnockProcess",
"LogTriggerTooth",
"LuaTickFunction",
"LuaOneCanRxFunction",
};
}

View File

@ -1,6 +1,6 @@
package com.rusefi.tracing;
import com.rusefi.PerfTraceTool;
import com.rusefi.PerfTraceEnumGenerator;
import java.io.IOException;
import java.io.OutputStream;
@ -12,7 +12,7 @@ import java.util.List;
* This class helps to write JSON files readable by chrome://tracing/
* <p>
* See https://github.com/catapult-project/catapult/blob/master/tracing/README.md
* @see PerfTraceTool code generator for EnumNames.java
* @see PerfTraceEnumGenerator code generator for EnumNames.java
*/
public class JsonOutput {

View File

@ -66,7 +66,6 @@ public class ConsoleTools {
registerTool("headless", ConsoleTools::runHeadless, "Connect to rusEFI controller and start saving logs.");
registerTool("basic-ui", BasicStartupFrame::runTool, "Basic UI");
registerTool("ptrace_enums", ConsoleTools::runPerfTraceTool, "NOT A USER TOOL. Development tool to process performance trace enums");
registerTool("functional_test", ConsoleTools::runFunctionalTest, "NOT A USER TOOL. Development tool related to functional testing");
registerTool("convert_binary_configuration_to_xml", ConsoleTools::convertBinaryToXml, "NOT A USER TOOL. Development tool to convert binary configuration into XML form.");
@ -208,11 +207,6 @@ public class ConsoleTools {
stream.sendPacket(commandBytes);
}
private static void runPerfTraceTool(String[] args) throws IOException {
PerfTraceTool.readPerfTrace(args[1], args[2], args[3], args[4]);
}
private static void setAuthToken(String[] args) {
String newToken = args[1];
System.out.println("Saving auth token " + newToken);