summaryrefslogtreecommitdiff
path: root/btt/aqd.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2008-10-16 10:53:07 -0400
committerAlan D. Brunelle <alan.brunelle@hp.com>2008-10-16 10:56:12 -0400
commit4ae2c3c6215de3f9016b5211ac83893cb061b1e1 (patch)
tree885595ee9490c469bd299b9e8a700924aafb004f /btt/aqd.c
parentc54b9dd9a993fc76f3649279e6a4295f6aba2054 (diff)
downloadblktrace-4ae2c3c6215de3f9016b5211ac83893cb061b1e1.tar.gz
blktrace-4ae2c3c6215de3f9016b5211ac83893cb061b1e1.tar.bz2
Added in -Q / --active-queue-depth option
This will output a data file containing the time stamp and number of I/Os issued to underlying drivers per device. It will give you an idea as to how many I/Os are being actively worked per device at any time during the run.
Diffstat (limited to 'btt/aqd.c')
-rw-r--r--btt/aqd.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/btt/aqd.c b/btt/aqd.c
new file mode 100644
index 0000000..036a0d3
--- /dev/null
+++ b/btt/aqd.c
@@ -0,0 +1,73 @@
+/*
+ * blktrace output analysis: generate a timeline & gather statistics
+ *
+ * Copyright (C) 2006 Alan D. Brunelle <Alan.Brunelle@hp.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "globals.h"
+
+static struct file_info *aqd_files = NULL;
+
+struct aqd_info {
+ FILE *fp;
+ int na; /* # active */
+};
+
+void *aqd_init(char *str)
+{
+ char *oname;
+ struct aqd_info *ap;
+
+ if (aqd_name == NULL) return NULL;
+
+ ap = malloc(sizeof(*ap));
+ ap->na = 0;
+
+ oname = malloc(strlen(aqd_name) + strlen(str) + 32);
+ sprintf(oname, "%s_%s.dat", aqd_name, str);
+ if ((ap->fp = fopen(oname, "w")) == NULL) {
+ perror(oname);
+ return NULL;
+ }
+ add_file(&aqd_files, ap->fp, oname);
+
+ return ap;
+
+}
+
+void aqd_issue(void *info, double ts)
+{
+ struct aqd_info *ap = info;
+
+ fprintf(ap->fp, "%lf %d\n%lf %d\n", ts, ap->na, ts, ap->na + 1);
+
+ ap->na += 1;
+}
+
+void aqd_complete(void *info, double ts)
+{
+ struct aqd_info *ap = info;
+
+ if (ap->na > 0) {
+ fprintf(ap->fp, "%lf %d\n%lf %d\n", ts, ap->na, ts, ap->na - 1);
+ ap->na -= 1;
+ }
+}