Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/radostrace.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ int uprobe_send_op(struct pt_regs *ctx) {
return 0;
}
memset(val, 0, sizeof(struct client_op_v));
val->sent_stamp = bpf_ktime_get_boot_ns();
val->tid = key.tid;
val->cid = key.cid;
val->rw = 0;
Expand Down Expand Up @@ -180,6 +179,7 @@ int uprobe_send_op(struct pt_regs *ctx) {
bpf_printk("uprobe_send_op got M_start %d\n", M_start);
} else {
bpf_printk("uprobe_send_op got NULL vf at varid %d\n", varid);
bpf_map_delete_elem(&ops, &key);
return 0;
}

Expand All @@ -195,6 +195,7 @@ int uprobe_send_op(struct pt_regs *ctx) {
bpf_printk("uprobe_send_op got m_finish %d\n", m_finish);
} else {
bpf_printk("uprobe_send_op got NULL vf at varid %d\n", varid);
bpf_map_delete_elem(&ops, &key);
return 0;
}

Expand All @@ -220,6 +221,7 @@ int uprobe_send_op(struct pt_regs *ctx) {
bpf_printk("uprobe_send_op got m_start %lld\n", m_start);
} else {
bpf_printk("uprobe_send_op got NULL vf at varid %d\n", varid);
bpf_map_delete_elem(&ops, &key);
return 0;
}

Expand All @@ -234,10 +236,13 @@ int uprobe_send_op(struct pt_regs *ctx) {
bpf_printk("uprobe_send_op got m_start %d\n", val->ops_size);
} else {
bpf_printk("uprobe_send_op got NULL vf at varid %d\n", varid);
bpf_map_delete_elem(&ops, &key);
return 0;
}

val->ops_size &= 3;
if (val->ops_size > 3) {
val->ops_size = 3;
}
val->offset = 0;
val->length = 0;
for (__u32 i = 0; i < 3; ++i) {
Expand Down Expand Up @@ -276,6 +281,9 @@ int uprobe_send_op(struct pt_regs *ctx) {
}
}

val->sent_stamp = bpf_ktime_get_boot_ns();
val->pid = get_pid();

//bpf_map_update_elem(&ops, &key, val, 0);// no need to update again here
return 0;
}
Expand Down Expand Up @@ -318,10 +326,10 @@ int uprobe_finish_op(struct pt_regs *ctx) {
return 0;
}
opv->finish_stamp = bpf_ktime_get_boot_ns();
opv->pid = get_pid();
// submit to ringbuf
struct client_op_v *e = bpf_ringbuf_reserve(&rb, sizeof(struct client_op_v), 0);
if (NULL == e) {
bpf_map_delete_elem(&ops, &key);
return 0;
}
*e = *opv;
Expand Down
Loading
Loading