Skip to contentSkip to conversation

perf: export tracepoint events via sysfs: block

RFC PATCH In review Lin Ming 1 participant 1 message Jul 22, 2010

lore
Share & tools
lore

Lin Ming

author
#0 lore raw

RFC PATCH 7/15 perf: export tracepoint events via sysfs: block

Block tracepoint events are exported like below,

/sys/devices/pci0000:00/0000:00:1f.1/host0/target0:0:0/0:0:0:0/block/sda/events

|-- block_bio_backmerge
|   |-- config
|   `-- type
|-- block_bio_bounce
|   |-- config
|   `-- type
|-- block_bio_complete
|   |-- config
|   `-- type
|-- block_bio_frontmerge
.....
/sys/devices/pci0000:00/0000:00:1f.1/host0/target0:0:0/0:0:0:0/block/sda/sda1/events
|-- block_bio_backmerge
|   |-- config
|   `-- type
|-- block_bio_bounce
|   |-- config
|   `-- type
|-- block_bio_complete
|   |-- config
|   `-- type
|-- block_bio_frontmerge

.....
/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0/block/sr0/events /sys/devices/virtual/block/ram0/events
....
/sys/devices/virtual/block/ram15/events /sys/devices/virtual/block/loop0/events
....
/sys/devices/virtual/block/loop7/events /sys/devices/virtual/block/md0/events

---
 fs/partitions/check.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
fs/partitions/check.c +7 -0
index 72c5265..e18ac81 100644
@@ -21,6 +21,7 @@
 #include <linux/ctype.h>
 #include <linux/genhd.h>
 #include <linux/blktrace_api.h>
+#include <linux/perf_event.h>
 
 #include "check.h"
 
@@ -446,6 +447,9 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
 	if (err)
 		goto out_put;
 
+	/* For example, /sys/block/sda1/events/ */
+	perf_sys_add_tp(&pdev->kobj, "block");
+
 	err = -ENOMEM;
 	p->holder_dir = kobject_create_and_add("holders", &pdev->kobj);
 	if (!p->holder_dir)
@@ -506,6 +510,9 @@ void register_disk(struct gendisk *disk)
 		device_del(ddev);
 		return;
 	}
+
+	/* For example, /sys/block/sda/events/ */
+	perf_sys_add_tp(&ddev->kobj, "block");
 #endif
 	disk->part0.holder_dir = kobject_create_and_add("holders", &ddev->kobj);
 	disk->slave_dir = kobject_create_and_add("slaves", &ddev->kobj);