if (chipE2 == null) {
context.err.println("Can not find chip: " + chip2[0]);
return 1;
}
Profiler profiler = cpu.getProfiler();
SimpleProfiler sprof = (SimpleProfiler) profiler;
sprof.addProfileTag(context.getArgument(2), chipE1, chip1[1],
chipE2, chip2[1]);
return 0;
}
});
ch.registerCommand("printtags", new BasicCommand("print tags profile", "") {
public int executeCommand(CommandContext context) {
Profiler profiler = cpu.getProfiler();
SimpleProfiler sprof = (SimpleProfiler) profiler;
sprof.printTagProfile(context.out);
return 0;
}
});
ch.registerCommand("logcalls", new BasicAsyncCommand("log function calls", "") {
public int executeCommand(CommandContext context) {
Profiler profiler = cpu.getProfiler();
if (profiler == null) {
context.err.println("No profiler found.");
return 1;
}
profiler.setLogger(context.out);
return 0;
}
public void stopCommand(CommandContext context) {
Profiler profiler = cpu.getProfiler();
if (profiler != null) {
profiler.setLogger(null);
}
}
});
ch.registerCommand("profiler", new BasicCommand("configure profiler",
"<command> <arguments>") {
public int executeCommand(CommandContext context) {
// TODO: add more API's to the Profiler???
SimpleProfiler profiler = (SimpleProfiler) cpu.getProfiler();
if (profiler == null) {
context.err.println("No profiler found.");
return 1;
}
String cmd = context.getArgument(0);
if ("hide".equals(cmd)) {
for (int j = 1, n = context.getArgumentCount(); j < n; j++) {
profiler.addIgnoreFunction(context.getArgument(j));
}
} else if ("hideirq".equals(cmd)) {
profiler.setHideIRQ(context.getArgumentAsBoolean(1));
}
return 0;
}
});