Don't like btrecord against libaio and librt, as it doesn't use any of their symbols
[blktrace.git] / blktrace.c
index ee8d25d4d5f56bb4c5740e5df1ec4e42e6eb9a77..4d458acc8e26065e31eaabaf9a47051a968e0760 100644 (file)
@@ -47,7 +47,7 @@
 #include "blktrace.h"
 #include "barrier.h"
 
-static char blktrace_version[] = "0.99.2";
+static char blktrace_version[] = "0.99.3";
 
 /*
  * You may want to increase this even more, if you are logging at a high
@@ -60,7 +60,7 @@ static char blktrace_version[] = "0.99.2";
 
 #define DEBUGFS_TYPE   0x64626720
 
-#define S_OPTS "d:a:A:r:o:kw:Vb:n:D:lh:p:s"
+#define S_OPTS "d:a:A:r:o:kw:Vb:n:D:lh:p:sI:"
 static struct option l_opts[] = {
        {
                .name = "dev",
@@ -68,6 +68,12 @@ static struct option l_opts[] = {
                .flag = NULL,
                .val = 'd'
        },
+       {
+               .name = "input-devs",
+               .has_arg = required_argument,
+               .flag = NULL,
+               .val = 'I'
+       },
        {
                .name = "act-mask",
                .has_arg = required_argument,
@@ -1218,6 +1224,7 @@ static int start_devices(void)
                fprintf(stderr, "Out of memory, threads (%d)\n", size * ndevs);
                return 1;
        }
+       memset(thread_information, 0, size * ndevs);
 
        for_each_dip(dip, i) {
                if (start_trace(dip)) {
@@ -1749,9 +1756,9 @@ static int net_setup_client(void)
 
 static char usage_str[] = \
        "-d <dev> [ -r debugfs path ] [ -o <output> ] [-k ] [ -w time ]\n" \
-       "[ -a action ] [ -A action mask ] [ -v ]\n\n" \
+       "[ -a action ] [ -A action mask ] [ -I  <devs file> ] [ -v ]\n\n" \
        "\t-d Use specified device. May also be given last after options\n" \
-       "\t-r Path to mounted debugfs, defaults to /debug\n" \
+       "\t-r Path to mounted debugfs, defaults to /sys/kernel/debug\n" \
        "\t-o File(s) to send output to\n" \
        "\t-D Directory to prepend to output file names\n" \
        "\t-k Kill a running trace\n" \
@@ -1764,6 +1771,7 @@ static char usage_str[] = \
        "\t-h Run in network client mode, connecting to the given host\n" \
        "\t-p Network port to use (default 8462)\n" \
        "\t-s Make the network client NOT use sendfile() to transfer data\n" \
+       "\t-I Add devices found in <devs file>\n" \
        "\t-V Print program version info\n\n";
 
 static void show_usage(char *program)
@@ -1807,6 +1815,24 @@ int main(int argc, char *argv[])
                                return 1;
                        break;
 
+               case 'I': {
+                       char dev_line[256];
+                       FILE *ifp = fopen(optarg, "r");
+
+                       if (!ifp) {
+                               fprintf(stderr, 
+                                       "Invalid file for devices %s\n", 
+                                       optarg);
+                               return 1;
+                       }
+
+                       while (fscanf(ifp, "%s\n", dev_line) == 1)
+                               if (resize_devices(strdup(dev_line)) != 0)
+                                       return 1;
+                       break;
+               }
+                       
+
                case 'r':
                        debugfs_path = optarg;
                        break;