summaryrefslogtreecommitdiff
path: root/btt/latency.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2009-10-08 08:39:02 -0400
committerAlan D. Brunelle <alan.brunelle@hp.com>2009-10-08 08:39:02 -0400
commita155ab989ffc8b9cf95a631309e9a825d04bcc68 (patch)
tree2fcf17c8a1e3a9c2f2e128dec4e7d14a8e118dca /btt/latency.c
parent677ef89ccb24fb3e38b13b02b9394318afb78f30 (diff)
downloadblktrace-a155ab989ffc8b9cf95a631309e9a825d04bcc68.tar.gz
blktrace-a155ab989ffc8b9cf95a631309e9a825d04bcc68.tar.bz2
btt: better data file naming
More logical naming for .dat files created. Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
Diffstat (limited to 'btt/latency.c')
-rw-r--r--btt/latency.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/btt/latency.c b/btt/latency.c
index e3ecc26..51e6881 100644
--- a/btt/latency.c
+++ b/btt/latency.c
@@ -26,18 +26,16 @@ static inline void latency_out(FILE *ofp, __u64 tstamp, __u64 latency)
fprintf(ofp, "%lf %lf\n", TO_SEC(tstamp), TO_SEC(latency));
}
-FILE *latency_open(__u32 device, char *name, char *post)
+FILE *latency_open(struct d_info *dip, char *name, char *post)
{
FILE *fp = NULL;
if (name) {
- int mjr, mnr;
- char oname[strlen(name) + 32];
+ size_t tlen = strlen(name) + strlen(dip->dip_name)
+ + strlen(post) + 32;
+ char oname[tlen];
- mjr = device >> MINORBITS;
- mnr = device & ((1 << MINORBITS) - 1);
-
- sprintf(oname, "%s_%03d,%03d_%s.dat", name, mjr, mnr, post);
+ sprintf(oname, "%s_%s_%s.dat", name, dip->dip_name, post);
if ((fp = my_fopen(oname, "w")) == NULL)
perror(oname);
else
@@ -49,9 +47,9 @@ FILE *latency_open(__u32 device, char *name, char *post)
void latency_alloc(struct d_info *dip)
{
- dip->q2d_ofp = latency_open(dip->device, q2d_name, "q2d");
- dip->d2c_ofp = latency_open(dip->device, d2c_name, "d2c");
- dip->q2c_ofp = latency_open(dip->device, q2c_name, "q2c");
+ dip->q2d_ofp = latency_open(dip, q2d_name, "q2d");
+ dip->d2c_ofp = latency_open(dip, d2c_name, "d2c");
+ dip->q2c_ofp = latency_open(dip, q2c_name, "q2c");
}
void latency_q2d(struct d_info *dip, __u64 tstamp, __u64 latency)