Skip to content

Commit

Permalink
完善代码
Browse files Browse the repository at this point in the history
  • Loading branch information
nanshuaibo committed Dec 21, 2023
1 parent 5bcbab6 commit 53ff52e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions eBPF_Supermarket/kvm_watcher/include/kvm_vcpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static int trace_kvm_halt_poll_ns(struct halt_poll_ns *ctx, void *rb,
e->grow = ctx->grow;
e->old = ctx->old;
e->new = ctx->new;
e->vcpu_id = ctx->vcpu_id;
bpf_get_current_comm(&e->process.comm, sizeof(e->process.comm));
bpf_ringbuf_submit(e, 0);
}
Expand Down
1 change: 1 addition & 0 deletions eBPF_Supermarket/kvm_watcher/include/kvm_watcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct halt_poll_ns_event {
unsigned int new;
unsigned int old;
unsigned long long time;
unsigned vcpu_id;
};

struct mark_page_dirty_in_slot_event {
Expand Down
8 changes: 4 additions & 4 deletions eBPF_Supermarket/kvm_watcher/src/kvm_watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,9 @@ static int handle_event(void *ctx, void *data, size_t data_sz) {
}
} else if (env.execute_halt_poll_ns) {
const struct halt_poll_ns_event *e = data;
printf("%-18llu %-15s %-6d/%-8d %-10s %-7d --> %d \n", e->time,
printf("%-18llu %-15s %-6d/%-8d %-10s %-7d %-7d --> %d \n", e->time,
e->process.comm, e->process.pid, e->process.tid,
e->grow ? "grow" : "shrink", e->old, e->new);
e->grow ? "grow" : "shrink", e->vcpu_id, e->old, e->new);
} else if (env.execute_mark_page_dirty) {
const struct mark_page_dirty_in_slot_event *e = data;
printf("%-18llu %-15s %-6d/%-8d %-10llx %-10llx %-10lu %-15lx %d \n",
Expand Down Expand Up @@ -535,8 +535,8 @@ int main(int argc, char **argv) {
printf("%-18s %-21s %-18s %-15s %-8s %-13s \n", "TIME", "EXIT_REASON",
"COMM", "PID/TID", "COUNT", "DURATION(ns)");
} else if (env.execute_halt_poll_ns) {
printf("%-18s %-15s %-15s %-10s %-11s %-10s\n", "TIME(ns)",
"COMM", "PID/TID", "TYPE", "OLD(ns)", "NEW(ns)");
printf("%-18s %-15s %-15s %-10s %-7s %-11s %-10s\n", "TIME(ns)",
"COMM", "PID/TID", "TYPE", "VCPU_ID", "OLD(ns)", "NEW(ns)");
} else if (env.execute_mark_page_dirty) {
printf("%-18s %-15s %-15s %-10s %-11s %-10s %-10s %-10s\n", "TIME(ns)",
"COMM", "PID/TID", "GFN", "REL_GFN", "NPAGES",
Expand Down

0 comments on commit 53ff52e

Please sign in to comment.