This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC][PATCH 4/5][flight-recorder] Add options


This patch adds two new options to stap for flight recorder mode.
'-B' option means the background mode. And '-S' option specifies
the wraparound limits.

-- 
Masami HIRAMATSU
2nd Research Dept.
Hitachi, Ltd., Systems Development Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com

 buildrun.cxx |    4 ++++
 main.cxx     |   26 +++++++++++++++++++++++++-
 session.h    |    2 ++
 3 files changed, 31 insertions(+), 1 deletion(-)
Index: src/buildrun.cxx
===================================================================
--- src.orig/buildrun.cxx	2006-07-01 03:24:43.000000000 +0900
+++ src/buildrun.cxx	2006-08-25 15:02:19.000000000 +0900
@@ -128,6 +128,7 @@
   string stpd_cmd = string("sudo ")
     + string(PKGLIBDIR) + "/stpd "
     + (s.bulk_mode ? "" : "-r ")
+    + (s.bg_mode ? "-B " : "")
     + (s.verbose>1 ? "" : "-q ")
     + (s.merge ? "" : "-m ")
     + "-u " + username + " "
@@ -144,6 +145,9 @@
   if (s.buffer_size)
     stpd_cmd += "-b " + stringify(s.buffer_size) + " ";

+  if (s.logfile_size)
+    stpd_cmd += "-l " + stringify(s.logfile_size) + " ";
+
   stpd_cmd += s.tmpdir + "/" + s.module_name + ".ko";

   if (s.verbose>1) clog << "Running " << stpd_cmd << endl;
Index: src/main.cxx
===================================================================
--- src.orig/main.cxx	2006-07-17 17:25:00.000000000 +0900
+++ src/main.cxx	2006-08-25 19:11:44.000000000 +0900
@@ -67,9 +67,12 @@
     << "   -u         unoptimized translation" << (s.unoptimized ? " [set]" : "") << endl
     << "   -g         guru mode" << (s.guru_mode ? " [set]" : "") << endl
     << "   -b         bulk (relayfs) mode" << (s.bulk_mode ? " [set]" : "") << endl
+    << "   -B         Background (daemon) mode" << (s.bg_mode ? " [set]" : "") << endl
     << "   -M         Don't merge per-cpu files for bulk (relayfs) mode" << (s.merge ? "" : " [set]") << endl
     << "   -s NUM     buffer size in megabytes, instead of "
     << s.buffer_size << endl
+    << "   -S NUM     logfile size in megabytes, instead of "
+    << s.logfile_size << endl
     << "   -p NUM     stop after pass NUM 1-5, instead of "
     << s.last_pass << endl
     << "              (parse, elaborate, translate, compile, run)" << endl
@@ -129,8 +132,10 @@
   s.timing = 0;
   s.guru_mode = false;
   s.bulk_mode = false;
+  s.bg_mode = false;
   s.unoptimized = false;
   s.buffer_size = 0;
+  s.logfile_size = 0;
   s.last_pass = 5;
   s.module_name = "stap_" + stringify(getpid());
   s.output_file = ""; // -o FILE
@@ -159,7 +164,7 @@

   while (true)
     {
-      int grc = getopt (argc, argv, "hVMvtp:I:e:o:R:r:m:kgc:x:D:bs:u");
+      int grc = getopt (argc, argv, "hVMBvtp:I:e:o:R:r:m:kgc:x:D:bs:S:u");
       if (grc < 0)
         break;
       switch (grc)
@@ -232,6 +237,10 @@
           s.bulk_mode = true;
           break;

+        case 'B':
+          s.bg_mode = true;
+          break;
+
 	case 'u':
 	  s.unoptimized = true;
 	  break;
@@ -245,6 +254,15 @@
             }
           break;

+        case 'S':
+          s.logfile_size = atoi (optarg);
+          if (s.logfile_size < 1 || s.logfile_size > 2048)
+            {
+              cerr << "Invalid buffer size (should be 1-2048)." << endl;
+	      usage (s, 1);
+            }
+          break;
+
 	case 'c':
 	  s.cmd = string (optarg);
 	  break;
@@ -273,6 +291,12 @@
       usage (s, 1);
     }

+  if(!s.bulk_mode && s.logfile_size)
+    {
+      cerr << "-S option is valid only for bulk (relayfs) mode." <<endl;
+      usage (s, 1);
+    }
+
   if(!s.output_file.empty() && s.bulk_mode && !s.merge)
     {
       cerr << "You can't specify -M, -b and -o options together." <<endl;
Index: src/session.h
===================================================================
--- src.orig/session.h	2006-05-09 18:33:19.000000000 +0900
+++ src/session.h	2006-08-25 15:02:19.000000000 +0900
@@ -74,9 +74,11 @@
   bool keep_tmpdir;
   bool guru_mode;
   bool bulk_mode;
+  bool bg_mode;
   bool unoptimized;
   bool merge;
   int buffer_size;
+  int logfile_size;

   // temporary directory for module builds etc.
   // hazardous - it is "rm -rf"'d at exit




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]