Permalink
Browse files

Decode flag values in usfdump

Decode and print the decoded values from the flag field instead of just
the raw flags. Also, update the compression.sh test script to avoid
including the trace flag when greping for trace events.
  • Loading branch information...
1 parent 5c27a85 commit ff6e6d406d314518f9697c706d5d7cd1f11ee842 @andysan committed Apr 27, 2011
Showing with 19 additions and 3 deletions.
  1. +1 −1 test/compression.sh
  2. +18 −2 tools/usfdump.c
View
@@ -14,7 +14,7 @@ function run_test {
opts=$1; shift
$USF2USF $opts $USFFILE $TMPFILE1
- $USFDUMP $TMPFILE1 | grep -iE "(trace|burst|sample|dangling)" > $TMPFILE2
+ $USFDUMP $TMPFILE1 | grep -iE "^\[(trace|burst|sample|dangling)\]" > $TMPFILE2
diff $REFFILE $TMPFILE2
if [ "$?" != "0" ]; then
View
@@ -52,6 +52,18 @@ conf_t conf = {
.file = NULL
};
+struct {
+ usf_flags_t flag;
+ const char *name;
+} flag_names[] = {
+ { USF_FLAG_TRACE, "trace" },
+ { USF_FLAG_BURST, "burst" },
+ { USF_FLAG_DELTA, "delta compression"},
+ { USF_FLAG_INSTRUCTIONS, "instructions" },
+ { USF_FLAG_NATIVE_ENDIAN, "native endian" },
+ { USF_FLAG_FOREIGN_ENDIAN, "foreign endian" },
+};
+
static void
print_access(const usf_access_t *a)
{
@@ -120,20 +132,24 @@ print_header(const usf_header_t *h)
"Header:\n"
"\tVersion: %" PRIu16 ".%" PRIu16 "\n"
"\tCompression: %" PRIu16 " (%s)\n"
- "\tFlags: 0x%.8" PRIx32 "\n"
"\tSampling time: %" PRIu64 "-%" PRIu64 "\n"
"\tLine sizes: ",
USF_VERSION_MAJOR(h->version), USF_VERSION_MINOR(h->version),
h->compression, usf_strcompr(h->compression),
- h->flags,
h->time_begin, h->time_end);
print_line_sizes(h->line_sizes);
printf("\n\tCommand line:\n");
for (int i = 0; i < h->argc; i++)
printf("\t\t%s\n", h->argv[i]);
+
+ printf("\tFlags: 0x%.8" PRIx32 "\n", h->flags);
+ for (int i = 0; i < sizeof(flag_names) / sizeof(*flag_names); i++) {
+ if (h->flags & flag_names[i].flag)
+ printf("\t\t%s\n", flag_names[i].name);
+ }
}
static int

0 comments on commit ff6e6d4

Please sign in to comment.