Skip to content

Commit

Permalink
add block_rq_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sf1999817 committed Sep 5, 2024
1 parent 8632749 commit cdc9323
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct {
__uint(max_entries, 256 * 1024);
} rb SEC(".maps");

// Tracepoint 处理程序
// 这里挂载点必须是struct trace_event_raw_block_rq_completion *ctx
SEC("tracepoint/block/block_rq_issue")
int tracepoint_block_rq_issue(struct trace_event_raw_block_rq_completion *ctx) {
struct event *e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <bpf/libbpf.h>
#include "block_rq_issue.h"
#include "block_rq_issue.skel.h"
#include <inttypes.h> // For PRIu64

static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va_list args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#define TASK_COMM_LEN 256

// 定义事件结构体
struct event {
long timestamp; // 时间戳
int dev; // 设备号
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct {
__type(value, u32);
} io_count_map SEC(".maps");

// Tracepoint 处理程序
// 这里挂载点得是这个struct trace_event_raw_block_rq_completion *ctx
SEC("tracepoint/block/block_rq_complete")
int tracepoint_block_visit(struct trace_event_raw_block_rq_completion *ctx) {
struct event *e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ static int handle_event_open(void *ctx, void *data, size_t data_sz)
int i = 0;
int map_fd = *(int *)ctx;//传递map得文件描述符


for (; i < e->n_; ++i) {
snprintf(fd_path, sizeof(fd_path), "/proc/%d/fd/%d", e->pid_,
i);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef __FS_WATCHER_H
#define __FS_WATCHER_H

/*open*/

#define path_size 256

#define TASK_COMM_LEN 256

/*open*/
struct event_open {
int pid_;
char path_name_[path_size];
Expand Down

0 comments on commit cdc9323

Please sign in to comment.