Skip to content

Commit

Permalink
Added customized block layer trace points for analyzing I/O
Browse files Browse the repository at this point in the history
schedulers.
  • Loading branch information
tmiemietz committed Aug 13, 2019
1 parent e9e8e7c commit 6d25417
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions instrumentation/events/lttng-module/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,39 @@ LTTNG_TRACEPOINT_EVENT(block_bio_complete,
)
)

/**
* block_bio_complete2 - completed all work on the block operation, also listing
* pid of thread that signals the completion
* @q: queue holding the block operation
* @bio: block operation completed
* @error: io error value
* @ts: task struct of calling thread
*
* This tracepoint indicates there is no further work to do on this
* block IO operation @bio.
*
* Compability to kernel versions other than 4.15 is omitted.
*/
LTTNG_TRACEPOINT_EVENT(block_bio_complete2,
TP_PROTO(struct request_queue *q, struct bio *bio, int error,
struct task_struct *ts),

TP_ARGS(q, bio, error, ts),

TP_FIELDS(
ctf_integer(dev_t, dev, bio_dev(bio))
ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
ctf_integer(int, error, error)
blk_rwbs_ctf_integer(unsigned int, rwbs,
lttng_bio_op(bio), lttng_bio_rw(bio),
bio->bi_iter.bi_size)
ctf_integer(pid_t, reqtid, ts->pid)
ctf_array_text(char, comm, ts->comm, TASK_COMM_LEN)
ctf_integer_hex(unsigned long, bptr, (unsigned long) bio)
)
)

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
LTTNG_TRACEPOINT_EVENT_CLASS(block_bio_merge,

Expand Down Expand Up @@ -778,6 +811,67 @@ LTTNG_TRACEPOINT_EVENT(block_bio_queue,
ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
)
)

/**
* block_rq_issue2 - dispatch request to the device driver listing bio and
* "offending" pid
* @q: queue holding operation
* @bio: new block operation
* @ts: task struct that caused queueing
*
* About to place the block IO operation @bio into @q.
* Since this is only for kernel 4.15.0, I will omit backwards compability!
*/
LTTNG_TRACEPOINT_EVENT(block_rq_issue2,

TP_PROTO(struct request_queue *q, struct request *rq,
struct task_struct *ts),

TP_ARGS(q, rq, ts),

TP_FIELDS(
ctf_integer(dev_t, dev,
rq->rq_disk ? disk_devt(rq->rq_disk) : 0)
ctf_integer(sector_t, sector, blk_rq_trace_sector(rq))
ctf_integer(unsigned int, nr_sector, blk_rq_trace_nr_sectors(rq))
ctf_integer(unsigned int, bytes, blk_rq_bytes(rq))
ctf_integer(pid_t, tid, current->pid)
blk_rwbs_ctf_integer(unsigned int, rwbs,
lttng_req_op(rq), lttng_req_rw(rq), blk_rq_bytes(rq))
ctf_integer(pid_t, reqtid, ts->pid)
ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
ctf_integer_hex(unsigned long, bptr, (unsigned long) rq->bio)
ctf_integer(unsigned int, nr_hwq, q->nr_hw_queues)
)
)

/**
* block_bio_queue2 - putting new block IO operation in queue and listing
* current process id
* @q: queue holding operation
* @bio: new block operation
* @ts: task struct that caused queueing
*
* About to place the block IO operation @bio into @q.
* Since this is only for kernel 4.15.0, I will omit backwards compability!
*/
LTTNG_TRACEPOINT_EVENT(block_bio_queue2,

TP_PROTO(struct request_queue *q, struct bio *bio, struct task_struct *ts),

TP_ARGS(q, bio, ts),

TP_FIELDS(
ctf_integer(dev_t, dev, bio_dev(bio))
ctf_integer(sector_t, sector, bio->bi_iter.bi_sector)
ctf_integer(unsigned int, nr_sector, bio_sectors(bio))
blk_rwbs_ctf_integer(unsigned int, rwbs,
lttng_bio_op(bio), lttng_bio_rw(bio), bio->bi_iter.bi_size)
ctf_integer(pid_t, reqtid, ts->pid)
ctf_array_text(char, comm, current->comm, TASK_COMM_LEN)
ctf_integer_hex(unsigned long, bptr, (unsigned long) bio)
)
)
#else /* if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */
LTTNG_TRACEPOINT_EVENT_CLASS(block_bio,

Expand Down

0 comments on commit 6d25417

Please sign in to comment.