diff options
author | Alan D. Brunelle <alan.brunelle@hp.com> | 2009-02-11 16:16:12 -0500 |
---|---|---|
committer | Alan D. Brunelle <alan.brunelle@hp.com> | 2009-02-11 16:16:12 -0500 |
commit | 3b552a2d1ff8ecccbbb82668f73d1cb134fca1e9 (patch) | |
tree | 410f5b6a67d5018c32554b441427c086b77128ae | |
parent | e6855475478967e7cf92f8beece05ea55d31e6f1 (diff) | |
download | blktrace-3b552a2d1ff8ecccbbb82668f73d1cb134fca1e9.tar.gz |
Moved starting of tracing after tracers are going
Hold off BLKTRACESTART to threads are ready to consume tracers.
-rw-r--r-- | blktrace.c | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -933,19 +933,29 @@ static void setup_buts(void) if (ioctl(dpp->fd, BLKTRACESETUP, &buts) < 0) { fprintf(stderr, "BLKTRACESETUP(2) %s failed: %d/%s\n", dpp->path, errno, strerror(errno)); - continue; - } else if (ioctl(dpp->fd, BLKTRACESTART) < 0) { + } + else { + dpp->ncpus = ncpus; + dpp->buts_name = strdup(buts.name); + if (dpp->stats) + free(dpp->stats); + dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats)); + memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats)); + } + } +} + +static void start_buts(void) +{ + struct list_head *p; + + __list_for_each(p, &devpaths) { + struct devpath *dpp = list_entry(p, struct devpath, head); + + if (ioctl(dpp->fd, BLKTRACESTART) < 0) { fprintf(stderr, "BLKTRACESTART %s failed: %d/%s\n", dpp->path, errno, strerror(errno)); - continue; } - - dpp->ncpus = ncpus; - dpp->buts_name = strdup(buts.name); - if (dpp->stats) - free(dpp->stats); - dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats)); - memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats)); } } @@ -2557,6 +2567,8 @@ int main(int argc, char *argv[]) pthread_cond_broadcast(&ub_cond); pthread_mutex_unlock(&ub_mutex); + start_buts(); + if (net_mode == Net_client) printf("blktrace: connected!\n"); |