add flush_count jtag queue profiling feature

git-svn-id: svn://svn.berlios.de/openocd/trunk@1674 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2009-05-08 11:46:01 +00:00
parent 8a58fb9402
commit 49e286509b
1 changed files with 17 additions and 1 deletions

View File

@ -43,7 +43,7 @@
#endif #endif
#include <assert.h> #include <assert.h>
int jtag_flush_queue_count; /* count # of flushes for profiling / debugging purposes */
/* note that this is not marked as static as it must be available from outside jtag.c for those /* note that this is not marked as static as it must be available from outside jtag.c for those
that implement the jtag_xxx() minidriver layer that implement the jtag_xxx() minidriver layer
@ -243,6 +243,7 @@ static int handle_jtag_reset_command(struct command_context_s *cmd_ctx, char *cm
static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_runtest_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv); static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args);
static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@ -1446,6 +1447,11 @@ int MINIDRIVER(interface_jtag_execute_queue)(void)
void jtag_execute_queue_noclear(void) void jtag_execute_queue_noclear(void)
{ {
/* each flush can take as much as 1-2ms on high bandwidth low latency interfaces.
* E.g. a JTAG over TCP/IP or USB....
*/
jtag_flush_queue_count++;
int retval=interface_jtag_execute_queue(); int retval=interface_jtag_execute_queue();
/* we keep the first error */ /* we keep the first error */
if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK)) if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK))
@ -2180,6 +2186,7 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
register_command(cmd_ctx, NULL, "irscan", handle_irscan_command, register_command(cmd_ctx, NULL, "irscan", handle_irscan_command,
COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ..."); COMMAND_EXEC, "execute IR scan <device> <instr> [dev2] [instr2] ...");
register_jim(cmd_ctx, "drscan", Jim_Command_drscan, "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ..."); register_jim(cmd_ctx, "drscan", Jim_Command_drscan, "execute DR scan <device> <num_bits> <value> <num_bits1> <value2> ...");
register_jim(cmd_ctx, "flush_count", Jim_Command_flush_count, "returns number of times the JTAG queue has been flushed");
register_command(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command, register_command(cmd_ctx, NULL, "verify_ircapture", handle_verify_ircapture_command,
COMMAND_ANY, "verify value captured during Capture-IR <enable|disable>"); COMMAND_ANY, "verify value captured during Capture-IR <enable|disable>");
@ -2945,6 +2952,15 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
return JIM_OK; return JIM_OK;
} }
static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args)
{
Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_flush_queue_count));
return JIM_OK;
}
static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) static int handle_verify_ircapture_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{ {
if (argc == 1) if (argc == 1)