summaryrefslogtreecommitdiff
path: root/blkparse_fmt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-02-09 13:58:34 +0100
committerJens Axboe <axboe@suse.de>2006-02-09 13:58:34 +0100
commitbfc70ad577ae97011eed84b86b3c6ba01e23e80a (patch)
tree280f82f98be69ba559ef6743bbcc4fec729ad5f6 /blkparse_fmt.c
parent5975d309ac40b9724f70b46bbfa3747e8dc24ea5 (diff)
downloadblktrace-bfc70ad577ae97011eed84b86b3c6ba01e23e80a.tar.gz
blktrace-bfc70ad577ae97011eed84b86b3c6ba01e23e80a.tar.bz2
[PATCH] Shrink the trace by 1/3 by removing ->comm[16]
We now send notify messages out when we see a new process, so we don't need to repeatedly send the same 16 bytes of name info everytime.
Diffstat (limited to 'blkparse_fmt.c')
-rw-r--r--blkparse_fmt.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/blkparse_fmt.c b/blkparse_fmt.c
index 8fe9c19..ceeaaba 100644
--- a/blkparse_fmt.c
+++ b/blkparse_fmt.c
@@ -154,9 +154,12 @@ static void print_field(char *act, struct per_cpu_info *pci,
case 'c':
fprintf(ofp, strcat(format, "d"), pci->cpu);
break;
- case 'C':
- fprintf(ofp, strcat(format, "s"), t->comm);
+ case 'C': {
+ char *name = find_process_name(t->pid);
+
+ fprintf(ofp, strcat(format, "s"), name);
break;
+ }
case 'd': {
char rwbs[4];
@@ -253,6 +256,7 @@ static void process_default(char *act, struct per_cpu_info *pci,
int pdu_len, unsigned char *pdu_buf)
{
char rwbs[4];
+ char *name;
fill_rwbs(rwbs, t);
@@ -264,6 +268,8 @@ static void process_default(char *act, struct per_cpu_info *pci,
(int) SECONDS(t->time), (unsigned long) NANO_SECONDS(t->time),
t->pid, act, rwbs);
+ name = find_process_name(t->pid);
+
switch (act[0]) {
case 'R': /* Requeue */
case 'C': /* Complete */
@@ -295,16 +301,16 @@ static void process_default(char *act, struct per_cpu_info *pci,
p = dump_pdu(pdu_buf, pdu_len);
if (p)
fprintf(ofp, "(%s) ", p);
- fprintf(ofp, "[%s]\n", t->comm);
+ fprintf(ofp, "[%s]\n", name);
} else {
if (elapsed != -1ULL) {
fprintf(ofp, "%llu + %u (%8llu) [%s]\n",
(unsigned long long) t->sector,
- t_sec(t), elapsed, t->comm);
+ t_sec(t), elapsed, name);
} else {
fprintf(ofp, "%llu + %u [%s]\n",
(unsigned long long) t->sector,
- t_sec(t), t->comm);
+ t_sec(t), name);
}
}
break;
@@ -315,16 +321,16 @@ static void process_default(char *act, struct per_cpu_info *pci,
case 'G': /* Get request */
case 'S': /* Sleep request */
fprintf(ofp, "%llu + %u [%s]\n", (unsigned long long) t->sector,
- t_sec(t), t->comm);
+ t_sec(t), name);
break;
case 'P': /* Plug */
- fprintf(ofp, "[%s]\n", t->comm);
+ fprintf(ofp, "[%s]\n", name);
break;
case 'U': /* Unplug IO */
case 'T': /* Unplug timer */
- fprintf(ofp, "[%s] %u\n", t->comm, get_pdu_int(t));
+ fprintf(ofp, "[%s] %u\n", name, get_pdu_int(t));
break;
case 'A': { /* remap */
@@ -340,7 +346,7 @@ static void process_default(char *act, struct per_cpu_info *pci,
case 'X': /* Split */
fprintf(ofp, "%llu / %u [%s]\n", (unsigned long long) t->sector,
- get_pdu_int(t), t->comm);
+ get_pdu_int(t), name);
break;
default: