added Perf bin
This commit is contained in:
38
src/bin/Perf.hx
Normal file
38
src/bin/Perf.hx
Normal file
@@ -0,0 +1,38 @@
|
||||
package bin;
|
||||
|
||||
import kernel.peripherals.Peripherals.Peripheral;
|
||||
import lib.CLIAppBase;
|
||||
|
||||
class Perf extends CLIAppBase {
|
||||
public function new() {
|
||||
registerSyncSubcommand("inspect",(args)->{
|
||||
if (args.length < 1) return false;
|
||||
|
||||
var result = Peripheral.instance.inspect(args[0]);
|
||||
|
||||
if (result == null){
|
||||
handle.writeLine("No peripheral found on side "+args[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
handle.writeLine("Types:");
|
||||
for (type in result.types){
|
||||
handle.writeLine(" "+type);
|
||||
}
|
||||
|
||||
handle.writeLine("Methods:");
|
||||
for (method in result.methods){
|
||||
handle.writeLine(" "+method);
|
||||
}
|
||||
|
||||
return true;
|
||||
},"<side>");
|
||||
|
||||
registerSyncSubcommand("list",(args)->{
|
||||
for (addr in Peripheral.instance.getAllAddresses()){
|
||||
handle.writeLine('$addr => ${Peripheral.instance.getTypes(addr).join(", ")}');
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user