action: improve printing
authorBrian Norris <banorris@uci.edu>
Thu, 11 Oct 2012 02:24:29 +0000 (19:24 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 11 Oct 2012 02:24:29 +0000 (19:24 -0700)
The 'value' field of a ModelAction might actually represent a signed
number, a pointer, or something else entirely, so values look very huge
and uninformative when printed, especially in decimal. Hexadecimal
representation makes everything a little more readable, I think.

While I'm at it, I adjust the spacing a little and make VALUE_NONE into
a different magic number which is more recognizable in hex.

action.cc
action.h

index ca1285612b00c75fd7294bee5af80d3aa52a3468..44a6d9ad6948c116e3305bd955e204825f01bc96 100644 (file)
--- a/action.cc
+++ b/action.cc
@@ -409,16 +409,19 @@ void ModelAction::print() const
                break;
        }
 
-       printf("(%3d) Thread: %-2d   Action: %-13s   MO: %7s  Loc: %14p  Value: %-12" PRIu64,
+       printf("(%4d) Thread: %-2d   Action: %-13s   MO: %7s  Loc: %14p   Value: %-#18" PRIx64,
                        seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint);
        if (is_read()) {
                if (reads_from)
-                       printf(" Rf: %d", reads_from->get_seq_number());
+                       printf("  Rf: %-3d", reads_from->get_seq_number());
                else
-                       printf(" Rf: ?");
+                       printf("  Rf: ?  ");
        }
        if (cv) {
-               printf("\t");
+               if (is_read())
+                       printf(" ");
+               else
+                       printf("          ");
                cv->print();
        } else
                printf("\n");
index 4f63c181b0a3f2fca0a798fead208029af4a364b..dd7de7a1ec2ca17f6081708d77758577e74777d7 100644 (file)
--- a/action.h
+++ b/action.h
@@ -26,7 +26,7 @@ using std::memory_order_seq_cst;
 /** Note that this value can be legitimately used by a program, and
                hence by iteself does not indicate no value. */
 
-#define VALUE_NONE 1234567890
+#define VALUE_NONE 0xdeadbeef
 
 /** A special value to represent a successful trylock */