Author: njn
Date: 2007-09-22 00:41:46 +0100 (Sat, 22 Sep 2007)
New Revision: 6895

Log:
Print massif's and ms_prints args in the output.

Modified:
   branches/MASSIF2/massif/ms_main.c
   branches/MASSIF2/massif/ms_print
   branches/MASSIF2/massif/tests/alloc-fns-A.post.exp
   branches/MASSIF2/massif/tests/alloc-fns-B.post.exp
   branches/MASSIF2/massif/tests/basic.post.exp
   branches/MASSIF2/massif/tests/long-time.post.exp
   branches/MASSIF2/massif/tests/thresholds_0_0.post.exp
   branches/MASSIF2/massif/tests/thresholds_0_10.post.exp
   branches/MASSIF2/massif/tests/thresholds_10_0.post.exp
   branches/MASSIF2/massif/tests/thresholds_10_10.post.exp
   branches/MASSIF2/massif/tests/thresholds_5_0.post.exp
   branches/MASSIF2/massif/tests/thresholds_5_10.post.exp
   branches/MASSIF2/massif/tests/zero1.post.exp
   branches/MASSIF2/massif/tests/zero2.post.exp


Modified: branches/MASSIF2/massif/ms_main.c
===================================================================
--- branches/MASSIF2/massif/ms_main.c   2007-09-21 23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/ms_main.c   2007-09-21 23:41:46 UTC (rev 6895)
@@ -330,8 +330,13 @@
 static UInt clo_threshold   = 100;     // 100 == 1%
 static UInt clo_time_unit   = TimeMS;
 
+static XArray* args_for_massif;
+
 static Bool ms_process_cmd_line_option(Char* arg)
 {
+   // Remember the arg for later use.
+   VG_(addToXA)(args_for_massif, &arg);
+        
         VG_BOOL_CLO(arg, "--heap",       clo_heap)
    else VG_BOOL_CLO(arg, "--stacks",     clo_stacks)
 
@@ -1600,17 +1605,17 @@
       fd = sres.res;
    }
 
-   // Print description lines.  Include:
-   // * --alloc-fn values
-   // * --threshold values
-   FP("desc: Options:   XXX\n");
-//   FP("desc: Options:   Heap profiling %s.  Stack profiling %s\n",
-//         clo_heap ? "on" : "off", clo_stacks ? "on" : "off");
-//   FP("desc: Options:   Heap admin size = %u bytes.\n", clo_heap_admin);
-//   FP("desc: Options:   Max. tree depth = %u calls.\n", clo_depth);
-//   FP("desc: Options:   Significance threshold = %s\n",
-//         make_perc(clo_threshold, 10000));
-//   FP("desc: Allocation functions = ...");
+   // Print massif-specific options that were used.
+   // XXX: is it worth having a "desc:" line?  Could just call it "options:"
+   // -- this file format isn't as generic as Cachegrind's, so the
+   // implied genericity of "desc:" is bogus.
+   FP("desc:");
+   for (i = 0; i < VG_(sizeXA)(args_for_massif); i++) {
+      Char* arg = *(Char**)VG_(indexXA)(args_for_massif, i);
+      FP(" %s", arg);
+   }
+   if (0 == i) FP(" (none)");
+   FP("\n");
 
    // Print "cmd:" line.
    FP("cmd: ");
@@ -1744,6 +1749,9 @@
    // Initialise alloc_fns.
    init_alloc_fns();
 
+   // Initialise args_for_massif.
+   args_for_massif = VG_(newXA)(VG_(malloc), VG_(free), sizeof(HChar*));
+
    tl_assert( VG_(getcwd)(base_dir, VKI_PATH_MAX) );
 }
 

Modified: branches/MASSIF2/massif/ms_print
===================================================================
--- branches/MASSIF2/massif/ms_print    2007-09-21 23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/ms_print    2007-09-21 23:41:46 UTC (rev 6895)
@@ -53,6 +53,9 @@
 # Version number  (XXX: change it when I convert this file to ms_print.in)
 my $version = "XXX";    # "@VERSION@";
 
+# Args passed, for printing.
+my $ms_print_args;
+
 # Usage message.
 my $usage = <<END
 usage: ms_print [options] <file>
@@ -89,8 +92,14 @@
 sub process_cmd_line() 
 {
     my @files;
+
+    # Grab a copy of the arguments, for printing later.
     for my $arg (@ARGV) { 
+        $ms_print_args .= " $arg";       # The arguments.
+    }
 
+    for my $arg (@ARGV) { 
+
         # Option handling
         if ($arg =~ /^-/) {
 
@@ -264,7 +273,7 @@
     # Read "desc:" lines.
     my $line;
     while ($line = get_line()) {
-        if ($line =~ s/^desc:\s*//) {
+        if ($line =~ s/^desc://) {
             $desc .= $line;
         } else {
             last;
@@ -360,9 +369,9 @@
     #-------------------------------------------------------------------------
     # XXX: print the massif invocation and the ms_print invocation
     print($fancy_nl);
-    print("Command:   $cmd\n");
-    print("Data file: $input_file\n");
-    print("$desc");
+    print("Command:            $cmd\n");
+    print("Massif arguments:  $desc");
+    print("ms_print arguments:$ms_print_args\n");
     print($fancy_nl);
     print("\n\n");
 

Modified: branches/MASSIF2/massif/tests/alloc-fns-A.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/alloc-fns-A.post.exp  2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/alloc-fns-A.post.exp  2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./alloc-fns
-Data file: massif.out
-Options:   XXX
+Command:            ./alloc-fns
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0
+ms_print arguments: massif.out
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/alloc-fns-B.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/alloc-fns-B.post.exp  2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/alloc-fns-B.post.exp  2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./alloc-fns
-Data file: massif.out
-Options:   XXX
+Command:            ./alloc-fns
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --alloc-fn=a4 
--alloc-fn=b3 --alloc-fn=c2 --alloc-fn=d1 --alloc-fn=d3
+ms_print arguments: massif.out
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/basic.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/basic.post.exp        2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/basic.post.exp        2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./basic
-Data file: massif.out
-Options:   XXX
+Command:            ./basic
+Massif arguments:   --stacks=no --time-unit=B
+ms_print arguments: massif.out
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/long-time.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/long-time.post.exp    2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/long-time.post.exp    2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./long-time
-Data file: massif.out
-Options:   XXX
+Command:            ./long-time
+Massif arguments:   --stacks=no --time-unit=B
+ms_print arguments: massif.out
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_0_0.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_0_0.post.exp       2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_0_0.post.exp       2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0
+ms_print arguments: massif.out --threshold=0
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_0_10.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_0_10.post.exp      2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_0_10.post.exp      2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=0
+ms_print arguments: massif.out --threshold=10
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_10_0.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_10_0.post.exp      2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_10_0.post.exp      2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=1000
+ms_print arguments: massif.out --threshold=0
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_10_10.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_10_10.post.exp     2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_10_10.post.exp     2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=1000
+ms_print arguments: massif.out --threshold=10
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_5_0.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_5_0.post.exp       2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_5_0.post.exp       2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=500
+ms_print arguments: massif.out --threshold=0
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/thresholds_5_10.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/thresholds_5_10.post.exp      2007-09-21 
23:11:15 UTC (rev 6894)
+++ branches/MASSIF2/massif/tests/thresholds_5_10.post.exp      2007-09-21 
23:41:46 UTC (rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./thresholds
-Data file: massif.out
-Options:   XXX
+Command:            ./thresholds
+Massif arguments:   --stacks=no --time-unit=B --heap-admin=0 --threshold=500
+ms_print arguments: massif.out --threshold=10
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/zero1.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/zero1.post.exp        2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/zero1.post.exp        2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./zero
-Data file: massif.out
-Options:   XXX
+Command:            ./zero
+Massif arguments:   --stacks=no --heap-admin=no --time-unit=B
+ms_print arguments: --threshold=0 massif.out
 
--------------------------------------------------------------------------------
 
 

Modified: branches/MASSIF2/massif/tests/zero2.post.exp
===================================================================
--- branches/MASSIF2/massif/tests/zero2.post.exp        2007-09-21 23:11:15 UTC 
(rev 6894)
+++ branches/MASSIF2/massif/tests/zero2.post.exp        2007-09-21 23:41:46 UTC 
(rev 6895)
@@ -1,7 +1,7 @@
 
--------------------------------------------------------------------------------
-Command:   ./zero
-Data file: massif.out
-Options:   XXX
+Command:            ./zero
+Massif arguments:   --stacks=no --heap-admin=no --time-unit=B
+ms_print arguments: massif.out
 
--------------------------------------------------------------------------------
 
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to