gethostlatency: remove unused code
@@ -34,7 +34,6 @@ struct val_t {
struct data_t {
u32 pid;
- u64 ts;
u64 delta;
char comm[TASK_COMM_LEN];
char host[80];
@@ -77,7 +76,6 @@ int do_return(struct pt_regs *ctx) {
bpf_probe_read(&data.host, sizeof(data.host), (void *)valp->host);
data.pid = valp->pid;
data.delta = tsp - valp->ts;
- data.ts = tsp / 1000;
events.perf_submit(ctx, &data, sizeof(data));
start.delete(&pid);
return 0;
@@ -96,37 +94,19 @@ TASK_COMM_LEN = 16 # linux/sched.h
class Data(ct.Structure):
_fields_ = [
("pid", ct.c_ulonglong),
- ("ts", ct.c_ulonglong),
("delta", ct.c_ulonglong),
("comm", ct.c_char * TASK_COMM_LEN),
("host", ct.c_char * 80)
]
-start_ts = 0
-prev_ts = 0
-delta = 0
-
# header
print("%-9s %-6s %-16s %10s %s" % ("TIME", "PID", "COMM", "LATms", "HOST"))
def print_event(cpu, data, size):
event = ct.cast(data, ct.POINTER(Data)).contents
- global start_ts
- global prev_ts
- global delta
-
- if start_ts == 0:
- prev_ts = start_ts
-
- if start_ts == 1:
- delta = float(delta) + (event.ts - prev_ts)
-
print("%-9s %-6d %-16s %10.2f %s" % (strftime("%H:%M:%S"), event.pid,
event.comm, (event.delta / 1000000), event.host))
- prev_ts = event.ts
- start_ts = 1
-
# loop with callback to print_event
b["events"].open_perf_buffer(print_event)
while 1:
